@nestjs/cli 10.1.17 → 10.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.
@@ -21,7 +21,7 @@ jobs:
21
21
  build:
22
22
  working_directory: ~/nest
23
23
  docker:
24
- - image: cimg/node:20.5
24
+ - image: cimg/node:21.0
25
25
  steps:
26
26
  - checkout
27
27
  - run:
@@ -43,7 +43,7 @@ jobs:
43
43
  unit_tests:
44
44
  working_directory: ~/nest
45
45
  docker:
46
- - image: cimg/node:20.5
46
+ - image: cimg/node:21.0
47
47
  steps:
48
48
  - checkout
49
49
  - *restore-cache
@@ -4,5 +4,5 @@ export declare class StartAction extends BuildAction {
4
4
  handle(commandInputs: Input[], commandOptions: Input[]): Promise<void>;
5
5
  createOnSuccessHook(entryFile: string, sourceRoot: string, debugFlag: boolean | string | undefined, outDirName: string, binaryToRun: string): () => void;
6
6
  private spawnChildProcess;
7
- private isSourceMapSupportPkgAvailable;
7
+ private getSourceMapSupportPkg;
8
8
  }
@@ -73,7 +73,14 @@ class StartAction extends build_action_1.BuildAction {
73
73
  let childProcessArgs = [];
74
74
  const argsStartIndex = process.argv.indexOf('--');
75
75
  if (argsStartIndex >= 0) {
76
- childProcessArgs = process.argv.slice(argsStartIndex + 1);
76
+ // Prevents the need for users to double escape strings
77
+ // i.e. I can run the more natural
78
+ // nest start -- '{"foo": "bar"}'
79
+ // instead of
80
+ // nest start -- '\'{"foo": "bar"}\''
81
+ childProcessArgs = process.argv
82
+ .slice(argsStartIndex + 1)
83
+ .map((arg) => JSON.stringify(arg));
77
84
  }
78
85
  outputFilePath =
79
86
  outputFilePath.indexOf(' ') >= 0 ? `"${outputFilePath}"` : outputFilePath;
@@ -82,21 +89,21 @@ class StartAction extends build_action_1.BuildAction {
82
89
  const inspectFlag = typeof debug === 'string' ? `--inspect=${debug}` : '--inspect';
83
90
  processArgs.unshift(inspectFlag);
84
91
  }
85
- if (this.isSourceMapSupportPkgAvailable()) {
86
- processArgs.unshift('-r source-map-support/register');
92
+ const sourceMapsRegisterPath = this.getSourceMapSupportPkg();
93
+ if (sourceMapsRegisterPath !== undefined) {
94
+ processArgs.unshift(`-r ${sourceMapsRegisterPath}`);
87
95
  }
88
96
  return (0, child_process_1.spawn)(binaryToRun, processArgs, {
89
97
  stdio: 'inherit',
90
98
  shell: true,
91
99
  });
92
100
  }
93
- isSourceMapSupportPkgAvailable() {
101
+ getSourceMapSupportPkg() {
94
102
  try {
95
- require.resolve('source-map-support');
96
- return true;
103
+ return require.resolve('source-map-support/register');
97
104
  }
98
105
  catch {
99
- return false;
106
+ return undefined;
100
107
  }
101
108
  }
102
109
  }
package/bin/nest.js CHANGED
@@ -17,7 +17,7 @@ const bootstrap = async () => {
17
17
  else {
18
18
  await commands_1.CommandLoader.load(program);
19
19
  }
20
- commander.parseAsync(process.argv);
20
+ await commander.parseAsync(process.argv);
21
21
  if (!process.argv.slice(2).length) {
22
22
  program.outputHelp();
23
23
  }
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AssetsManager = void 0;
4
4
  const chokidar = require("chokidar");
5
+ const fs_1 = require("fs");
6
+ const glob_1 = require("glob");
5
7
  const path_1 = require("path");
6
8
  const shell = require("shelljs");
7
9
  const copy_path_resolve_1 = require("./helpers/copy-path-resolve");
@@ -64,13 +66,22 @@ class AssetsManager {
64
66
  sourceRoot,
65
67
  watchAssetsMode: isWatchEnabled,
66
68
  };
67
- // prettier-ignore
68
- const watcher = chokidar
69
- .watch(item.glob, { ignored: item.exclude })
70
- .on('add', (path) => this.actionOnFile({ ...option, path, action: 'change' }))
71
- .on('change', (path) => this.actionOnFile({ ...option, path, action: 'change' }))
72
- .on('unlink', (path) => this.actionOnFile({ ...option, path, action: 'unlink' }));
73
- this.watchers.push(watcher);
69
+ if (isWatchEnabled || item.watchAssets) {
70
+ // prettier-ignore
71
+ const watcher = chokidar
72
+ .watch(item.glob, { ignored: item.exclude })
73
+ .on('add', (path) => this.actionOnFile({ ...option, path, action: 'change' }))
74
+ .on('change', (path) => this.actionOnFile({ ...option, path, action: 'change' }))
75
+ .on('unlink', (path) => this.actionOnFile({ ...option, path, action: 'unlink' }));
76
+ this.watchers.push(watcher);
77
+ }
78
+ else {
79
+ const files = (0, glob_1.sync)(item.glob, { ignore: item.exclude })
80
+ .filter((matched) => (0, fs_1.statSync)(matched).isFile());
81
+ for (const path of files) {
82
+ this.actionOnFile({ ...option, path, action: 'change' });
83
+ }
84
+ }
74
85
  }
75
86
  }
