@wangs-ui/create-react-app 1.0.26-alpha.4 → 1.0.28
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/dist/bin.js +92 -73
- package/package.json +7 -6
- package/template/package.json +4 -4
package/dist/bin.js
CHANGED
|
@@ -3,7 +3,7 @@ import path from "node:path";
|
|
|
3
3
|
import process$1 from "node:process";
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
|
-
import
|
|
6
|
+
import { cancel, intro, isCancel, multiselect, outro, select, spinner, text } from "@clack/prompts";
|
|
7
7
|
//#region src/utils/fs.ts
|
|
8
8
|
/**
|
|
9
9
|
* Recursively copy a template directory into the target directory,
|
|
@@ -132,7 +132,8 @@ function generateProject(options) {
|
|
|
132
132
|
const { projectName, targetDir, preset, agents } = options;
|
|
133
133
|
let templateDir = path.resolve(__dirname, "../template");
|
|
134
134
|
if (!fs.existsSync(templateDir)) templateDir = path.resolve(__dirname, "template");
|
|
135
|
-
|
|
135
|
+
const s = spinner();
|
|
136
|
+
s.start(`Scaffolding Wangs UI React Application in ${path.basename(targetDir)}...`);
|
|
136
137
|
copyProjectTemplate({
|
|
137
138
|
srcDir: templateDir,
|
|
138
139
|
destDir: targetDir,
|
|
@@ -150,90 +151,108 @@ function generateProject(options) {
|
|
|
150
151
|
templateDir,
|
|
151
152
|
agents
|
|
152
153
|
});
|
|
154
|
+
s.stop("Project structure initialized.");
|
|
153
155
|
const pm = detectPackageManager();
|
|
154
156
|
const installCmd = getInstallCommand(pm);
|
|
155
157
|
const devCmd = getRunCommand(pm, "dev");
|
|
156
158
|
const lintCmd = getRunCommand(pm, "lint");
|
|
157
|
-
console.log("\n\x1B[32m✨ Project created successfully!\x1B[0m\n");
|
|
158
159
|
if (configuredAgents.length > 0) {
|
|
159
|
-
console.log("\x1B[1m🤖 AI Agent MCP & Skills Configured:\x1B[0m");
|
|
160
|
-
for (const agent of configuredAgents) console.log(`
|
|
161
|
-
console.log();
|
|
160
|
+
console.log("\n\x1B[1m🤖 AI Agent MCP & Skills Configured:\x1B[0m");
|
|
161
|
+
for (const agent of configuredAgents) console.log(` \x1b[32m✔\x1b[0m ${agent}`);
|
|
162
162
|
}
|
|
163
|
-
|
|
164
|
-
if (!(targetDir === process.cwd())) {
|
|
165
|
-
const relPath = path.relative(process.cwd(), targetDir);
|
|
166
|
-
console.log(` \x1b[36mcd\x1b[0m ${relPath}`);
|
|
167
|
-
}
|
|
168
|
-
console.log(` \x1b[36m${installCmd}\x1b[0m`);
|
|
169
|
-
console.log(` \x1b[36m${devCmd}\x1b[0m`);
|
|
170
|
-
console.log(` \x1b[36m${lintCmd}\x1b[0m \x1b[2m(runs Oxlint)\x1b[0m\n`);
|
|
163
|
+
outro(`\x1b[32m✨ Project created successfully!\x1b[0m\n\n\x1b[1mNext steps:\x1b[0m\n ${targetDir === process.cwd() ? "" : `cd ${path.relative(process.cwd(), targetDir)}\n `}${installCmd}\n ${devCmd}\n ${lintCmd} \x1b[2m(runs Oxlint)\x1b[0m`);
|
|
171
164
|
}
|
|
172
165
|
//#endregion
|
|
173
166
|
//#region src/prompts.ts
|
|
174
167
|
async function promptUser(initialOptions) {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
if (!projectName) projectName = (await rl.question("\x1B[36m?\x1B[0m \x1B[1mProject name:\x1B[0m (\x1B[2mmy-wangs-app\x1B[0m) ")).trim() || "my-wangs-app";
|
|
182
|
-
if (!preset) if (initialOptions.yes) preset = "fixedasset";
|
|
183
|
-
else {
|
|
184
|
-
console.log("\n\x1B[1mSelect a Wangs UI Design Preset:\x1B[0m");
|
|
185
|
-
console.log(" \x1B[32m1)\x1B[0m fixedasset \x1B[2m(Recommended - Standard Theme)\x1B[0m");
|
|
186
|
-
console.log(" \x1B[32m2)\x1B[0m globalsettings \x1B[2m(Global Settings Theme)\x1B[0m");
|
|
187
|
-
preset = (await rl.question("\x1B[36m?\x1B[0m \x1B[1mEnter choice [1-2]:\x1B[0m (1) ")).trim() === "2" ? "globalsettings" : "fixedasset";
|
|
188
|
-
}
|
|
189
|
-
if (!agents) if (initialOptions.yes) agents = [
|
|
190
|
-
"kilo",
|
|
168
|
+
let { projectName, preset, agents } = initialOptions;
|
|
169
|
+
if (initialOptions.yes) return {
|
|
170
|
+
projectName: projectName || "my-wangs-app",
|
|
171
|
+
preset: "fixedasset",
|
|
172
|
+
agents: agents || [
|
|
173
|
+
"antigravity",
|
|
191
174
|
"opencode",
|
|
192
175
|
"claude",
|
|
193
|
-
"
|
|
194
|
-
]
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
agents = ["kilo"];
|
|
206
|
-
break;
|
|
207
|
-
case "3":
|
|
208
|
-
agents = ["opencode"];
|
|
209
|
-
break;
|
|
210
|
-
case "4":
|
|
211
|
-
agents = ["claude"];
|
|
212
|
-
break;
|
|
213
|
-
case "5":
|
|
214
|
-
agents = ["antigravity"];
|
|
215
|
-
break;
|
|
216
|
-
case "6":
|
|
217
|
-
agents = [];
|
|
218
|
-
break;
|
|
219
|
-
default:
|
|
220
|
-
agents = [
|
|
221
|
-
"kilo",
|
|
222
|
-
"opencode",
|
|
223
|
-
"claude",
|
|
224
|
-
"antigravity"
|
|
225
|
-
];
|
|
226
|
-
break;
|
|
176
|
+
"kilo"
|
|
177
|
+
]
|
|
178
|
+
};
|
|
179
|
+
intro("\x1B[36m🚀 Wangs UI React App Scaffolder\x1B[0m");
|
|
180
|
+
if (!projectName) {
|
|
181
|
+
const nameResponse = await text({
|
|
182
|
+
message: "What is your project name?",
|
|
183
|
+
placeholder: "my-wangs-app",
|
|
184
|
+
defaultValue: "my-wangs-app",
|
|
185
|
+
validate: (value) => {
|
|
186
|
+
if (!value || value.trim().length === 0) return "Project name cannot be empty";
|
|
187
|
+
if (/[<>:"/\\|?*]/.test(value)) return "Project name contains invalid characters";
|
|
227
188
|
}
|
|
189
|
+
});
|
|
190
|
+
if (isCancel(nameResponse)) {
|
|
191
|
+
cancel("Project scaffolding cancelled.");
|
|
192
|
+
process$1.exit(0);
|
|
228
193
|
}
|
|
229
|
-
|
|
230
|
-
projectName,
|
|
231
|
-
preset,
|
|
232
|
-
agents
|
|
233
|
-
};
|
|
234
|
-
} finally {
|
|
235
|
-
rl.close();
|
|
194
|
+
projectName = nameResponse.trim();
|
|
236
195
|
}
|
|
196
|
+
if (!preset) {
|
|
197
|
+
const presetResponse = await select({
|
|
198
|
+
message: "Select a Wangs UI Design Preset:",
|
|
199
|
+
options: [{
|
|
200
|
+
value: "fixedasset",
|
|
201
|
+
label: "Fixed Asset",
|
|
202
|
+
hint: "Recommended & Official Theme Preset"
|
|
203
|
+
}],
|
|
204
|
+
initialValue: "fixedasset"
|
|
205
|
+
});
|
|
206
|
+
if (isCancel(presetResponse)) {
|
|
207
|
+
cancel("Project scaffolding cancelled.");
|
|
208
|
+
process$1.exit(0);
|
|
209
|
+
}
|
|
210
|
+
preset = presetResponse;
|
|
211
|
+
}
|
|
212
|
+
if (!agents) {
|
|
213
|
+
const agentsResponse = await multiselect({
|
|
214
|
+
message: "Select AI Agent configurations to include: (Space to select/deselect, Enter to submit)",
|
|
215
|
+
options: [
|
|
216
|
+
{
|
|
217
|
+
value: "antigravity",
|
|
218
|
+
label: "Google Antigravity IDE",
|
|
219
|
+
hint: ".agents/skills + MCP rules"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
value: "opencode",
|
|
223
|
+
label: "OpenCode",
|
|
224
|
+
hint: "opencode.json MCP tooling"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
value: "claude",
|
|
228
|
+
label: "Claude Code",
|
|
229
|
+
hint: "CLAUDE.md developer instructions"
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
value: "kilo",
|
|
233
|
+
label: "Kilo Code",
|
|
234
|
+
hint: ".kilo MCP config"
|
|
235
|
+
}
|
|
236
|
+
],
|
|
237
|
+
initialValues: [
|
|
238
|
+
"antigravity",
|
|
239
|
+
"opencode",
|
|
240
|
+
"claude",
|
|
241
|
+
"kilo"
|
|
242
|
+
],
|
|
243
|
+
required: false
|
|
244
|
+
});
|
|
245
|
+
if (isCancel(agentsResponse)) {
|
|
246
|
+
cancel("Project scaffolding cancelled.");
|
|
247
|
+
process$1.exit(0);
|
|
248
|
+
}
|
|
249
|
+
agents = agentsResponse;
|
|
250
|
+
}
|
|
251
|
+
return {
|
|
252
|
+
projectName,
|
|
253
|
+
preset: "fixedasset",
|
|
254
|
+
agents
|
|
255
|
+
};
|
|
237
256
|
}
|
|
238
257
|
//#endregion
|
|
239
258
|
//#region bin.ts
|
|
@@ -245,10 +264,10 @@ async function main() {
|
|
|
245
264
|
if (arg === "-y" || arg === "--yes") options.yes = true;
|
|
246
265
|
else if (arg.startsWith("--preset=")) {
|
|
247
266
|
const val = arg.split("=")[1];
|
|
248
|
-
if (val === "fixedasset"
|
|
267
|
+
if (val === "fixedasset") options.preset = val;
|
|
249
268
|
} else if (arg === "--preset" && args[i + 1]) {
|
|
250
269
|
const val = args[++i];
|
|
251
|
-
if (val === "fixedasset"
|
|
270
|
+
if (val === "fixedasset") options.preset = val;
|
|
252
271
|
} else if (arg.startsWith("--agent=") || arg.startsWith("--agents=")) {
|
|
253
272
|
const val = arg.split("=")[1];
|
|
254
273
|
if (val === "all") options.agents = [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wangs-ui/create-react-app",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.28",
|
|
4
4
|
"description": "Scaffold a modern React app with Wangs UI, Vite 8, Oxlint, Oxfmt, and AI Agent MCP integration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antigravity",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"directory": "packages/create-react-app"
|
|
25
25
|
},
|
|
26
26
|
"bin": {
|
|
27
|
-
"create-react-app": "
|
|
28
|
-
"create-wangs-app": "
|
|
29
|
-
"create-wangs-ui-react-app": "
|
|
27
|
+
"create-react-app": "dist/bin.js",
|
|
28
|
+
"create-wangs-app": "dist/bin.js",
|
|
29
|
+
"create-wangs-ui-react-app": "dist/bin.js"
|
|
30
30
|
},
|
|
31
31
|
"files": [
|
|
32
32
|
"dist",
|
|
@@ -48,8 +48,9 @@
|
|
|
48
48
|
"access": "public",
|
|
49
49
|
"registry": "https://registry.npmjs.org/"
|
|
50
50
|
},
|
|
51
|
-
"
|
|
52
|
-
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@clack/prompts": "^1.7.0"
|
|
53
|
+
},
|
|
53
54
|
"scripts": {
|
|
54
55
|
"build": "vite build",
|
|
55
56
|
"check:publint": "publint",
|
package/template/package.json
CHANGED
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"format:check": "oxfmt --check"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@wangs-ui/react-core": "^1.0.
|
|
17
|
-
"@wangs-ui/react-i18n": "^1.0.
|
|
18
|
-
"@wangs-ui/react-icons": "^1.0.
|
|
19
|
-
"@wangs-ui/react-presets": "^1.0.
|
|
16
|
+
"@wangs-ui/react-core": "^1.0.28",
|
|
17
|
+
"@wangs-ui/react-i18n": "^1.0.28",
|
|
18
|
+
"@wangs-ui/react-icons": "^1.0.28",
|
|
19
|
+
"@wangs-ui/react-presets": "^1.0.28",
|
|
20
20
|
"clsx": "^2.1.1",
|
|
21
21
|
"react": "^19.2.7",
|
|
22
22
|
"react-dom": "^19.2.7",
|