@depup/nestjs__cli 11.0.24-depup.7 → 12.0.0-depup.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 (220) hide show
  1. package/README.md +7 -15
  2. package/actions/abstract.action.d.ts +1 -2
  3. package/actions/abstract.action.js +1 -5
  4. package/actions/add.action.d.ts +3 -4
  5. package/actions/add.action.js +44 -53
  6. package/actions/build.action.d.ts +18 -11
  7. package/actions/build.action.js +172 -79
  8. package/actions/deploy.action.d.ts +6 -0
  9. package/actions/deploy.action.js +51 -0
  10. package/actions/generate.action.d.ts +3 -3
  11. package/actions/generate.action.js +61 -59
  12. package/actions/index.d.ts +9 -7
  13. package/actions/index.js +9 -23
  14. package/actions/info.action.d.ts +18 -28
  15. package/actions/info.action.js +80 -60
  16. package/actions/new.action.d.ts +3 -3
  17. package/actions/new.action.js +108 -104
  18. package/actions/start.action.d.ts +4 -7
  19. package/actions/start.action.js +40 -47
  20. package/actions/upgrade.action.d.ts +6 -0
  21. package/actions/upgrade.action.js +53 -0
  22. package/bin/nest.js +11 -10
  23. package/changes.json +9 -41
  24. package/commands/abstract.command.d.ts +3 -3
  25. package/commands/abstract.command.js +2 -5
  26. package/commands/add.command.d.ts +3 -3
  27. package/commands/add.command.js +17 -20
  28. package/commands/build.command.d.ts +3 -3
  29. package/commands/build.command.js +52 -56
  30. package/commands/command.input.js +1 -2
  31. package/commands/command.loader.d.ts +2 -2
  32. package/commands/command.loader.js +29 -22
  33. package/commands/context/add.context.d.ts +7 -0
  34. package/commands/context/add.context.js +1 -0
  35. package/commands/context/build.context.d.ts +17 -0
  36. package/commands/context/build.context.js +1 -0
  37. package/commands/context/deploy.context.d.ts +7 -0
  38. package/commands/context/deploy.context.js +1 -0
  39. package/commands/context/generate.context.d.ts +18 -0
  40. package/commands/context/generate.context.js +1 -0
  41. package/commands/context/index.d.ts +7 -0
  42. package/commands/context/index.js +7 -0
  43. package/commands/context/new.context.d.ts +19 -0
  44. package/commands/context/new.context.js +1 -0
  45. package/commands/context/start.context.d.ts +22 -0
  46. package/commands/context/start.context.js +1 -0
  47. package/commands/context/upgrade.context.d.ts +11 -0
  48. package/commands/context/upgrade.context.js +1 -0
  49. package/commands/deploy.command.d.ts +5 -0
  50. package/commands/deploy.command.js +22 -0
  51. package/commands/generate.command.d.ts +3 -3
  52. package/commands/generate.command.js +35 -66
  53. package/commands/index.d.ts +3 -2
  54. package/commands/index.js +3 -18
  55. package/commands/info.command.d.ts +3 -3
  56. package/commands/info.command.js +4 -8
  57. package/commands/new.command.d.ts +3 -3
  58. package/commands/new.command.js +34 -36
  59. package/commands/start.command.d.ts +3 -3
  60. package/commands/start.command.js +48 -73
  61. package/commands/upgrade.command.d.ts +5 -0
  62. package/commands/upgrade.command.js +32 -0
  63. package/lib/compiler/assets-manager.d.ts +20 -8
  64. package/lib/compiler/assets-manager.js +199 -63
  65. package/lib/compiler/base-compiler.d.ts +5 -5
  66. package/lib/compiler/base-compiler.js +10 -13
  67. package/lib/compiler/compiler.d.ts +6 -6
  68. package/lib/compiler/compiler.js +7 -9
  69. package/lib/compiler/defaults/rspack-defaults.d.ts +3 -0
  70. package/lib/compiler/defaults/rspack-defaults.js +179 -0
  71. package/lib/compiler/defaults/swc-defaults.d.ts +5 -2
  72. package/lib/compiler/defaults/swc-defaults.js +22 -6
  73. package/lib/compiler/defaults/webpack-defaults.d.ts +2 -2
  74. package/lib/compiler/defaults/webpack-defaults.js +59 -19
  75. package/lib/compiler/helpers/append-extension.js +3 -6
  76. package/lib/compiler/helpers/copy-path-resolve.js +2 -5
  77. package/lib/compiler/helpers/delete-out-dir.d.ts +1 -1
  78. package/lib/compiler/helpers/delete-out-dir.js +45 -10
  79. package/lib/compiler/helpers/get-builder.d.ts +9 -7
  80. package/lib/compiler/helpers/get-builder.js +3 -6
  81. package/lib/compiler/helpers/get-effective-root-dir.d.ts +16 -0
  82. package/lib/compiler/helpers/get-effective-root-dir.js +56 -0
  83. package/lib/compiler/helpers/get-rspack-config-path.d.ts +10 -0
  84. package/lib/compiler/helpers/get-rspack-config-path.js +19 -0
  85. package/lib/compiler/helpers/get-tsc-config.path.d.ts +2 -3
  86. package/lib/compiler/helpers/get-tsc-config.path.js +6 -9
  87. package/lib/compiler/helpers/get-value-or-default.d.ts +2 -3
  88. package/lib/compiler/helpers/get-value-or-default.js +3 -8
  89. package/lib/compiler/helpers/get-webpack-config-path.d.ts +2 -3
  90. package/lib/compiler/helpers/get-webpack-config-path.js +4 -7
  91. package/lib/compiler/helpers/glob.d.ts +19 -0
  92. package/lib/compiler/helpers/glob.js +185 -0
  93. package/lib/compiler/helpers/manual-restart.js +4 -8
  94. package/lib/compiler/helpers/path-confinement.d.ts +33 -0
  95. package/lib/compiler/helpers/path-confinement.js +63 -0
  96. package/lib/compiler/helpers/tsconfig-provider.d.ts +7 -6
  97. package/lib/compiler/helpers/tsconfig-provider.js +32 -13
  98. package/lib/compiler/hooks/tsconfig-paths.hook.js +13 -13
  99. package/lib/compiler/interfaces/readonly-visitor.interface.js +1 -2
  100. package/lib/compiler/plugins/plugin-metadata-generator.d.ts +37 -1
  101. package/lib/compiler/plugins/plugin-metadata-generator.js +113 -13
  102. package/lib/compiler/plugins/plugin-metadata-printer.d.ts +1 -1
  103. package/lib/compiler/plugins/plugin-metadata-printer.js +5 -9
  104. package/lib/compiler/plugins/plugins-loader.d.ts +2 -2
  105. package/lib/compiler/plugins/plugins-loader.js +12 -12
  106. package/lib/compiler/rspack-compiler.d.ts +21 -0
  107. package/lib/compiler/rspack-compiler.js +111 -0
  108. package/lib/compiler/swc/constants.d.ts +0 -1
  109. package/lib/compiler/swc/constants.js +9 -13
  110. package/lib/compiler/swc/forked-type-checker.js +13 -18
  111. package/lib/compiler/swc/swc-compiler.d.ts +13 -6
  112. package/lib/compiler/swc/swc-compiler.js +116 -70
  113. package/lib/compiler/swc/type-checker-host.js +31 -24
  114. package/lib/compiler/typescript-loader.js +7 -9
  115. package/lib/compiler/watch-compiler.d.ts +5 -5
  116. package/lib/compiler/watch-compiler.js +13 -15
  117. package/lib/compiler/watchers/recursive-directory-watcher.d.ts +37 -0
  118. package/lib/compiler/watchers/recursive-directory-watcher.js +334 -0
  119. package/lib/compiler/webpack-compiler.d.ts +6 -7
  120. package/lib/compiler/webpack-compiler.js +46 -23
  121. package/lib/configuration/configuration.d.ts +16 -3
  122. package/lib/configuration/configuration.js +1 -2
  123. package/lib/configuration/configuration.loader.d.ts +1 -1
  124. package/lib/configuration/configuration.loader.js +1 -2
  125. package/lib/configuration/defaults.d.ts +2 -1
  126. package/lib/configuration/defaults.js +8 -10
  127. package/lib/configuration/index.d.ts +3 -3
  128. package/lib/configuration/index.js +3 -19
  129. package/lib/configuration/nest-configuration.loader.d.ts +3 -3
  130. package/lib/configuration/nest-configuration.loader.js +28 -29
  131. package/lib/package-managers/abstract.package-manager.d.ts +4 -4
  132. package/lib/package-managers/abstract.package-manager.js +21 -32
  133. package/lib/package-managers/bun.package-manager.d.ts +7 -0
  134. package/lib/package-managers/bun.package-manager.js +22 -0
  135. package/lib/package-managers/index.d.ts +9 -8
  136. package/lib/package-managers/index.js +9 -24
  137. package/lib/package-managers/npm.package-manager.d.ts +2 -2
  138. package/lib/package-managers/npm.package-manager.js +6 -10
  139. package/lib/package-managers/package-manager-commands.js +1 -2
  140. package/lib/package-managers/package-manager.d.ts +2 -1
  141. package/lib/package-managers/package-manager.factory.d.ts +2 -2
  142. package/lib/package-managers/package-manager.factory.js +23 -20
  143. package/lib/package-managers/package-manager.js +3 -5
  144. package/lib/package-managers/pnpm.package-manager.d.ts +2 -2
  145. package/lib/package-managers/pnpm.package-manager.js +6 -10
  146. package/lib/package-managers/project.dependency.js +1 -2
  147. package/lib/package-managers/yarn.package-manager.d.ts +2 -2
  148. package/lib/package-managers/yarn.package-manager.js +6 -10
  149. package/lib/questions/questions.d.ts +5 -1
  150. package/lib/questions/questions.js +2 -7
  151. package/lib/readers/file-system.reader.d.ts +1 -1
  152. package/lib/readers/file-system.reader.js +6 -9
  153. package/lib/readers/index.d.ts +2 -2
  154. package/lib/readers/index.js +2 -18
  155. package/lib/readers/reader.js +3 -5
  156. package/lib/runners/abstract.runner.js +40 -21
  157. package/lib/runners/bun.runner.d.ts +4 -0
  158. package/lib/runners/bun.runner.js +6 -0
  159. package/lib/runners/git.runner.d.ts +1 -1
  160. package/lib/runners/git.runner.js +2 -6
  161. package/lib/runners/index.d.ts +3 -3
  162. package/lib/runners/index.js +3 -19
  163. package/lib/runners/mau.runner.d.ts +8 -0
  164. package/lib/runners/mau.runner.js +10 -0
  165. package/lib/runners/npm.runner.d.ts +1 -1
  166. package/lib/runners/npm.runner.js +2 -6
  167. package/lib/runners/pnpm.runner.d.ts +1 -1
  168. package/lib/runners/pnpm.runner.js +2 -6
  169. package/lib/runners/runner.d.ts +2 -1
  170. package/lib/runners/runner.factory.d.ts +7 -6
  171. package/lib/runners/runner.factory.js +18 -20
  172. package/lib/runners/runner.js +3 -5
  173. package/lib/runners/schematic.runner.d.ts +1 -1
  174. package/lib/runners/schematic.runner.js +5 -7
  175. package/lib/runners/yarn.runner.d.ts +1 -1
  176. package/lib/runners/yarn.runner.js +2 -6
  177. package/lib/schematics/abstract.collection.d.ts +3 -3
  178. package/lib/schematics/abstract.collection.js +3 -5
  179. package/lib/schematics/collection.factory.d.ts +2 -2
  180. package/lib/schematics/collection.factory.js +9 -13
  181. package/lib/schematics/collection.js +2 -5
  182. package/lib/schematics/custom.collection.d.ts +2 -2
  183. package/lib/schematics/custom.collection.js +4 -8
  184. package/lib/schematics/index.d.ts +4 -4
  185. package/lib/schematics/index.js +4 -20
  186. package/lib/schematics/nest.collection.d.ts +3 -3
  187. package/lib/schematics/nest.collection.js +113 -109
  188. package/lib/schematics/schematic.option.js +10 -9
  189. package/lib/ui/banner.js +1 -4
  190. package/lib/ui/emojis.d.ts +17 -17
  191. package/lib/ui/emojis.js +19 -22
  192. package/lib/ui/errors.js +1 -4
  193. package/lib/ui/index.d.ts +5 -5
  194. package/lib/ui/index.js +5 -21
  195. package/lib/ui/messages.d.ts +8 -0
  196. package/lib/ui/messages.js +23 -18
  197. package/lib/ui/prefixes.js +3 -6
  198. package/lib/utils/extra-args-warning.js +3 -6
  199. package/lib/utils/formatting.js +1 -4
  200. package/lib/utils/get-default-tsconfig-path.js +4 -7
  201. package/lib/utils/gracefully-exit-on-prompt-error.js +1 -4
  202. package/lib/utils/is-esm-project.d.ts +5 -0
  203. package/lib/utils/is-esm-project.js +16 -0
  204. package/lib/utils/is-interactive.d.ts +8 -0
  205. package/lib/utils/is-interactive.js +10 -0
  206. package/lib/utils/is-module-available.js +3 -4
  207. package/lib/utils/load-configuration.d.ts +1 -1
  208. package/lib/utils/load-configuration.js +4 -7
  209. package/lib/utils/local-binaries.d.ts +2 -2
  210. package/lib/utils/local-binaries.js +8 -11
  211. package/lib/utils/mau.d.ts +14 -0
  212. package/lib/utils/mau.js +46 -0
  213. package/lib/utils/os-info.utils.js +1 -4
  214. package/lib/utils/project-utils.d.ts +1 -3
  215. package/lib/utils/project-utils.js +16 -28
  216. package/lib/utils/remaining-flags.d.ts +2 -2
  217. package/lib/utils/remaining-flags.js +13 -8
  218. package/lib/utils/tree-kill.js +7 -10
  219. package/lib/utils/type-assertions.js +1 -4
  220. package/package.json +70 -83
