create-nx-archweave 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/bin.js +23 -0
- package/dist/cli/parse-args.js +5 -0
- package/dist/cli/workspace-name.d.ts +9 -0
- package/dist/cli/workspace-name.js +29 -0
- package/dist/index.js +23 -0
- package/package.json +1 -4
package/README.md
CHANGED
|
@@ -185,7 +185,7 @@ The printed next steps cover the first commit. If review is enabled, they also c
|
|
|
185
185
|
|
|
186
186
|
- `nx build create-nx-archweave` runs tsc, for local dev and typecheck.
|
|
187
187
|
- `nx test` runs Jest.
|
|
188
|
-
- `nx bundle` (depends on `build`) uses esbuild to bundle `src/index.ts` and `src/bin.ts` into `dist/`. The `bin.js` shebang is preserved, and
|
|
188
|
+
- `nx bundle` (depends on `build`) uses esbuild to bundle `src/index.ts` and `src/bin.ts` into `dist/`. The `bin.js` shebang is preserved, and the CLI has no runtime dependencies.
|
|
189
189
|
- The CLI has no runtime import of the plugin. It only names the plugin as an install spec.
|
|
190
190
|
|
|
191
191
|
## License
|
package/dist/bin.js
CHANGED
|
@@ -153,6 +153,25 @@ function describeResolution(resolution) {
|
|
|
153
153
|
return `${name} (${SOURCE_TEXT[resolution.source]})`;
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
+
// src/cli/workspace-name.ts
|
|
157
|
+
var MAX_LENGTH = 214;
|
|
158
|
+
var EXAMPLE = "my-app";
|
|
159
|
+
function workspaceNameProblem(name) {
|
|
160
|
+
if (name.length === 0) return "it is empty";
|
|
161
|
+
if (/\s/.test(name)) return "it contains whitespace";
|
|
162
|
+
if (name.length > MAX_LENGTH) return `it is ${name.length} characters long, and npm allows at most ${MAX_LENGTH}`;
|
|
163
|
+
if (name.startsWith(".") || name.startsWith("_")) return `it starts with "${name[0]}"`;
|
|
164
|
+
if (/[A-Z]/.test(name)) return "it contains uppercase letters, and npm package names are lowercase";
|
|
165
|
+
const others = [...new Set(name.replace(/[a-z0-9._-]/g, ""))];
|
|
166
|
+
if (others.length > 0) {
|
|
167
|
+
return `it contains ${others.map((char) => `"${char}"`).join(", ")} \u2014 only lowercase letters, digits, "-", "_" and "." are allowed`;
|
|
168
|
+
}
|
|
169
|
+
return void 0;
|
|
170
|
+
}
|
|
171
|
+
function invalidWorkspaceNameMessage(name, problem) {
|
|
172
|
+
return `Invalid workspace name "${name}": ${problem}. For example: ${EXAMPLE}`;
|
|
173
|
+
}
|
|
174
|
+
|
|
156
175
|
// src/cli/parse-args.ts
|
|
157
176
|
var STRING_VALUE_FLAGS = /* @__PURE__ */ new Set(["--preset", "--frontend", "--backend", "--locale", "--ai-hosts", "--plugins", "--review-provider", "--plugin-source", "--package-manager"]);
|
|
158
177
|
function extractReviewFlag(argv) {
|
|
@@ -216,6 +235,10 @@ function parseCliArgs(argv) {
|
|
|
216
235
|
};
|
|
217
236
|
}
|
|
218
237
|
const name = parsed.positionals[0];
|
|
238
|
+
const nameProblem = name === void 0 ? void 0 : workspaceNameProblem(name);
|
|
239
|
+
if (name !== void 0 && nameProblem !== void 0) {
|
|
240
|
+
return { kind: "error", message: invalidWorkspaceNameMessage(name, nameProblem) };
|
|
241
|
+
}
|
|
219
242
|
const preset = parsed.values.preset;
|
|
220
243
|
if (preset !== void 0 && !PRESET_VALUES.includes(preset)) {
|
|
221
244
|
return { kind: "error", message: invalidChoiceMessage("--preset", preset, PRESET_VALUES) };
|
package/dist/cli/parse-args.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { parseArgs as parseNodeArgs } from 'node:util';
|
|
2
2
|
import { AI_HOST_VALUES, BACKEND_VALUES, FRONTEND_VALUES, LOCALE_VALUES, PLUGIN_VALUES, PRESET_VALUES, REVIEW_PROVIDER_VALUES, } from "./types.js";
|
|
3
3
|
import { isCliPackageManager } from "./package-manager.js";
|
|
4
|
+
import { invalidWorkspaceNameMessage, workspaceNameProblem } from "./workspace-name.js";
|
|
4
5
|
/** The string-valued flags declared below, in their separated two-token form
|
|
5
6
|
* (`--preset solo`). extractReviewFlag must never treat the token AFTER one of
|
|
6
7
|
* these as a review flag — it is that flag's value, so both tokens pass through
|
|
@@ -88,6 +89,10 @@ export function parseCliArgs(argv) {
|
|
|
88
89
|
};
|
|
89
90
|
}
|
|
90
91
|
const name = parsed.positionals[0];
|
|
92
|
+
const nameProblem = name === undefined ? undefined : workspaceNameProblem(name);
|
|
93
|
+
if (name !== undefined && nameProblem !== undefined) {
|
|
94
|
+
return { kind: 'error', message: invalidWorkspaceNameMessage(name, nameProblem) };
|
|
95
|
+
}
|
|
91
96
|
const preset = parsed.values.preset;
|
|
92
97
|
if (preset !== undefined && !PRESET_VALUES.includes(preset)) {
|
|
93
98
|
return { kind: 'error', message: invalidChoiceMessage('--preset', preset, PRESET_VALUES) };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why `name` can't be a workspace name, or undefined when it can. The name becomes the
|
|
3
|
+
* directory and the root package.json name, and it reaches create-nx-workspace as an
|
|
4
|
+
* argument — on Windows through cmd.exe — so only npm's package-name characters pass:
|
|
5
|
+
* lowercase letters, digits, "-", "_" and ".", not starting with "." or "_".
|
|
6
|
+
*/
|
|
7
|
+
export declare function workspaceNameProblem(name: string): string | undefined;
|
|
8
|
+
export declare function invalidWorkspaceNameMessage(name: string, problem: string): string;
|
|
9
|
+
//# sourceMappingURL=workspace-name.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** npm's limit on a package name, which the workspace name becomes. */
|
|
2
|
+
const MAX_LENGTH = 214;
|
|
3
|
+
const EXAMPLE = 'my-app';
|
|
4
|
+
/**
|
|
5
|
+
* Why `name` can't be a workspace name, or undefined when it can. The name becomes the
|
|
6
|
+
* directory and the root package.json name, and it reaches create-nx-workspace as an
|
|
7
|
+
* argument — on Windows through cmd.exe — so only npm's package-name characters pass:
|
|
8
|
+
* lowercase letters, digits, "-", "_" and ".", not starting with "." or "_".
|
|
9
|
+
*/
|
|
10
|
+
export function workspaceNameProblem(name) {
|
|
11
|
+
if (name.length === 0)
|
|
12
|
+
return 'it is empty';
|
|
13
|
+
if (/\s/.test(name))
|
|
14
|
+
return 'it contains whitespace';
|
|
15
|
+
if (name.length > MAX_LENGTH)
|
|
16
|
+
return `it is ${name.length} characters long, and npm allows at most ${MAX_LENGTH}`;
|
|
17
|
+
if (name.startsWith('.') || name.startsWith('_'))
|
|
18
|
+
return `it starts with "${name[0]}"`;
|
|
19
|
+
if (/[A-Z]/.test(name))
|
|
20
|
+
return 'it contains uppercase letters, and npm package names are lowercase';
|
|
21
|
+
const others = [...new Set(name.replace(/[a-z0-9._-]/g, ''))];
|
|
22
|
+
if (others.length > 0) {
|
|
23
|
+
return `it contains ${others.map((char) => `"${char}"`).join(', ')} — only lowercase letters, digits, "-", "_" and "." are allowed`;
|
|
24
|
+
}
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
export function invalidWorkspaceNameMessage(name, problem) {
|
|
28
|
+
return `Invalid workspace name "${name}": ${problem}. For example: ${EXAMPLE}`;
|
|
29
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -50,6 +50,25 @@ function isCliPackageManager(name) {
|
|
|
50
50
|
return SUPPORTED.includes(name);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
// src/cli/workspace-name.ts
|
|
54
|
+
var MAX_LENGTH = 214;
|
|
55
|
+
var EXAMPLE = "my-app";
|
|
56
|
+
function workspaceNameProblem(name) {
|
|
57
|
+
if (name.length === 0) return "it is empty";
|
|
58
|
+
if (/\s/.test(name)) return "it contains whitespace";
|
|
59
|
+
if (name.length > MAX_LENGTH) return `it is ${name.length} characters long, and npm allows at most ${MAX_LENGTH}`;
|
|
60
|
+
if (name.startsWith(".") || name.startsWith("_")) return `it starts with "${name[0]}"`;
|
|
61
|
+
if (/[A-Z]/.test(name)) return "it contains uppercase letters, and npm package names are lowercase";
|
|
62
|
+
const others = [...new Set(name.replace(/[a-z0-9._-]/g, ""))];
|
|
63
|
+
if (others.length > 0) {
|
|
64
|
+
return `it contains ${others.map((char) => `"${char}"`).join(", ")} \u2014 only lowercase letters, digits, "-", "_" and "." are allowed`;
|
|
65
|
+
}
|
|
66
|
+
return void 0;
|
|
67
|
+
}
|
|
68
|
+
function invalidWorkspaceNameMessage(name, problem) {
|
|
69
|
+
return `Invalid workspace name "${name}": ${problem}. For example: ${EXAMPLE}`;
|
|
70
|
+
}
|
|
71
|
+
|
|
53
72
|
// src/cli/parse-args.ts
|
|
54
73
|
var STRING_VALUE_FLAGS = /* @__PURE__ */ new Set(["--preset", "--frontend", "--backend", "--locale", "--ai-hosts", "--plugins", "--review-provider", "--plugin-source", "--package-manager"]);
|
|
55
74
|
function extractReviewFlag(argv) {
|
|
@@ -113,6 +132,10 @@ function parseCliArgs(argv) {
|
|
|
113
132
|
};
|
|
114
133
|
}
|
|
115
134
|
const name = parsed.positionals[0];
|
|
135
|
+
const nameProblem = name === void 0 ? void 0 : workspaceNameProblem(name);
|
|
136
|
+
if (name !== void 0 && nameProblem !== void 0) {
|
|
137
|
+
return { kind: "error", message: invalidWorkspaceNameMessage(name, nameProblem) };
|
|
138
|
+
}
|
|
116
139
|
const preset = parsed.values.preset;
|
|
117
140
|
if (preset !== void 0 && !PRESET_VALUES.includes(preset)) {
|
|
118
141
|
return { kind: "error", message: invalidChoiceMessage("--preset", preset, PRESET_VALUES) };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-nx-archweave",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "One command from an empty directory to a configured Nx workspace: FSD Lite structure, AI agent rules, GitHub templates, and optional AI PR review (Claude, Gemini, GPT, Cursor)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "clearlydev (https://github.com/clearlydev)",
|
|
@@ -74,8 +74,5 @@
|
|
|
74
74
|
]
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
},
|
|
78
|
-
"dependencies": {
|
|
79
|
-
"tslib": "^2.3.0"
|
|
80
77
|
}
|
|
81
78
|
}
|