@pauldvlp/vp-react-ts-nestjs 0.3.3 → 0.3.4

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 pauldvlp
3
+ Copyright (c) 2026 Paul Barahona
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -36,16 +36,16 @@ vp create @pauldvlp:vp-react-ts-nestjs -- \
36
36
 
37
37
  ## Options
38
38
 
39
- | Option | Type / values | Default | Notes |
40
- | ------------ | ------------- | --------- | ---------------------------------------------------------------------------------------------- |
41
- | `--name` | string | `my-app` | Root project / package name. |
39
+ | Option | Type / values | Default | Notes |
40
+ | ------------ | ------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
41
+ | `--name` | string | `my-app` | Root project / package name. |
42
42
  | `--scope` | string | `@<name>` | npm scope for workspace packages → `@scope/web`, `@scope/api`, `@scope/contracts`. Defaults to the project name prefixed with `@` (e.g. `--name acme` → `@acme`); falls back to `@app`. |
43
- | `--apiPort` | string | `3000` | Port the NestJS api listens on (substituted into the env default + the web proxy). |
44
- | `--webPort` | string | `5173` | Port the web dev server listens on. |
45
- | `--swagger` | boolean | `false` | Expose Swagger UI at `/docs` and the OpenAPI JSON at `/docs.json` (adds `@nestjs/swagger`). |
46
- | `--serveWeb` | boolean | `false` | Have the api serve the built web app for a single deployable (adds `@nestjs/serve-static`). |
47
- | `--docker` | boolean | `false` | Emit a multi-stage `apps/api/Dockerfile` (+ root `.dockerignore`). |
48
- | `--install` | boolean | `true` | Run `pnpm install` after scaffolding. `false` = files only. |
43
+ | `--apiPort` | string | `3000` | Port the NestJS api listens on (substituted into the env default + the web proxy). |
44
+ | `--webPort` | string | `5173` | Port the web dev server listens on. |
45
+ | `--swagger` | boolean | `false` | Expose Swagger UI at `/docs` and the OpenAPI JSON at `/docs.json` (adds `@nestjs/swagger`). |
46
+ | `--serveWeb` | boolean | `false` | Have the api serve the built web app for a single deployable (adds `@nestjs/serve-static`). |
47
+ | `--docker` | boolean | `false` | Emit a multi-stage `apps/api/Dockerfile` (+ root `.dockerignore`). |
48
+ | `--install` | boolean | `true` | Run `pnpm install` after scaffolding. `false` = files only. |
49
49
 
50
50
  ## What it scaffolds
51
51
 
package/dist/index.js CHANGED
@@ -103,7 +103,10 @@ function resolveDefault(d, options, directory) {
103
103
  }