@@ -1,5 +1,5 @@
1
- import { CommanderStatic } from 'commander';
2
- import { AbstractCommand } from './abstract.command';
1
+ import { Command } from 'commander';
2
+ import { AbstractCommand } from './abstract.command.js';
3
3
  export declare class InfoCommand extends AbstractCommand {
4
- load(program: CommanderStatic): void;
4
+ load(program: Command): void;
5
5
  }
@@ -1,18 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InfoCommand = void 0;
4
- const extra_args_warning_1 = require("../lib/utils/extra-args-warning");
5
- const abstract_command_1 = require("./abstract.command");
6
- class InfoCommand extends abstract_command_1.AbstractCommand {
1
+ import { exitIfExtraArgs } from '../lib/utils/extra-args-warning.js';
2
+ import { AbstractCommand } from './abstract.command.js';
3
+ export class InfoCommand extends AbstractCommand {
7
4
  load(program) {
8
5
  program
9
6
  .command('info')
10
7
  .alias('i')
11
8
  .description('Display Nest project details.')
12
9
  .action(async (command) => {
13
- (0, extra_args_warning_1.exitIfExtraArgs)(command, 0);
10
+ exitIfExtraArgs(command, 0);
14
11
  await this.action.handle();
15
12
  });
16
13
  }
17
14
  }
18
- exports.InfoCommand = InfoCommand;
@@ -1,5 +1,5 @@
1
- import { CommanderStatic } from 'commander';
2
- import { AbstractCommand } from './abstract.command';
1
+ import { Command } from 'commander';
2
+ import { AbstractCommand } from './abstract.command.js';
3
3
  export declare class NewCommand extends AbstractCommand {
4
- load(program: CommanderStatic): void;
4
+ load(program: Command): void;
5
5
  }
@@ -1,10 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NewCommand = void 0;
4
- const schematics_1 = require("../lib/schematics");
5
- const extra_args_warning_1 = require("../lib/utils/extra-args-warning");
6
- const abstract_command_1 = require("./abstract.command");
7
- class NewCommand extends abstract_command_1.AbstractCommand {
1
+ import { Collection } from '../lib/schematics/index.js';
2
+ import { AbstractCommand } from './abstract.command.js';
3
+ export class NewCommand extends AbstractCommand {
8
4
  load(program) {
9
5
  program
10
6
  .command('new [name]')
@@ -16,48 +12,50 @@ class NewCommand extends abstract_command_1.AbstractCommand {
16
12
  .option('-s, --skip-install', 'Skip package installation.', false)
17
13
  .option('-p, --package-manager [packageManager]', 'Specify package manager.')
18
14
  .option('-l, --language [language]', 'Programming language to be used (TypeScript or JavaScript)', 'TypeScript')
19
- .option('-c, --collection [collectionName]', 'Schematics collection to use', schematics_1.Collection.NESTJS)
20
- .option('--strict', 'Enables strict mode in TypeScript.', false)
21
- .action(async (name, command) => {
22
- (0, extra_args_warning_1.exitIfExtraArgs)(command, 1);
23
- const options = [];
24
- options.push({ name: 'directory', value: command.directory });
25
- options.push({ name: 'dry-run', value: command.dryRun });
26
- options.push({ name: 'skip-git', value: command.skipGit });
27
- options.push({ name: 'skip-install', value: command.skipInstall });
28
- options.push({ name: 'strict', value: command.strict });
29
- options.push({
30
- name: 'packageManager',
31
- value: command.packageManager,
32
- });
33
- options.push({ name: 'collection', value: command.collection });
15
+ .option('-c, --collection [collectionName]', 'Schematics collection to use', Collection.NESTJS)
16
+ .option('--strict', 'Enables strict mode in TypeScript.', true)
17
+ .option('-t, --skip-tests', 'Do not generate testing files for the new project.', false)
18
+ .option('--format', 'Format generated files using Prettier.', false)
19
+ .option('--observe', 'Auto-configure observability with @nestjs/observe.')
20
+ .option('--no-observe', 'Skip observability setup without being prompted for it.')
21
+ .action(async (name, options) => {
34
22
  const availableLanguages = ['js', 'ts', 'javascript', 'typescript'];
35
- if (!!command.language) {
36
- const lowercasedLanguage = command.language.toLowerCase();
23
+ let language = options.language;
24
+ if (language) {
25
+ const lowercasedLanguage = language.toLowerCase();
37
26
  const langMatch = availableLanguages.includes(lowercasedLanguage);
38
27
  if (!langMatch) {
39
- throw new Error(`Invalid language "${command.language}" selected. Available languages are "typescript" or "javascript"`);
28
+ throw new Error(`Invalid language "${language}" selected. Available languages are "typescript" or "javascript"`);
40
29
  }
41
30
  switch (lowercasedLanguage) {
42
31
  case 'javascript':
43
- command.language = 'js';
32
+ language = 'js';
44
33
  break;
45
34
  case 'typescript':
46
- command.language = 'ts';
35
+ language = 'ts';
47
36
  break;
48
37
  default:
49
- command.language = lowercasedLanguage;
38
+ language = lowercasedLanguage;
50
39
  break;
51
40
  }
52
41
  }
53
- options.push({
54
- name: 'language',
55
- value: command.language,
56
- });
57
- const inputs = [];
58
- inputs.push({ name: 'name', value: name });
59
- await this.action.handle(inputs, options);
42
+ const context = {
43
+ name,
44
+ directory: options.directory,
45
+ dryRun: options.dryRun,
46
+ skipGit: options.skipGit,
47
+ skipInstall: options.skipInstall,
48
+ skipTests: options.skipTests,
49
+ packageManager: options.packageManager,
50
+ language,
51
+ collection: options.collection,
52
+ strict: options.strict,
53
+ format: options.format === true,
54
+ // Stays undefined unless a flag was given, which is what tells the
55
+ // action to prompt instead of assuming an answer.
56
+ observe: options.observe,
57
+ };
58
+ await this.action.handle(context);
60
59
  });
61
60
  }
62
61
  }
63
- exports.NewCommand = NewCommand;
@@ -1,5 +1,5 @@
1
- import { CommanderStatic } from 'commander';
2
- import { AbstractCommand } from './abstract.command';
1
+ import { Command } from 'commander';
2
+ import { AbstractCommand } from './abstract.command.js';
3
3
  export declare class StartCommand extends AbstractCommand {
4
- load(program: CommanderStatic): void;
4
+ load(program: Command): void;
5
5
  }
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StartCommand = void 0;
4
- const ui_1 = require("../lib/ui");
5
- const remaining_flags_1 = require("../lib/utils/remaining-flags");
6
- const abstract_command_1 = require("./abstract.command");
7
- class StartCommand extends abstract_command_1.AbstractCommand {
1
+ import { ERROR_PREFIX } from '../lib/ui/index.js';
2
+ import { getRemainingFlags } from '../lib/utils/remaining-flags.js';
3
+ import { AbstractCommand } from './abstract.command.js';
4
+ export class StartCommand extends AbstractCommand {
8
5
  load(program) {
9
6
  const collect = (value, previous) => {
10
7
  return previous.concat([value]);
@@ -12,15 +9,22 @@ class StartCommand extends abstract_command_1.AbstractCommand {
12
9
  program
13
10
  .command('start [app]')
14
11
  .allowUnknownOption()
12
+ // Unknown options are collected into `args`, which commander otherwise
13
+ // rejects as excess arguments once an app name is also present.
14
+ .allowExcessArguments()
15
15
  .option('-c, --config [path]', 'Path to nest-cli configuration file.')
16
16
  .option('-p, --path [path]', 'Path to tsconfig file.')
17
17
  .option('-w, --watch', 'Run in watch mode (live-reload).')
18
- .option('-b, --builder [name]', 'Builder to be used (tsc, webpack, swc).')
18
+ .option('-b, --builder [name]', 'Builder to be used (tsc, webpack, swc, rspack).')
19
19
  .option('--watchAssets', 'Watch non-ts (e.g., .graphql) files mode.')
20
20
  .option('-d, --debug [hostport] ', 'Run in debug mode (with --inspect flag).')
21
21
  .option('--webpack', 'Use webpack for compilation (deprecated option, use --builder instead).')
22
22
  .option('--webpackPath [path]', 'Path to webpack configuration.')
23
- .option('--type-check', 'Enable type checking (when SWC is used).')
23
+ .option('--rspackPath [path]', 'Path to rspack configuration.')
24
+ .option('--type-check', 'Enable type checking (when SWC is used).', () => true)
25
+ .option('--no-type-check', 'Disable type checking (when SWC is used).', () => false)
26
+ .option('--emit-declarations', 'Emit declaration files (.d.ts) when using SWC builder.')
27
+ .option('--silent', 'Suppress informational compiler logs.')
24
28
  .option('--tsc', 'Use typescript compiler for compilation.')
25
29
  .option('--sourceRoot [sourceRoot]', 'Points at the root of the source code for the single project in standard mode structures, or the default project in monorepo mode structures.')
26
30
  .option('--entryFile [entryFile]', "Path to the entry file where this command will work with. Defaults to the one defined at your Nest's CLI config file.")
@@ -30,75 +34,46 @@ class StartCommand extends abstract_command_1.AbstractCommand {
30
34
  .option('--no-shell', 'Do not spawn child processes within a shell.')
31
35
  .option('--env-file [path]', 'Path to an env file (.env) to be loaded into the environment.', collect, [])
32
36
  .description('Run Nest application.')
33
- .action(async (app, command) => {
34
- const options = [];
35
- options.push({
36
- name: 'config',
37
- value: command.config,
38
- });
39
- const isWebpackEnabled = command.tsc ? false : command.webpack;
40
- options.push({ name: 'webpack', value: isWebpackEnabled });
41
- options.push({ name: 'debug', value: command.debug });
42
- options.push({ name: 'watch', value: !!command.watch });
43
- options.push({ name: 'watchAssets', value: !!command.watchAssets });
44
- options.push({
45
- name: 'path',
46
- value: command.path,
47
- });
48
- options.push({
49
- name: 'webpackPath',
50
- value: command.webpackPath,
51
- });
52
- options.push({
53
- name: 'exec',
54
- value: command.exec,
55
- });
56
- options.push({
57
- name: 'sourceRoot',
58
- value: command.sourceRoot,
59
- });
60
- options.push({
61
- name: 'entryFile',
62
- value: command.entryFile,
63
- });
64
- options.push({
65
- name: 'preserveWatchOutput',
66
- value: !!command.preserveWatchOutput &&
67
- !!command.watch &&
68
- !isWebpackEnabled,
69
- });
70
- options.push({
71
- name: 'shell',
72
- value: !!command.shell,
73
- });
74
- options.push({
75
- name: 'envFile',
76
- value: command.envFile,
77
- });
78
- const availableBuilders = ['tsc', 'webpack', 'swc'];
79
- if (command.builder && !availableBuilders.includes(command.builder)) {
80
- console.error(ui_1.ERROR_PREFIX +
81
- ` Invalid builder option: ${command.builder}. Available builders: ${availableBuilders.join(', ')}`);
82
- return;
37
+ .action(async (app, options) => {
38
+ const isWebpackEnabled = options.tsc ? false : options.webpack;
39
+ const availableBuilders = ['tsc', 'webpack', 'swc', 'rspack'];
40
+ if (options.builder && !availableBuilders.includes(options.builder)) {
41
+ console.error(ERROR_PREFIX +
42
+ ` Invalid builder option: ${options.builder}. Available builders: ${availableBuilders.join(', ')}`);
43
+ process.exit(1);
83
44
  }
84
- options.push({
85
- name: 'builder',
86
- value: command.builder,
87
- });
88
- options.push({
89
- name: 'typeCheck',
90
- value: command.typeCheck,
91
- });
92
- const inputs = [];
93
- inputs.push({ name: 'app', value: app });
94
- const flags = (0, remaining_flags_1.getRemainingFlags)(program);
45
+ const context = {
46
+ app,
47
+ config: options.config,
48
+ webpack: isWebpackEnabled,
49
+ watch: !!options.watch,
50
+ watchAssets: !!options.watchAssets,
51
+ path: options.path,
52
+ webpackPath: options.webpackPath,
53
+ rspackPath: options.rspackPath,
54
+ builder: options.builder,
55
+ typeCheck: options.typeCheck,
56
+ // Left undefined when the flag is absent so `getValueOrDefault` can
57
+ // still fall through to `compilerOptions.emitDeclarations`.
58
+ emitDeclarations: options.emitDeclarations,
59
+ silent: !!options.silent,
60
+ preserveWatchOutput: !!options.preserveWatchOutput &&
61
+ !!options.watch &&
62
+ !isWebpackEnabled,
63
+ debug: options.debug,
64
+ exec: options.exec,
65
+ sourceRoot: options.sourceRoot,
66
+ entryFile: options.entryFile,
67
+ shell: !!options.shell,
68
+ envFile: options.envFile ?? [],
69
+ extraFlags: getRemainingFlags(program),
70
+ };
95
71
  try {
96
- await this.action.handle(inputs, options, flags);
72
+ await this.action.handle(context);
97
73
  }
98
- catch (err) {
74
+ catch {
99
75
  process.exit(1);
100
76
  }
101
77
  });
102
78
  }
103
79
  }
104
- exports.StartCommand = StartCommand;
@@ -0,0 +1,5 @@
1
+ import { Command } from 'commander';
2
+ import { AbstractCommand } from './abstract.command.js';
3
+ export declare class UpgradeCommand extends AbstractCommand {
4
+ load(program: Command): void;
5
+ }
@@ -0,0 +1,32 @@
1
+ import { AbstractCommand } from './abstract.command.js';
2
+ export class UpgradeCommand extends AbstractCommand {
3
+ load(program) {
4
+ program
5
+ .command('upgrade')
6
+ .alias('update')
7
+ .description('Upgrade your project to the latest NestJS major version.')
8
+ .option('-d, --dry-run', 'Report actions that would be performed without writing out results.')
9
+ .option('-s, --skip-install', 'Skip package installation.', false)
10
+ .option('--observe', 'Set up @nestjs/observe (skips the prompt).')
11
+ .option('--no-observe', 'Do not set up @nestjs/observe (skips the prompt).')
12
+ .option('-t, --tag [tag]', 'Use an npm dist-tag (e.g. "next") instead of the default version ranges.')
13
+ .option('-c, --collection [collectionName]', 'Schematics collection to use.')
14
+ .action(async (options) => {
15
+ const context = {
16
+ dryRun: !!options.dryRun,
17
+ skipInstall: options.skipInstall,
18
+ // Stays `undefined` when neither --observe nor --no-observe was
19
+ // given so the schematic can prompt for it.
20
+ observe: options.observe,
21
+ tag: options.tag,
22
+ collection: options.collection,
23
+ };
24
+ try {
25
+ await this.action.handle(context);
26
+ }
27
+ catch {
28
+ process.exit(1);
29
+ }
30
+ });
31
+ }
32
+ }
@@ -1,15 +1,27 @@
1
- import { Configuration } from '../configuration';
1
+ import { Configuration } from '../configuration/index.js';
2
2
  export declare class AssetsManager {
3
3
  private watchAssetsKeyValue;
4
4
  private watchers;
5
- private actionInProgress;
5
+ private watcherReadyPromises;
6
6
  /**
7
- * Using on `nest build` to close file watch or the build process will not end
8
- * Interval like process
9
- * If no action has been taken recently close watchers
10
- * If action has been taken recently flag and try again
7
+ * Using on `nest build` to close file watch or the build process will not end.
8
+ * Waits for all watchers to complete their initial scan before closing them,
9
+ * ensuring all assets are copied regardless of system speed.
10
+ *
11
+ * Returns a Promise that resolves once every watcher has been closed.
12
+ * Callers (e.g. `build.action.ts`, `swc-compiler.ts`) `await` this method,
13
+ * so it must surface the underlying close work — otherwise `await` resolves
14
+ * immediately while file watchers stay open and the build process can race
15
+ * its own exit, leaving handles dangling.
11
16
  */
12
- closeWatchers(): void;
13
- copyAssets(configuration: Required<Configuration>, appName: string | undefined, outDir: string, watchAssetsMode: boolean): void;
17
+ closeWatchers(): Promise<void>;
18
+ copyAssets(configuration: Required<Configuration>, appName: string | undefined, outDir: string, watchAssetsMode: boolean, onSuccess?: () => void, rootDir?: string): void;
19
+ private collectLibraryAssets;
20
+ /**
21
+ * Runs `actionOnFile` from a watcher callback. A rejected destination must not
22
+ * escalate into an uncaught exception: chokidar emits synchronously, so a
23
+ * throw here would tear down the whole watch session.
24
+ */
25
+ private safeActionOnFile;
14
26
  private actionOnFile;
15
27
  }