create-newt-app 0.0.2 → 0.2.0
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/index.js +29 -7
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import chalk from "chalk";
|
|
|
7
7
|
// package.json
|
|
8
8
|
var package_default = {
|
|
9
9
|
name: "create-newt-app",
|
|
10
|
-
version: "0.0
|
|
10
|
+
version: "0.2.0",
|
|
11
11
|
private: false,
|
|
12
12
|
type: "module",
|
|
13
13
|
bin: {
|
|
@@ -18,6 +18,7 @@ var package_default = {
|
|
|
18
18
|
],
|
|
19
19
|
scripts: {
|
|
20
20
|
build: "tsup",
|
|
21
|
+
"build:watch": "tsup --watch",
|
|
21
22
|
dev: "tsup --watch"
|
|
22
23
|
},
|
|
23
24
|
dependencies: {
|
|
@@ -164,7 +165,8 @@ async function scaffold(modules, options) {
|
|
|
164
165
|
process.exit(1);
|
|
165
166
|
}
|
|
166
167
|
const templateData = {
|
|
167
|
-
projectName: options.name
|
|
168
|
+
projectName: options.name,
|
|
169
|
+
testing: options.testing
|
|
168
170
|
};
|
|
169
171
|
await renderTemplatesToDisk(modules, options.name, templateData);
|
|
170
172
|
const packages = modules.map((mod) => mod.packages).filter((ele) => ele !== void 0).flat();
|
|
@@ -217,6 +219,20 @@ async function doInit(options) {
|
|
|
217
219
|
if (/[<>:"/\\|?*]/.test(value)) return "Project name contains invalid characters";
|
|
218
220
|
}
|
|
219
221
|
})
|
|
222
|
+
},
|
|
223
|
+
...!options.ci && {
|
|
224
|
+
shadcn: () => p.confirm({
|
|
225
|
+
message: "Use shadcn/ui?",
|
|
226
|
+
initialValue: true
|
|
227
|
+
}),
|
|
228
|
+
testing: () => p.select({
|
|
229
|
+
message: "Testing framework?",
|
|
230
|
+
options: [
|
|
231
|
+
{ value: "vitest", label: "Vitest" },
|
|
232
|
+
{ value: "jest", label: "Jest" }
|
|
233
|
+
],
|
|
234
|
+
initialValue: "jest"
|
|
235
|
+
})
|
|
220
236
|
}
|
|
221
237
|
};
|
|
222
238
|
try {
|
|
@@ -226,14 +242,17 @@ async function doInit(options) {
|
|
|
226
242
|
process.exit(0);
|
|
227
243
|
}
|
|
228
244
|
});
|
|
245
|
+
const useShadcn = options.ci ? options.shadcn : group2.shadcn ?? true;
|
|
246
|
+
const testing = options.ci ? options.testing : group2.testing ?? "jest";
|
|
229
247
|
const allModules = [
|
|
230
248
|
templates.root,
|
|
231
249
|
templates.web,
|
|
232
250
|
templates.api,
|
|
233
251
|
templates.auth,
|
|
234
|
-
templates.ui,
|
|
252
|
+
useShadcn ? templates.shadcnUi : templates.ui,
|
|
235
253
|
templates.eslintConfig,
|
|
236
|
-
templates.typescriptConfig
|
|
254
|
+
templates.typescriptConfig,
|
|
255
|
+
testing === "vitest" ? templates.testingVitest : templates.testingJest
|
|
237
256
|
];
|
|
238
257
|
const name = group2.name ?? options.name ?? "";
|
|
239
258
|
const taskBuilder = new TaskBuilder();
|
|
@@ -241,7 +260,7 @@ async function doInit(options) {
|
|
|
241
260
|
title: "Scaffolding project",
|
|
242
261
|
task: async () => {
|
|
243
262
|
try {
|
|
244
|
-
await scaffold(allModules, { name });
|
|
263
|
+
await scaffold(allModules, { name, testing });
|
|
245
264
|
} catch (e) {
|
|
246
265
|
console.log(e);
|
|
247
266
|
}
|
|
@@ -295,14 +314,17 @@ async function doInit(options) {
|
|
|
295
314
|
}
|
|
296
315
|
}
|
|
297
316
|
var program = new Command();
|
|
298
|
-
program.name("create-newt-app").version(package_default.version).description("Create a new newt-app monorepo").argument("[name]").option("-ni, --no-install", "Skip pnpm install", true).option("-ng, --no-git", "Skip git initialization", true).action(
|
|
317
|
+
program.name("create-newt-app").version(package_default.version).description("Create a new newt-app monorepo").argument("[name]").option("-ni, --no-install", "Skip pnpm install", true).option("-ng, --no-git", "Skip git initialization", true).option("--ci", "Non-interactive mode", false).option("--shadcn", "Include shadcn/ui (used with --ci)", false).option("--testing <framework>", "Testing framework: vitest or jest (used with --ci)", "jest").action(
|
|
299
318
|
async (name, options) => {
|
|
300
319
|
console.log("\n");
|
|
301
320
|
intro(`Create a ${chalk.blue("newt")} app.`);
|
|
302
321
|
await doInit({
|
|
303
322
|
name,
|
|
304
323
|
install: options.install,
|
|
305
|
-
git: options.git
|
|
324
|
+
git: options.git,
|
|
325
|
+
ci: options.ci,
|
|
326
|
+
shadcn: options.shadcn,
|
|
327
|
+
testing: options.testing === "jest" ? "jest" : "vitest"
|
|
306
328
|
});
|
|
307
329
|
}
|
|
308
330
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-newt-app",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"ejs": "^3.1.10",
|
|
17
17
|
"execa": "^9.6.0",
|
|
18
18
|
"zod": "^3.25.76",
|
|
19
|
-
"@newt-app/templates": "0.0
|
|
19
|
+
"@newt-app/templates": "0.2.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/ejs": "^3.1.5",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"build": "tsup",
|
|
29
|
+
"build:watch": "tsup --watch",
|
|
29
30
|
"dev": "tsup --watch"
|
|
30
31
|
}
|
|
31
32
|
}
|