Repository navigation
Commit e2dfa11
fix(create-void): validate Cloudflare-compatible project names (#541)
The lowercase check added in #513 still accepts names such as `my_app`,
`my.app`, `my app`, paths, and names longer than a workers.dev DNS
label. The scaffolder writes the supplied name directly into
package.json, so these inputs should receive actionable validation
before files are created or dependencies installed.
Extend the validator already shared by the interactive prompt and
positional CLI argument to require lowercase ASCII letters, digits, and
dashes, with an alphanumeric first/last character and a maximum of 63
characters. Preserve lowercase diagnostics and the interactive default.
Add regression coverage for invalid characters, paths, Unicode/control
characters, dash boundaries, single-character names, and the
63/64-character boundary; document the accepted project-name format.
Cloudflare references:
- [Worker name
configuration](https://developers.cloudflare.com/workers/wrangler/configuration/#inheritable-keys):
alphanumeric characters and dashes; underscores are explicitly
disallowed.
- [workers.dev
limitations](https://developers.cloudflare.com/workers/configuration/routing/workers-dev/#limitations):
at most 63 characters, with no leading/trailing dash. Workers without
workers.dev can have names up to 255 characters; the scaffolder
intentionally uses the workers.dev-compatible limit. Cloudflare itself
permits uppercase; this change preserves Void's existing lowercase
policy.
This narrows scaffold inputs: paths (including `.`) and scoped names are
rejected because the input is also used as the package name. Existing
project deployment naming and the separately validated Void platform
slug remain unchanged.
Validation: five dependency-free Node test groups against the production
validator/parser passed, covering valid/invalid input tables,
boundaries, defaults, and existing argument forwarding. The repository
Vite+ tests, affected-test checks, typecheck, and full suite could not
run because `vp` is unavailable and the shell proxy is unreachable,
preventing dependency installation.
---------
Signed-off-by: Christoph Nakazawa <christoph.pojer@gmail.com>
Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>1 parent 6ab6559 commit e2dfa11
2 files changed
Lines changed: 74 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
17 | 32 | | |
18 | 33 | | |
19 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
24 | 42 | | |
25 | 43 | | |
26 | 44 | | |
| |||
33 | 51 | | |
34 | 52 | | |
35 | 53 | | |
36 | | - | |
37 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
38 | 95 | | |
39 | 96 | | |
40 | 97 | | |
| |||
0 commit comments