@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,8 +1,113 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NestCollection = void 0;
4
- const abstract_collection_1 = require("./abstract.collection");
5
- class NestCollection extends abstract_collection_1.AbstractCollection {
1
+ import { AbstractCollection } from './abstract.collection.js';
2
+ export class NestCollection extends AbstractCollection {
3
+ static schematics = [
4
+ {
5
+ name: 'application',
6
+ alias: 'application',
7
+ description: 'Generate a new application workspace',
8
+ },
9
+ {
10
+ name: 'angular-app',
11
+ alias: 'ng-app',
12
+ description: '',
13
+ },
14
+ {
15
+ name: 'class',
16
+ alias: 'cl',
17
+ description: 'Generate a new class',
18
+ },
19
+ {
20
+ name: 'configuration',
21
+ alias: 'config',
22
+ description: 'Generate a CLI configuration file',
23
+ },
24
+ {
25
+ name: 'controller',
26
+ alias: 'co',
27
+ description: 'Generate a controller declaration',
28
+ },
29
+ {
30
+ name: 'decorator',
31
+ alias: 'd',
32
+ description: 'Generate a custom decorator',
33
+ },
34
+ {
35
+ name: 'filter',
36
+ alias: 'f',
37
+ description: 'Generate a filter declaration',
38
+ },
39
+ {
40
+ name: 'gateway',
41
+ alias: 'ga',
42
+ description: 'Generate a gateway declaration',
43
+ },
44
+ {
45
+ name: 'guard',
46
+ alias: 'gu',
47
+ description: 'Generate a guard declaration',
48
+ },
49
+ {
50
+ name: 'interceptor',
51
+ alias: 'itc',
52
+ description: 'Generate an interceptor declaration',
53
+ },
54
+ {
55
+ name: 'interface',
56
+ alias: 'itf',
57
+ description: 'Generate an interface',
58
+ },
59
+ {
60
+ name: 'library',
61
+ alias: 'lib',
62
+ description: 'Generate a new library within a monorepo',
63
+ },
64
+ {
65
+ name: 'middleware',
66
+ alias: 'mi',
67
+ description: 'Generate a middleware declaration',
68
+ },
69
+ {
70
+ name: 'module',
71
+ alias: 'mo',
72
+ description: 'Generate a module declaration',
73
+ },
74
+ {
75
+ name: 'pipe',
76
+ alias: 'pi',
77
+ description: 'Generate a pipe declaration',
78
+ },
79
+ {
80
+ name: 'provider',
81
+ alias: 'pr',
82
+ description: 'Generate a provider declaration',
83
+ },
84
+ {
85
+ name: 'resolver',
86
+ alias: 'r',
87
+ description: 'Generate a GraphQL resolver declaration',
88
+ },
89
+ {
90
+ name: 'resource',
91
+ alias: 'res',
92
+ description: 'Generate a new CRUD resource',
93
+ },
94
+ {
95
+ name: 'service',
96
+ alias: 's',
97
+ description: 'Generate a service declaration',
98
+ },
99
+ {
100
+ name: 'sub-app',
101
+ alias: 'app',
102
+ description: 'Generate a new application within a monorepo',
103
+ },
104
+ // Invoked by "nest update", not "nest generate" - see getSchematics().
105
+ {
106
+ name: 'upgrade',
107
+ alias: 'upgrade',
108
+ description: 'Upgrade the project to the latest NestJS version',
109
+ },
110
+ ];
6
111
  constructor(runner) {
7
112
  super('@nestjs/schematics', runner);
8
113
  }
@@ -11,7 +116,9 @@ class NestCollection extends abstract_collection_1.AbstractCollection {
11
116
  await super.execute(schematic, options);
12
117
  }
13
118
  getSchematics() {
14
- return NestCollection.schematics.filter((item) => item.name !== 'angular-app');
119
+ // "upgrade" is executed through "nest update"; it is not offered as a
120
+ // "nest generate" schematic.
121
+ return NestCollection.schematics.filter((item) => item.name !== 'angular-app' && item.name !== 'upgrade');
15
122
  }
16
123
  validate(name) {
17
124
  const schematic = NestCollection.schematics.find((s) => s.name === name || s.alias === name);
@@ -21,106 +128,3 @@ class NestCollection extends abstract_collection_1.AbstractCollection {
21
128
  return schematic.name;
22
129
  }
23
130
  }
24
- exports.NestCollection = NestCollection;
25
- NestCollection.schematics = [
26
- {
27
- name: 'application',
28
- alias: 'application',
29
- description: 'Generate a new application workspace',
30
- },
31
- {
32
- name: 'angular-app',
33
- alias: 'ng-app',
34
- description: '',
35
- },
36
- {
37
- name: 'class',
38
- alias: 'cl',
39
- description: 'Generate a new class',
40
- },
41
- {
42
- name: 'configuration',
43
- alias: 'config',
44
- description: 'Generate a CLI configuration file',
45
- },
46
- {
47
- name: 'controller',
48
- alias: 'co',
49
- description: 'Generate a controller declaration',
50
- },
51
- {
52
- name: 'decorator',
53
- alias: 'd',
54
- description: 'Generate a custom decorator',
55
- },
56
- {
57
- name: 'filter',
58
- alias: 'f',
59
- description: 'Generate a filter declaration',
60
- },
61
- {
62
- name: 'gateway',
63
- alias: 'ga',
64
- description: 'Generate a gateway declaration',
65
- },
66
- {
67
- name: 'guard',
68
- alias: 'gu',
69
- description: 'Generate a guard declaration',
70
- },
71
- {
72
- name: 'interceptor',
73
- alias: 'itc',
74
- description: 'Generate an interceptor declaration',
75
- },
76
- {
77
- name: 'interface',
78
- alias: 'itf',
79
- description: 'Generate an interface',
80
- },
81
- {
82
- name: 'library',
83
- alias: 'lib',
84
- description: 'Generate a new library within a monorepo',
85
- },
86
- {
87
- name: 'middleware',
88
- alias: 'mi',
89
- description: 'Generate a middleware declaration',
90
- },
91
- {
92
- name: 'module',
93
- alias: 'mo',
94
- description: 'Generate a module declaration',
95
- },
96
- {
97
- name: 'pipe',
98
- alias: 'pi',
99
- description: 'Generate a pipe declaration',
100
- },
101
- {
102
- name: 'provider',
103
- alias: 'pr',
104
- description: 'Generate a provider declaration',
105
- },
106
- {
107
- name: 'resolver',
108
- alias: 'r',
109
- description: 'Generate a GraphQL resolver declaration',
110
- },
111
- {
112
- name: 'resource',
113
- alias: 'res',
114
- description: 'Generate a new CRUD resource',
115
- },
116
- {
117
- name: 'service',
118
- alias: 's',
119
- description: 'Generate a service declaration',
120
- },
121
- {
122
- name: 'sub-app',
123
- alias: 'app',
124
- description: 'Generate a new application within a monorepo',
125
- },
126
- ];
@@ -1,14 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SchematicOption = void 0;
4
- const formatting_1 = require("../utils/formatting");
5
- class SchematicOption {
1
+ import { normalizeToKebabOrSnakeCase } from '../utils/formatting.js';
2
+ export class SchematicOption {
3
+ name;
4
+ value;
6
5
  constructor(name, value) {
7
6
  this.name = name;
8
7
  this.value = value;
9
8
  }
10
9
  get normalizedName() {
11
- return (0, formatting_1.normalizeToKebabOrSnakeCase)(this.name);
10
+ return normalizeToKebabOrSnakeCase(this.name);
12
11
  }
13
12
  toCommandString() {
14
13
  if (typeof this.value === 'string') {
@@ -24,14 +23,17 @@ class SchematicOption {
24
23
  }
25
24
  else if (typeof this.value === 'boolean') {
26
25
  const str = this.normalizedName;
27
- return this.value ? `--${str}` : `--no-${str}`;
26
+ // Must stay `=false` rather than `--no-<flag>`: schematics-cli parses
27
+ // with parseArgs under `allowNegative`, which turns `--no-x` into `x`
28
+ // with no value and then coerces it to true — inverting the option.
29
+ return this.value ? `--${str}` : `--${str}=false`;
28
30
  }
29
31
  else {
30
32
  return `--${this.normalizedName}=${this.value}`;
31
33
  }
32
34
  }
33
35
  format() {
34
- return (0, formatting_1.normalizeToKebabOrSnakeCase)(this.value)
36
+ return normalizeToKebabOrSnakeCase(this.value)
35
37
  .split('')
36
38
  .reduce((content, char) => {
37
39
  if (char === '(' || char === ')' || char === '[' || char === ']') {
@@ -41,4 +43,3 @@ class SchematicOption {
41
43
  }, '');
42
44
  }
43
45
  }
44
- exports.SchematicOption = SchematicOption;
package/lib/ui/banner.js CHANGED
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BANNER = void 0;
4
- exports.BANNER = `
1
+ export const BANNER = `
5
2
  _ _ _ ___ _____ _____ _ _____
6
3
  | \\ | | | | |_ |/ ___|/ __ \\| | |_ _|
7
4
  | \\| | ___ ___ | |_ | |\\ \`--. | / \\/| | | |
@@ -1,19 +1,19 @@
1
1
  export declare const EMOJIS: {
2
- HEART: string;
3
- COFFEE: string;
4
- BEER: string;
5
- BROKEN_HEART: string;
6
- CRYING: string;
7
- HEART_EYES: string;
8
- JOY: string;
9
- KISSING: string;
10
- SCREAM: string;
11
- ROCKET: string;
12
- SMIRK: string;
13
- RAISED_HANDS: string;
14
- POINT_RIGHT: string;
15
- SPARKLES: string;
16
- BOOM: string;
17
- PRAY: string;
18
- WINE: string;
2
+ HEART: string | undefined;
3
+ COFFEE: string | undefined;
4
+ BEER: string | undefined;
5
+ BROKEN_HEART: string | undefined;
6
+ CRYING: string | undefined;
7
+ HEART_EYES: string | undefined;
8
+ JOY: string | undefined;
9
+ KISSING: string | undefined;
10
+ SCREAM: string | undefined;
11
+ ROCKET: string | undefined;
12
+ SMIRK: string | undefined;
13
+ RAISED_HANDS: string | undefined;
14
+ POINT_RIGHT: string | undefined;
15
+ SPARKLES: string | undefined;
16
+ BOOM: string | undefined;
17
+ PRAY: string | undefined;
18
+ WINE: string | undefined;
19
19
  };
package/lib/ui/emojis.js CHANGED
@@ -1,23 +1,20 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EMOJIS = void 0;
4
- const node_emoji_1 = require("node-emoji");
5
- exports.EMOJIS = {
6
- HEART: (0, node_emoji_1.get)('heart'),
7
- COFFEE: (0, node_emoji_1.get)('coffee'),
8
- BEER: (0, node_emoji_1.get)('beer'),
9
- BROKEN_HEART: (0, node_emoji_1.get)('broken_heart'),
10
- CRYING: (0, node_emoji_1.get)('crying_cat_face'),
11
- HEART_EYES: (0, node_emoji_1.get)('heart_eyes_cat'),
12
- JOY: (0, node_emoji_1.get)('joy_cat'),
13
- KISSING: (0, node_emoji_1.get)('kissing_cat'),
14
- SCREAM: (0, node_emoji_1.get)('scream_cat'),
15
- ROCKET: (0, node_emoji_1.get)('rocket'),
16
- SMIRK: (0, node_emoji_1.get)('smirk_cat'),
17
- RAISED_HANDS: (0, node_emoji_1.get)('raised_hands'),
18
- POINT_RIGHT: (0, node_emoji_1.get)('point_right'),
19
- SPARKLES: (0, node_emoji_1.get)('sparkles'),
20
- BOOM: (0, node_emoji_1.get)('boom'),
21
- PRAY: (0, node_emoji_1.get)('pray'),
22
- WINE: (0, node_emoji_1.get)('wine_glass'),
1
+ import { get } from 'node-emoji';
2
+ export const EMOJIS = {
3
+ HEART: get('heart'),
4
+ COFFEE: get('coffee'),
5
+ BEER: get('beer'),
6
+ BROKEN_HEART: get('broken_heart'),
7
+ CRYING: get('crying_cat_face'),
8
+ HEART_EYES: get('heart_eyes_cat'),
9
+ JOY: get('joy_cat'),
10
+ KISSING: get('kissing_cat'),
11
+ SCREAM: get('scream_cat'),
12
+ ROCKET: get('rocket'),
13
+ SMIRK: get('smirk_cat'),
14
+ RAISED_HANDS: get('raised_hands'),
15
+ POINT_RIGHT: get('point_right'),
16
+ SPARKLES: get('sparkles'),
17
+ BOOM: get('boom'),
18
+ PRAY: get('pray'),
19
+ WINE: get('wine_glass'),
23
20
  };
package/lib/ui/errors.js CHANGED
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CLI_ERRORS = void 0;
4
- exports.CLI_ERRORS = {
1
+ export const CLI_ERRORS = {
5
2
  MISSING_TYPESCRIPT: (path) => `Could not find TypeScript configuration file "${path}". Please, ensure that you are running this command in the appropriate directory (inside Nest workspace).`,
6
3
  WRONG_PLUGIN: (name) => `The "${name}" plugin is not compatible with Nest CLI. Neither "after()" nor "before()" nor "afterDeclarations()" function have been provided.`,
7
4
  UNSUPPORTED_TYPESCRIPT_VERSION: (version) => `The installed TypeScript version (${version}) does not expose the programmatic compiler API that the Nest CLI requires. TypeScript 7.0 ships the "tsc" executable only; the compiler API is expected to return in 7.1. Please install TypeScript 6 (e.g. "npm i -D typescript@^6") until then.`,
package/lib/ui/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export * from './banner';
2
- export * from './emojis';
3
- export * from './errors';
4
- export * from './messages';
5
- export * from './prefixes';
1
+ export * from './banner.js';
2
+ export * from './emojis.js';
3
+ export * from './errors.js';
4
+ export * from './messages.js';
5
+ export * from './prefixes.js';
package/lib/ui/index.js CHANGED
@@ -1,21 +1,5 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./banner"), exports);
18
- __exportStar(require("./emojis"), exports);
19
- __exportStar(require("./errors"), exports);
20
- __exportStar(require("./messages"), exports);
21
- __exportStar(require("./prefixes"), exports);
1
+ export * from './banner.js';
2
+ export * from './emojis.js';
3
+ export * from './errors.js';
4
+ export * from './messages.js';
5
+ export * from './prefixes.js';
@@ -21,4 +21,12 @@ export declare const MESSAGES: {
21
21
  LIBRARY_INSTALLATION_FAILED_BAD_PACKAGE: (name: string) => string;
22
22
  LIBRARY_INSTALLATION_FAILED_NO_LIBRARY: string;
23
23
  LIBRARY_INSTALLATION_STARTS: string;
24
+ UPGRADE_IN_PROGRESS: string;
25
+ UPGRADE_GLOBAL_CLI_HINT: string;
26
+ OBSERVABILITY_QUESTION: string;
27
+ MAU_INSTALLATION_QUESTION: (name: string) => string;
28
+ MAU_INSTALLATION_IN_PROGRESS: (name: string) => string;
29
+ MAU_INSTALLATION_DECLINED: (name: string, command: string) => string;
30
+ MAU_INSTALLATION_FAILED: (name: string) => string;
31
+ MAU_NOT_INSTALLED_NON_INTERACTIVE: (name: string, command: string) => string;
24
32
  };
@@ -1,31 +1,36 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MESSAGES = void 0;
4
- const ansis_1 = require("ansis");
5
- const emojis_1 = require("./emojis");
6
- exports.MESSAGES = {
1
+ import { green } from 'ansis';
2
+ import { EMOJIS } from './emojis.js';
3
+ export const MESSAGES = {
7
4
  PROJECT_NAME_QUESTION: 'What name would you like to use for the new project?',
8
5
  PROJECT_SELECTION_QUESTION: 'Which project would you like to generate to?',
9
6
  LIBRARY_PROJECT_SELECTION_QUESTION: 'Which project would you like to add the library to?',
10
7
  DRY_RUN_MODE: 'Command has been executed in dry run mode, nothing changed!',
11
- PROJECT_INFORMATION_START: `${emojis_1.EMOJIS.SPARKLES} We will scaffold your app in a few seconds..`,
8
+ PROJECT_INFORMATION_START: `${EMOJIS.SPARKLES} We will scaffold your app in a few seconds..`,
12
9
  RUNNER_EXECUTION_ERROR: (command) => `\nFailed to execute command: ${command}`,
13
- PACKAGE_MANAGER_QUESTION: `Which package manager would you ${emojis_1.EMOJIS.HEART} to use?`,
14
- PACKAGE_MANAGER_INSTALLATION_IN_PROGRESS: `Installation in progress... ${emojis_1.EMOJIS.COFFEE}`,
15
- PACKAGE_MANAGER_UPDATE_IN_PROGRESS: `Installation in progress... ${emojis_1.EMOJIS.COFFEE}`,
16
- PACKAGE_MANAGER_UPGRADE_IN_PROGRESS: `Installation in progress... ${emojis_1.EMOJIS.COFFEE}`,
17
- PACKAGE_MANAGER_PRODUCTION_INSTALLATION_IN_PROGRESS: `Package installation in progress... ${emojis_1.EMOJIS.COFFEE}`,
10
+ PACKAGE_MANAGER_QUESTION: `Which package manager would you ${EMOJIS.HEART} to use?`,
11
+ PACKAGE_MANAGER_INSTALLATION_IN_PROGRESS: `Installation in progress... ${EMOJIS.COFFEE}`,
12
+ PACKAGE_MANAGER_UPDATE_IN_PROGRESS: `Installation in progress... ${EMOJIS.COFFEE}`,
13
+ PACKAGE_MANAGER_UPGRADE_IN_PROGRESS: `Installation in progress... ${EMOJIS.COFFEE}`,
14
+ PACKAGE_MANAGER_PRODUCTION_INSTALLATION_IN_PROGRESS: `Package installation in progress... ${EMOJIS.COFFEE}`,
18
15
  GIT_INITIALIZATION_ERROR: 'Git repository has not been initialized',
19
16
  PACKAGE_MANAGER_INSTALLATION_SUCCEED: (name) => name !== '.'
20
- ? `${emojis_1.EMOJIS.ROCKET} Successfully created project ${(0, ansis_1.green)(name)}`
21
- : `${emojis_1.EMOJIS.ROCKET} Successfully created a new project`,
22
- GET_STARTED_INFORMATION: `${emojis_1.EMOJIS.POINT_RIGHT} Get started with the following commands:`,
17
+ ? `${EMOJIS.ROCKET} Successfully created project ${green(name)}`
18
+ : `${EMOJIS.ROCKET} Successfully created a new project`,
19
+ GET_STARTED_INFORMATION: `${EMOJIS.POINT_RIGHT} Get started with the following commands:`,
23
20
  CHANGE_DIR_COMMAND: (name) => `$ cd ${name}`,
24
21
  START_COMMAND: (name) => `$ ${name} run start`,
25
- PACKAGE_MANAGER_INSTALLATION_FAILED: (commandToRunManually) => `${emojis_1.EMOJIS.SCREAM} Packages installation failed!\nIn case you don't see any errors above, consider manually running the failed command ${commandToRunManually} to see more details on why it errored out.`,
26
- NEST_INFORMATION_PACKAGE_MANAGER_FAILED: `${emojis_1.EMOJIS.SMIRK} cannot read your project package.json file, are you inside your project directory?`,
27
- NEST_INFORMATION_PACKAGE_WARNING_FAILED: (nestDependencies) => `${emojis_1.EMOJIS.SMIRK} failed to compare dependencies versions, please check that following packages are in the same minor version : \n ${nestDependencies.join('\n')}`,
22
+ PACKAGE_MANAGER_INSTALLATION_FAILED: (commandToRunManually) => `${EMOJIS.SCREAM} Packages installation failed!\nIn case you don't see any errors above, consider manually running the failed command ${commandToRunManually} to see more details on why it errored out.`,
23
+ NEST_INFORMATION_PACKAGE_MANAGER_FAILED: `${EMOJIS.SMIRK} cannot read your project package.json file, are you inside your project directory?`,
24
+ NEST_INFORMATION_PACKAGE_WARNING_FAILED: (nestDependencies) => `${EMOJIS.SMIRK} failed to compare dependencies versions, please check that following packages are in the same minor version : \n ${nestDependencies.join('\n')}`,
28
25
  LIBRARY_INSTALLATION_FAILED_BAD_PACKAGE: (name) => `Unable to install library ${name} because package did not install. Please check package name.`,
29
26
  LIBRARY_INSTALLATION_FAILED_NO_LIBRARY: 'No library found.',
30
27
  LIBRARY_INSTALLATION_STARTS: 'Starting library setup...',
28
+ UPGRADE_IN_PROGRESS: `${EMOJIS.ROCKET} Upgrading your project to NestJS v12...`,
29
+ UPGRADE_GLOBAL_CLI_HINT: 'Only the local @nestjs/cli was updated. To update a globally installed CLI, run: npm i -g @nestjs/cli@latest',
30
+ OBSERVABILITY_QUESTION: 'Would you like to enable auto-instrumented observability (@nestjs/observe)?',
31
+ MAU_INSTALLATION_QUESTION: (name) => `The ${name} package is required to deploy. Would you like to install it now?`,
32
+ MAU_INSTALLATION_IN_PROGRESS: (name) => `Installing ${name}... ${EMOJIS.COFFEE}`,
33
+ MAU_INSTALLATION_DECLINED: (name, command) => `Cannot deploy without ${name}. Install it with:\n\n ${command}\n`,
34
+ MAU_INSTALLATION_FAILED: (name) => `Failed to install ${name}. Please install it manually and try again.`,
35
+ MAU_NOT_INSTALLED_NON_INTERACTIVE: (name, command) => `The ${name} package is required to deploy, and there is no TTY available to confirm installing it. Install it with:\n\n ${command}\n`,
31
36
  };
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.INFO_PREFIX = exports.ERROR_PREFIX = void 0;
4
- const ansis_1 = require("ansis");
5
- exports.ERROR_PREFIX = (0, ansis_1.bgRgb)(210, 0, 75).bold.rgb(0, 0, 0)(' Error ');
6
- exports.INFO_PREFIX = (0, ansis_1.bgRgb)(60, 190, 100).bold.rgb(0, 0, 0)(' Info ');
1
+ import { bgRgb } from 'ansis';
2
+ export const ERROR_PREFIX = bgRgb(210, 0, 75).bold.rgb(0, 0, 0)(' Error ');
3
+ export const INFO_PREFIX = bgRgb(60, 190, 100).bold.rgb(0, 0, 0)(' Info ');
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.exitIfExtraArgs = exitIfExtraArgs;
4
- const ui_1 = require("../ui");
1
+ import { ERROR_PREFIX } from '../ui/index.js';
5
2
  /**
6
3
  * Checks if extra positional arguments were passed to a command
7
4
  * and exits with an error if so.
@@ -12,11 +9,11 @@ const ui_1 = require("../ui");
12
9
  * @param command - the Command instance received in the action handler
13
10
  * @param expectedArgCount - number of positional arguments the command defines
14
11
  */
15
- function exitIfExtraArgs(command, expectedArgCount) {
12
+ export function exitIfExtraArgs(command, expectedArgCount) {
16
13
  const parentArgs = command.parent?.args ?? [];
17
14
  if (parentArgs.length > expectedArgCount) {
18
15
  const extraArgs = parentArgs.slice(expectedArgCount);
19
- console.error(`${ui_1.ERROR_PREFIX} Too many arguments. Unexpected extra argument(s): ${extraArgs.join(', ')}`);
16
+ console.error(`${ERROR_PREFIX} Too many arguments. Unexpected extra argument(s): ${extraArgs.join(', ')}`);
20
17
  console.error(`Run "nest ${command.name()} --help" for usage information.\n`);
21
18
  process.exit(1);
22
19
  }
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizeToKebabOrSnakeCase = normalizeToKebabOrSnakeCase;
4
1
  /**
5
2
  *
6
3
  * @param str
@@ -8,7 +5,7 @@ exports.normalizeToKebabOrSnakeCase = normalizeToKebabOrSnakeCase;
8
5
  * @description normalizes input to supported path and file name format.
9
6
  * Changes camelCase strings to kebab-case, replaces spaces with dash and keeps underscores.
10
7
  */
11
- function normalizeToKebabOrSnakeCase(str) {
8
+ export function normalizeToKebabOrSnakeCase(str) {
12
9
  const STRING_DASHERIZE_REGEXP = /\s/g;
13
10
  const STRING_DECAMELIZE_REGEXP = /([a-z\d])([A-Z])/g;
14
11
  return str
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDefaultTsconfigPath = getDefaultTsconfigPath;
4
- const fs = require("fs");
5
- const path_1 = require("path");
1
+ import * as fs from 'fs';
2
+ import { join } from 'path';
6
3
  const TSCONFIG_BUILD_JSON = 'tsconfig.build.json';
7
4
  const TSCONFIG_JSON = 'tsconfig.json';
8
- function getDefaultTsconfigPath() {
9
- return fs.existsSync((0, path_1.join)(process.cwd(), TSCONFIG_BUILD_JSON))
5
+ export function getDefaultTsconfigPath() {
6
+ return fs.existsSync(join(process.cwd(), TSCONFIG_BUILD_JSON))
10
7
  ? TSCONFIG_BUILD_JSON
11
8
  : TSCONFIG_JSON;
12
9
  }
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.gracefullyExitOnPromptError = gracefullyExitOnPromptError;
4
- function gracefullyExitOnPromptError(err) {
1
+ export function gracefullyExitOnPromptError(err) {
5
2
  if (err.name === 'ExitPromptError') {
6
3
  process.exit(1);
7
4
  }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Detect whether the target project uses ESM output.
3
+ * Checks the project's package.json for `"type": "module"`.
4
+ */
5
+ export declare function isEsmProject(cwd?: string): boolean;
@@ -0,0 +1,16 @@
1
+ import { readFileSync } from 'fs';
2
+ import { join } from 'path';
3
+ /**
4
+ * Detect whether the target project uses ESM output.
5
+ * Checks the project's package.json for `"type": "module"`.
6
+ */
7
+ export function isEsmProject(cwd = process.cwd()) {
8
+ try {
9
+ const raw = readFileSync(join(cwd, 'package.json'), 'utf-8');
10
+ const pkg = JSON.parse(raw);
11
+ return pkg.type === 'module';
12
+ }
13
+ catch {
14
+ return false;
15
+ }
16
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Whether the process can ask the user a question.
3
+ *
4
+ * Prompts need a TTY on stdin. Under CI, a pipe or `execSync`, asking would
5
+ * block forever with nothing to answer it, so callers fall back to a
6
+ * non-interactive default (or explicit flags) instead of prompting.
7
+ */
8
+ export declare function isInteractive(): boolean;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Whether the process can ask the user a question.
3
+ *
4
+ * Prompts need a TTY on stdin. Under CI, a pipe or `execSync`, asking would
5
+ * block forever with nothing to answer it, so callers fall back to a
6
+ * non-interactive default (or explicit flags) instead of prompting.
7
+ */
8
+ export function isInteractive() {
9
+ return Boolean(process.stdin.isTTY);
10
+ }
@@ -1,7 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isModuleAvailable = isModuleAvailable;
4
- function isModuleAvailable(path) {
1
+ import { createRequire } from 'module';
2
+ const require = createRequire(import.meta.url);
3
+ export function isModuleAvailable(path) {
5
4
  try {
6
5
  require.resolve(path);
7
6
  return true;
@@ -1,2 +1,2 @@
1
- import { Configuration } from '../configuration';
1
+ import { Configuration } from '../configuration/index.js';
2
2
  export declare function loadConfiguration(): Promise<Required<Configuration>>;
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loadConfiguration = loadConfiguration;
4
- const nest_configuration_loader_1 = require("../configuration/nest-configuration.loader");
5
- const readers_1 = require("../readers");
6
- async function loadConfiguration() {
7
- const loader = new nest_configuration_loader_1.NestConfigurationLoader(new readers_1.FileSystemReader(process.cwd()));
1
+ import { NestConfigurationLoader } from '../configuration/nest-configuration.loader.js';
2
+ import { FileSystemReader } from '../readers/index.js';
3
+ export async function loadConfiguration() {
4
+ const loader = new NestConfigurationLoader(new FileSystemReader(process.cwd()));
8
5
  return loader.load();
9
6
  }