104
104
  async function promptForOption(d, def) {
105
105
  if (d.type === "boolean") {
106
- return prompts.confirm({ message: d.message, initialValue: def === void 0 ? false : Boolean(def) });
106
+ return prompts.confirm({
107
+ message: d.message,
108
+ initialValue: def === void 0 ? false : Boolean(def)
109
+ });
107
110
  }
108
111
  if (d.type === "select") {
109
112
  return prompts.select({
@@ -148,7 +151,11 @@ function initGit(dir) {
148
151
  } catch {
149
152
  identity = ["-c", "user.name=create", "-c", "user.email=create@users.noreply.github.com"];
150
153
  }
151
- execFileSync("git", [...identity, "commit", "-m", "feat: initialize project", "--no-gpg-sign"], { cwd: dir, stdio: "ignore" });
154
+ execFileSync(
155
+ "git",
156
+ [...identity, "commit", "-m", "feat: initialize project", "--no-gpg-sign"],
157
+ { cwd: dir, stdio: "ignore" }
158
+ );
152
159
  } catch {
153
160
  }
154
161
  }
@@ -164,7 +171,11 @@ async function runTemplateCLI(template) {
164
171
  let directory = dirArg;
165
172
  if (!directory) {
166
173
  if (interactive) {
167
- const answer = await prompts.text({ message: "Where should we create your project?", placeholder: "my-app", defaultValue: "my-app" });
174
+ const answer = await prompts.text({
175
+ message: "Where should we create your project?",
176
+ placeholder: "my-app",
177
+ defaultValue: "my-app"
178
+ });
168
179
  if (prompts.isCancel(answer)) {
169
180
  prompts.cancel("Cancelled.");
170
181
  return 2;
@@ -250,16 +261,55 @@ var template_default = defineTemplate({
250
261
  },
251
262
  options: [
252
263
  // Default the name to the target directory the user chose, so they don't retype it.
253
- { key: "name", type: "string", message: "Root project / package name", default: ({ directory }) => dirName(directory), validate: validateName },
264
+ {
265
+ key: "name",
266
+ type: "string",
267
+ message: "Root project / package name",
268
+ default: ({ directory }) => dirName(directory),
269
+ validate: validateName
270
+ },
254
271
  // Lazily default the package scope to `@<name>` (prefixing `@` unless the name already has one),
255
272
  // so it tracks the project name instead of a fixed value. Falls back to `@app` when no name is set.
256
- { key: "scope", type: "string", message: "npm scope for workspace packages, e.g. @acme (defaults to @<name>)", default: ({ options }) => options.name ? toScope(options.name) : "@app", validate: validateScope },
273
+ {
274
+ key: "scope",
275
+ type: "string",
276
+ message: "npm scope for workspace packages, e.g. @acme (defaults to @<name>)",
277
+ default: ({ options }) => options.name ? toScope(options.name) : "@app",
278
+ validate: validateScope
279
+ },
257
280
  // Ports stay strings (validated as integers): they're only ever substituted into config files as text.
258
- { key: "apiPort", type: "string", message: "Port the NestJS api listens on", default: "3000", validate: validatePort },
259
- { key: "webPort", type: "string", message: "Port the web dev server listens on", default: "5173", validate: validatePort },
260
- { key: "swagger", type: "boolean", message: "Expose Swagger UI at /docs on the api", default: false },
261
- { key: "serveWeb", type: "boolean", message: "Have the api serve the built web app (single deployable)", default: false },
262
- { key: "docker", type: "boolean", message: "Add a multi-stage Dockerfile for the api", default: false },
281
+ {
282
+ key: "apiPort",
283
+ type: "string",
284
+ message: "Port the NestJS api listens on",
285
+ default: "3000",
286
+ validate: validatePort
287
+ },
288
+ {
289
+ key: "webPort",
290
+ type: "string",
291
+ message: "Port the web dev server listens on",
292
+ default: "5173",
293
+ validate: validatePort
294
+ },
295
+ {
296
+ key: "swagger",
297
+ type: "boolean",
298
+ message: "Expose Swagger UI at /docs on the api",
299
+ default: false
300
+ },
301
+ {
302
+ key: "serveWeb",
303
+ type: "boolean",
304
+ message: "Have the api serve the built web app (single deployable)",
305
+ default: false
306
+ },
307
+ {
308
+ key: "docker",
309
+ type: "boolean",
310
+ message: "Add a multi-stage Dockerfile for the api",
311
+ default: false
312
+ },
263
313
  { key: "install", type: "boolean", message: "Install deps after scaffolding", default: true }
264
314
  ],
265
315
  async produce({ options }) {
@@ -274,7 +324,10 @@ var template_default = defineTemplate({
274
324
  out = options.swagger ? out.replace("// __SWAGGER_IMPORT__", SWAGGER_IMPORT).replace("// __SWAGGER_SETUP__", swaggerSetup) : out.replace(/^[ \t]*\/\/ __SWAGGER_(IMPORT|SETUP)__\n/gm, "");
275
325
  }
276
326
  if (rel === APP_MODULE) {
277
- out = options.serveWeb ? out.replace("// __SERVEWEB_PATH_IMPORT__", "import { join } from 'node:path'\n").replace("// __SERVEWEB_MODULE_IMPORT__", "import { ServeStaticModule } from '@nestjs/serve-static'").replace(" // __SERVEWEB_MODULE__", SERVEWEB_MODULE) : out.replace(/^[ \t]*\/\/ __SERVEWEB_[A-Z_]+__\n/gm, "");
327
+ out = options.serveWeb ? out.replace("// __SERVEWEB_PATH_IMPORT__", "import { join } from 'node:path'\n").replace(
328
+ "// __SERVEWEB_MODULE_IMPORT__",
329
+ "import { ServeStaticModule } from '@nestjs/serve-static'"
330
+ ).replace(" // __SERVEWEB_MODULE__", SERVEWEB_MODULE) : out.replace(/^[ \t]*\/\/ __SERVEWEB_[A-Z_]+__\n/gm, "");
278
331
  }
279
332
  if (rel === "README.md") {
280
333
  out = applyDocBlock(out, "SWAGGER", options.swagger);
@@ -288,7 +341,9 @@ var template_default = defineTemplate({
288
341
  const deps = { ...pkg.dependencies };
289
342
  if (options.swagger) deps["@nestjs/swagger"] = "^11";
290
343
  if (options.serveWeb) deps["@nestjs/serve-static"] = "^5";
291
- pkg.dependencies = Object.fromEntries(Object.entries(deps).sort(([a], [b]) => a.localeCompare(b)));
344
+ pkg.dependencies = Object.fromEntries(
345
+ Object.entries(deps).sort(([a], [b]) => a.localeCompare(b))
346
+ );
292
347
  });
293
348
  }
294
349
  if (!options.docker) {
@@ -303,7 +358,9 @@ var template_default = defineTemplate({
303
358
  `cd into the project and run \`vp run -r dev\` to start web + api together.`,
304
359
  `The web app proxies \`/api\` to the NestJS server on port ${options.apiPort}.`,
305
360
  ...options.swagger ? [`Swagger UI: http://localhost:${options.apiPort}/docs (OpenAPI JSON at /docs.json).`] : [],
306
- ...options.serveWeb ? [`--serveWeb is on: after \`vp run -r build\`, \`node apps/api/dist/main.js\` serves the web app from the api.`] : [],
361
+ ...options.serveWeb ? [
362
+ `--serveWeb is on: after \`vp run -r build\`, \`node apps/api/dist/main.js\` serves the web app from the api.`
363
+ ] : [],
307
364
  options.install ? `Run \`vp check\` to lint, format and type-check the whole workspace.` : `Skipped install. Run \`vp install\`, then \`vp run -r dev\`.`
308
365
  ]
309
366
  };
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@pauldvlp/vp-react-ts-nestjs",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "Vite+ monorepo template: a React web app + a NestJS api (conformed to the Vite+ toolchain) sharing Zod contracts.",
5
- "author": "pauldvlp (https://github.com/pauldvlp/vp-templates)",
5
+ "author": "Paul Barahona <johanpaulbarahona@gmail.com> (https://github.com/pauldvlp/vp-templates)",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/pauldvlp/vp-templates",
8
8
  "repository": {
@@ -37,7 +37,8 @@
37
37
  },
38
38
  "scripts": {
39
39
  "build": "esbuild bin/index.ts --bundle --outfile=dist/index.js --format=esm --platform=node --target=node22 --packages=external",
40
- "dev": "node bin/index.ts"
40
+ "dev": "node bin/index.ts",
41
+ "typecheck": "tsc --noEmit"
41
42
  },
42
43
  "bin": {
43
44
  "vp-react-ts-nestjs": "./dist/index.js"
@@ -17,7 +17,7 @@
17
17
  "devEngines": {
18
18
  "packageManager": {
19
19
  "name": "pnpm",
20
- "version": "11.9.0",
20
+ "version": "11.17.0",
21
21
  "onFail": "warn"
22
22
  }
23
23
  },