76
87
  catch (err) {
@@ -2,11 +2,24 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NestConfigurationLoader = void 0;
4
4
  const defaults_1 = require("./defaults");
5
+ /**
6
+ * A cache table that maps some reader (by its name along with the config path)
7
+ * to a loaded configuration.
8
+ * This was added because several commands relies on the app's config in order
9
+ * to generate some dynanmic content prior running the command itself.
10
+ */
11
+ const loadedConfigsCache = new Map();
5
12
  class NestConfigurationLoader {
6
13
  constructor(reader) {
7
14
  this.reader = reader;
8
15
  }
9
16
  async load(name) {
17
+ const cacheEntryKey = `${this.reader.constructor.name}:${name}`;
18
+ const cachedConfig = loadedConfigsCache.get(cacheEntryKey);
19
+ if (cachedConfig) {
20
+ return cachedConfig;
21
+ }
22
+ let loadedConfig;
10
23
  const content = name
11
24
  ? await this.reader.read(name)
12
25
  : await this.reader.readAnyOf([
@@ -15,24 +28,30 @@ class NestConfigurationLoader {
15
28
  '.nest-cli.json',
16
29
  'nest.json',
17
30
  ]);
18
- if (!content) {
19
- return defaults_1.defaultConfiguration;
31
+ if (content) {
32
+ const fileConfig = JSON.parse(content);
33
+ if (fileConfig.compilerOptions) {
34
+ loadedConfig = {
35
+ ...defaults_1.defaultConfiguration,
36
+ ...fileConfig,
37
+ compilerOptions: {
38
+ ...defaults_1.defaultConfiguration.compilerOptions,
39
+ ...fileConfig.compilerOptions,
40
+ },
41
+ };
42
+ }
43
+ else {
44
+ loadedConfig = {
45
+ ...defaults_1.defaultConfiguration,
46
+ ...fileConfig,
47
+ };
48
+ }
20
49
  }
21
- const fileConfig = JSON.parse(content);
22
- if (fileConfig.compilerOptions) {
23
- return {
24
- ...defaults_1.defaultConfiguration,
25
- ...fileConfig,
26
- compilerOptions: {
27
- ...defaults_1.defaultConfiguration.compilerOptions,
28
- ...fileConfig.compilerOptions,
29
- },
30
- };
50
+ else {
51
+ loadedConfig = defaults_1.defaultConfiguration;
31
52
  }
32
- return {
33
- ...defaults_1.defaultConfiguration,
34
- ...fileConfig,
35
- };
53
+ loadedConfigsCache.set(cacheEntryKey, loadedConfig);
54
+ return loadedConfig;
36
55
  }
37
56
  }
38
57
  exports.NestConfigurationLoader = NestConfigurationLoader;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@nestjs/cli",
3
- "version": "10.1.17",
3
+ "version": "10.2.0",
4
4
  "description": "Nest - modern, fast, powerful node.js web framework (@cli)",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
8
  "engines": {
9
- "node": ">= 16"
9
+ "node": ">= 16.14"
10
10
  },
11
11
  "bin": {
12
12
  "nest": "bin/nest.js"
@@ -38,15 +38,16 @@
38
38
  },
39
39
  "homepage": "https://github.com/nestjs/nest-cli#readme",
40
40
  "dependencies": {
41
- "@angular-devkit/core": "16.2.0",
42
- "@angular-devkit/schematics": "16.2.0",
43
- "@angular-devkit/schematics-cli": "16.2.0",
41
+ "@angular-devkit/core": "16.2.7",
42
+ "@angular-devkit/schematics": "16.2.7",
43
+ "@angular-devkit/schematics-cli": "16.2.7",
44
44
  "@nestjs/schematics": "^10.0.1",
45
45
  "chalk": "4.1.2",
46
46
  "chokidar": "3.5.3",
47
47
  "cli-table3": "0.6.3",
48
48
  "commander": "4.1.1",
49
- "fork-ts-checker-webpack-plugin": "8.0.0",
49
+ "fork-ts-checker-webpack-plugin": "9.0.0",
50
+ "glob": "10.3.4",
50
51
  "inquirer": "8.2.6",
51
52
  "node-emoji": "1.11.0",
52
53
  "ora": "5.4.1",
@@ -57,35 +58,35 @@
57
58
  "tree-kill": "1.2.2",
58
59
  "tsconfig-paths": "4.2.0",
59
60
  "tsconfig-paths-webpack-plugin": "4.1.0",
60
- "typescript": "5.1.6",
61
- "webpack": "5.88.2",
61
+ "typescript": "5.2.2",
62
+ "webpack": "5.89.0",
62
63
  "webpack-node-externals": "3.0.0"
63
64
  },
64
65
  "devDependencies": {
65
- "@commitlint/cli": "17.7.1",
66
- "@commitlint/config-angular": "17.7.0",
66
+ "@commitlint/cli": "18.0.0",
67
+ "@commitlint/config-angular": "18.0.0",
67
68
  "@swc/cli": "0.1.62",
68
- "@swc/core": "1.3.81",
69
+ "@swc/core": "1.3.94",
69
70
  "@types/inquirer": "9.0.3",
70
- "@types/jest": "29.5.4",
71
- "@types/node": "18.17.12",
71
+ "@types/jest": "29.5.6",
72
+ "@types/node": "18.18.6",
72
73
  "@types/node-emoji": "1.8.2",
73
- "@types/shelljs": "0.8.12",
74
- "@types/webpack-node-externals": "3.0.0",
75
- "@typescript-eslint/eslint-plugin": "6.5.0",
76
- "@typescript-eslint/parser": "6.5.0",
74
+ "@types/shelljs": "0.8.14",
75
+ "@types/webpack-node-externals": "3.0.3",
76
+ "@typescript-eslint/eslint-plugin": "6.8.0",
77
+ "@typescript-eslint/parser": "6.8.0",
77
78
  "delete-empty": "3.0.0",
78
- "eslint": "8.48.0",
79
+ "eslint": "8.52.0",
79
80
  "eslint-config-prettier": "9.0.0",
80
81
  "gulp": "4.0.2",
81
82
  "gulp-clean": "0.4.0",
82
83
  "husky": "8.0.3",
83
- "jest": "29.6.4",
84
- "lint-staged": "14.0.1",
84
+ "jest": "29.7.0",
85
+ "lint-staged": "15.0.2",
85
86
  "prettier": "3.0.3",
86
- "release-it": "16.1.5",
87
+ "release-it": "16.2.1",
87
88
  "ts-jest": "29.1.1",
88
- "ts-loader": "9.4.4"
89
+ "ts-loader": "9.5.0"
89
90
  },
90
91
  "lint-staged": {
91
92
  "**/*.{ts,json}": []