create-newt-app 0.20.1 → 0.21.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.
Files changed (2) hide show
  1. package/dist/index.js +16 -4
  2. 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.20.1",
10
+ version: "0.21.0",
11
11
  private: false,
12
12
  type: "module",
13
13
  bin: {
@@ -166,7 +166,8 @@ async function scaffold(modules, options) {
166
166
  }
167
167
  const templateData = {
168
168
  projectName: options.name,
169
- testing: options.testing
169
+ testing: options.testing,
170
+ database: options.database
170
171
  };
171
172
  await renderTemplatesToDisk(modules, options.name, templateData);
172
173
  const packages = modules.map((mod) => mod.packages).filter((ele) => ele !== void 0).flat();
@@ -233,6 +234,14 @@ async function doInit(options) {
233
234
  ],
234
235
  initialValue: "jest"
235
236
  }),
237
+ database: () => p.select({
238
+ message: "Database?",
239
+ options: [
240
+ { value: "sqlite", label: "SQLite" },
241
+ { value: "postgres", label: "Postgres" }
242
+ ],
243
+ initialValue: "sqlite"
244
+ }),
236
245
  nestDiOnly: () => p.confirm({
237
246
  message: "Use NestJS for dependency injection only?",
238
247
  initialValue: false
@@ -262,6 +271,7 @@ async function doInit(options) {
262
271
  });
263
272
  const useShadcn = options.ci ? options.shadcn : group2.shadcn ?? true;
264
273
  const testing = options.ci ? options.testing : group2.testing ?? "jest";
274
+ const database = options.ci ? options.database : group2.database ?? "sqlite";
265
275
  const deployment = options.ci ? options.deployment : group2.deployment ?? "none";
266
276
  const nestDiOnly = options.ci ? options.nestDiOnly : group2.nestDiOnly ?? false;
267
277
  const todoExample = options.ci ? !options.bare : group2.todoExample ?? true;
@@ -270,6 +280,7 @@ async function doInit(options) {
270
280
  templates.root,
271
281
  templates.web,
272
282
  templates.api,
283
+ database === "postgres" ? templates.dbPostgres : templates.dbSqlite,
273
284
  templates.auth,
274
285
  useShadcn ? templates.shadcnUi : templates.ui,
275
286
  templates.eslintConfig,
@@ -289,7 +300,7 @@ async function doInit(options) {
289
300
  title: "Scaffolding project",
290
301
  task: async () => {
291
302
  try {
292
- await scaffold(allModules, { name, testing });
303
+ await scaffold(allModules, { name, testing, database });
293
304
  } catch (e) {
294
305
  console.log(e);
295
306
  }
@@ -341,7 +352,7 @@ async function doInit(options) {
341
352
  }
342
353
  }
343
354
  var program = new Command();
344
- 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").option("--deployment <strategy>", "Deployment extras: standalone, custom-server, spa (used with --ci)", "none").option("--nest-di-only", "Use NestJS for dependency injection only (used with --ci)", false).option("--bare", "Skip the todo example (used with --ci)", false).action(
355
+ 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").option("--database <database>", "Database: sqlite or postgres (used with --ci)", "sqlite").option("--deployment <strategy>", "Deployment extras: standalone, custom-server, spa (used with --ci)", "none").option("--nest-di-only", "Use NestJS for dependency injection only (used with --ci)", false).option("--bare", "Skip the todo example (used with --ci)", false).action(
345
356
  async (name, options) => {
346
357
  intro(`Create a ${chalk.blue("newt")} app.`);
347
358
  await doInit({
@@ -351,6 +362,7 @@ program.name("create-newt-app").version(package_default.version).description("Cr
351
362
  ci: options.ci,
352
363
  shadcn: options.shadcn,
353
364
  testing: options.testing === "vitest" ? "vitest" : "jest",
365
+ database: options.database === "postgres" ? "postgres" : "sqlite",
354
366
  deployment: ["standalone", "custom-server", "spa"].includes(options.deployment) ? options.deployment : "none",
355
367
  nestDiOnly: options.nestDiOnly,
356
368
  bare: options.bare
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-newt-app",
3
- "version": "0.20.1",
3
+ "version": "0.21.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.20.1"
19
+ "@newt-app/templates": "0.21.0"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/ejs": "^3.1.5",