create-newt-app 0.1.1 → 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 +28 -7
- package/package.json +2 -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.
|
|
10
|
+
version: "0.2.0",
|
|
11
11
|
private: false,
|
|
12
12
|
type: "module",
|
|
13
13
|
bin: {
|
|
@@ -165,7 +165,8 @@ async function scaffold(modules, options) {
|
|
|
165
165
|
process.exit(1);
|
|
166
166
|
}
|
|
167
167
|
const templateData = {
|
|
168
|
-
projectName: options.name
|
|
168
|
+
projectName: options.name,
|
|
169
|
+
testing: options.testing
|
|
169
170
|
};
|
|
170
171
|
await renderTemplatesToDisk(modules, options.name, templateData);
|
|
171
172
|
const packages = modules.map((mod) => mod.packages).filter((ele) => ele !== void 0).flat();
|
|
@@ -218,6 +219,20 @@ async function doInit(options) {
|
|
|
218
219
|
if (/[<>:"/\\|?*]/.test(value)) return "Project name contains invalid characters";
|
|
219
220
|
}
|
|
220
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
|
+
})
|
|
221
236
|
}
|
|
222
237
|
};
|
|
223
238
|
try {
|
|
@@ -227,14 +242,17 @@ async function doInit(options) {
|
|
|
227
242
|
process.exit(0);
|
|
228
243
|
}
|
|
229
244
|
});
|
|
245
|
+
const useShadcn = options.ci ? options.shadcn : group2.shadcn ?? true;
|
|
246
|
+
const testing = options.ci ? options.testing : group2.testing ?? "jest";
|
|
230
247
|
const allModules = [
|
|
231
248
|
templates.root,
|
|
232
249
|
templates.web,
|
|
233
250
|
templates.api,
|
|
234
251
|
templates.auth,
|
|
235
|
-
templates.ui,
|
|
252
|
+
useShadcn ? templates.shadcnUi : templates.ui,
|
|
236
253
|
templates.eslintConfig,
|
|
237
|
-
templates.typescriptConfig
|
|
254
|
+
templates.typescriptConfig,
|
|
255
|
+
testing === "vitest" ? templates.testingVitest : templates.testingJest
|
|
238
256
|
];
|
|
239
257
|
const name = group2.name ?? options.name ?? "";
|
|
240
258
|
const taskBuilder = new TaskBuilder();
|
|
@@ -242,7 +260,7 @@ async function doInit(options) {
|
|
|
242
260
|
title: "Scaffolding project",
|
|
243
261
|
task: async () => {
|
|
244
262
|
try {
|
|
245
|
-
await scaffold(allModules, { name });
|
|
263
|
+
await scaffold(allModules, { name, testing });
|
|
246
264
|
} catch (e) {
|
|
247
265
|
console.log(e);
|
|
248
266
|
}
|
|
@@ -296,14 +314,17 @@ async function doInit(options) {
|
|
|
296
314
|
}
|
|
297
315
|
}
|
|
298
316
|
var program = new Command();
|
|
299
|
-
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(
|
|
300
318
|
async (name, options) => {
|
|
301
319
|
console.log("\n");
|
|
302
320
|
intro(`Create a ${chalk.blue("newt")} app.`);
|
|
303
321
|
await doInit({
|
|
304
322
|
name,
|
|
305
323
|
install: options.install,
|
|
306
|
-
git: options.git
|
|
324
|
+
git: options.git,
|
|
325
|
+
ci: options.ci,
|
|
326
|
+
shadcn: options.shadcn,
|
|
327
|
+
testing: options.testing === "jest" ? "jest" : "vitest"
|
|
307
328
|
});
|
|
308
329
|
}
|
|
309
330
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-newt-app",
|
|
3
|
-
"version": "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.
|
|
19
|
+
"@newt-app/templates": "0.2.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/ejs": "^3.1.5",
|