@nestjs/cli 10.0.0-next.2 → 10.0.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 (47) hide show
  1. package/.circleci/config.yml +11 -12
  2. package/actions/add.action.js +67 -84
  3. package/actions/build.action.js +44 -59
  4. package/actions/generate.action.js +8 -19
  5. package/actions/info.action.js +31 -50
  6. package/actions/new.action.js +36 -47
  7. package/actions/start.action.js +29 -40
  8. package/bin/nest.js +4 -13
  9. package/commands/add.command.js +3 -12
  10. package/commands/build.command.js +5 -15
  11. package/commands/command.loader.js +8 -19
  12. package/commands/generate.command.js +67 -84
  13. package/commands/info.command.js +3 -12
  14. package/commands/new.command.js +3 -12
  15. package/commands/start.command.js +5 -15
  16. package/lib/compiler/assets-manager.js +3 -3
  17. package/lib/compiler/hooks/tsconfig-paths.hook.js +2 -2
  18. package/lib/compiler/interfaces/readonly-visitor.interface.d.ts +1 -1
  19. package/lib/compiler/plugins/plugin-metadata-generator.d.ts +40 -0
  20. package/lib/compiler/plugins/plugin-metadata-generator.js +40 -4
  21. package/lib/compiler/plugins/plugin-metadata-printer.d.ts +4 -1
  22. package/lib/compiler/plugins/plugin-metadata-printer.js +6 -6
  23. package/lib/compiler/plugins/plugins-loader.js +6 -2
  24. package/lib/compiler/swc/forked-type-checker.js +26 -35
  25. package/lib/compiler/swc/swc-compiler.js +36 -43
  26. package/lib/compiler/swc/type-checker-host.d.ts +2 -1
  27. package/lib/compiler/swc/type-checker-host.js +12 -7
  28. package/lib/compiler/typescript-loader.js +1 -1
  29. package/lib/compiler/watch-compiler.js +4 -1
  30. package/lib/compiler/webpack-compiler.js +12 -5
  31. package/lib/compiler/workspace-utils.js +6 -17
  32. package/lib/configuration/nest-configuration.loader.js +27 -28
  33. package/lib/dependency-managers/nest.dependency-manager.js +21 -34
  34. package/lib/package-managers/abstract.package-manager.js +124 -165
  35. package/lib/package-managers/package-manager.factory.js +15 -26
  36. package/lib/package-managers/package-manager.js +1 -1
  37. package/lib/readers/file-system.reader.js +10 -21
  38. package/lib/runners/abstract.runner.js +19 -30
  39. package/lib/runners/runner.js +1 -1
  40. package/lib/runners/schematic.runner.js +1 -1
  41. package/lib/schematics/abstract.collection.js +4 -15
  42. package/lib/schematics/collection.js +1 -1
  43. package/lib/schematics/custom.collection.js +1 -2
  44. package/lib/schematics/nest.collection.js +3 -17
  45. package/lib/utils/load-configuration.js +3 -14
  46. package/lib/utils/project-utils.js +6 -17
  47. package/package.json +18 -18
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.AbstractRunner = void 0;
13
4
  const chalk = require("chalk");
@@ -18,28 +9,26 @@ class AbstractRunner {
18
9
  this.binary = binary;
19
10
  this.args = args;
20
11
  }
21
- run(command, collect = false, cwd = process.cwd()) {
22
- return __awaiter(this, void 0, void 0, function* () {
23
- const args = [command];
24
- const options = {
25
- cwd,
26
- stdio: collect ? 'pipe' : 'inherit',
27
- shell: true,
28
- };
29
- return new Promise((resolve, reject) => {
30
- const child = (0, child_process_1.spawn)(`${this.binary}`, [...this.args, ...args], options);
31
- if (collect) {
32
- child.stdout.on('data', (data) => resolve(data.toString().replace(/\r\n|\n/, '')));
12
+ async run(command, collect = false, cwd = process.cwd()) {
13
+ const args = [command];
14
+ const options = {
15
+ cwd,
16
+ stdio: collect ? 'pipe' : 'inherit',
17
+ shell: true,
18
+ };
19
+ return new Promise((resolve, reject) => {
20
+ const child = (0, child_process_1.spawn)(`${this.binary}`, [...this.args, ...args], options);
21
+ if (collect) {
22
+ child.stdout.on('data', (data) => resolve(data.toString().replace(/\r\n|\n/, '')));
23
+ }
24
+ child.on('close', (code) => {
25
+ if (code === 0) {
26
+ resolve(null);
27
+ }
28
+ else {
29
+ console.error(chalk.red(ui_1.MESSAGES.RUNNER_EXECUTION_ERROR(`${this.binary} ${command}`)));
30
+ reject();
33
31
  }
34
- child.on('close', (code) => {
35
- if (code === 0) {
36
- resolve(null);
37
- }
38
- else {
39
- console.error(chalk.red(ui_1.MESSAGES.RUNNER_EXECUTION_ERROR(`${this.binary} ${command}`)));
40
- reject();
41
- }
42
- });
43
32
  });
44
33
  });
45
34
  }
@@ -7,4 +7,4 @@ var Runner;
7
7
  Runner[Runner["NPM"] = 1] = "NPM";
8
8
  Runner[Runner["YARN"] = 2] = "YARN";
9
9
  Runner[Runner["PNPM"] = 3] = "PNPM";
10
- })(Runner = exports.Runner || (exports.Runner = {}));
10
+ })(Runner || (exports.Runner = Runner = {}));
@@ -13,7 +13,7 @@ class SchematicRunner extends abstract_runner_1.AbstractRunner {
13
13
  try {
14
14
  return require.resolve('@angular-devkit/schematics-cli/bin/schematics.js', { paths: this.getModulePaths() });
15
15
  }
16
- catch (_a) {
16
+ catch {
17
17
  throw new Error("'schematics' binary path could not be found!");
18
18
  }
19
19
  }
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.AbstractCollection = void 0;
13
4
  class AbstractCollection {
@@ -15,12 +6,10 @@ class AbstractCollection {
15
6
  this.collection = collection;
16
7
  this.runner = runner;
17
8
  }
18
- execute(name, options, extraFlags) {
19
- return __awaiter(this, void 0, void 0, function* () {
20
- let command = this.buildCommandLine(name, options);
21
- command = extraFlags ? command.concat(` ${extraFlags}`) : command;
22
- yield this.runner.run(command);
23
- });
9
+ async execute(name, options, extraFlags) {
10
+ let command = this.buildCommandLine(name, options);
11
+ command = extraFlags ? command.concat(` ${extraFlags}`) : command;
12
+ await this.runner.run(command);
24
13
  }
25
14
  buildCommandLine(name, options) {
26
15
  return `${this.collection}:${name}${this.buildOptions(options)}`;
@@ -4,4 +4,4 @@ exports.Collection = void 0;
4
4
  var Collection;
5
5
  (function (Collection) {
6
6
  Collection["NESTJS"] = "@nestjs/schematics";
7
- })(Collection = exports.Collection || (exports.Collection = {}));
7
+ })(Collection || (exports.Collection = Collection = {}));
@@ -10,10 +10,9 @@ class CustomCollection extends abstract_collection_1.AbstractCollection {
10
10
  const collectionPath = (0, path_1.join)(collectionPackagePath, 'collection.json');
11
11
  const collection = JSON.parse((0, fs_1.readFileSync)(collectionPath, 'utf8'));
12
12
  const schematics = Object.entries(collection.schematics).map(([name, value]) => {
13
- var _a;
14
13
  const schematic = value;
15
14
  const description = schematic.description;
16
- const alias = ((_a = schematic === null || schematic === void 0 ? void 0 : schematic.aliases) === null || _a === void 0 ? void 0 : _a.length) ? schematic.aliases[0] : '';
15
+ const alias = schematic?.aliases?.length ? schematic.aliases[0] : '';
17
16
  return { name, description, alias };
18
17
  });
19
18
  return schematics;
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.NestCollection = void 0;
13
4
  const abstract_collection_1 = require("./abstract.collection");
@@ -15,14 +6,9 @@ class NestCollection extends abstract_collection_1.AbstractCollection {
15
6
  constructor(runner) {
16
7
  super('@nestjs/schematics', runner);
17
8
  }
18
- execute(name, options) {
19
- const _super = Object.create(null, {
20
- execute: { get: () => super.execute }
21
- });
22
- return __awaiter(this, void 0, void 0, function* () {
23
- const schematic = this.validate(name);
24
- yield _super.execute.call(this, schematic, options);
25
- });
9
+ async execute(name, options) {
10
+ const schematic = this.validate(name);
11
+ await super.execute(schematic, options);
26
12
  }
27
13
  getSchematics() {
28
14
  return NestCollection.schematics.filter((item) => item.name !== 'angular-app');
@@ -1,21 +1,10 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.loadConfiguration = void 0;
13
4
  const nest_configuration_loader_1 = require("../configuration/nest-configuration.loader");
14
5
  const readers_1 = require("../readers");
15
- function loadConfiguration() {
16
- return __awaiter(this, void 0, void 0, function* () {
17
- const loader = new nest_configuration_loader_1.NestConfigurationLoader(new readers_1.FileSystemReader(process.cwd()));
18
- return loader.load();
19
- });
6
+ async function loadConfiguration() {
7
+ const loader = new nest_configuration_loader_1.NestConfigurationLoader(new readers_1.FileSystemReader(process.cwd()));
8
+ return loader.load();
20
9
  }
21
10
  exports.loadConfiguration = loadConfiguration;
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.hasValidOptionFlag = exports.moveDefaultProjectToStart = exports.askForProjectName = exports.getSpecFileSuffix = exports.shouldGenerateFlat = exports.shouldGenerateSpec = exports.shouldAskForProject = void 0;
13
4
  const inquirer = require("inquirer");
@@ -72,14 +63,12 @@ function getSpecFileSuffix(configuration, appName, specFileSuffixValue) {
72
63
  return specFileSuffixValue;
73
64
  }
74
65
  exports.getSpecFileSuffix = getSpecFileSuffix;
75
- function askForProjectName(promptQuestion, projects) {
76
- return __awaiter(this, void 0, void 0, function* () {
77
- const questions = [
78
- (0, questions_1.generateSelect)('appName')(promptQuestion)(projects),
79
- ];
80
- const prompt = inquirer.createPromptModule();
81
- return prompt(questions);
82
- });
66
+ async function askForProjectName(promptQuestion, projects) {
67
+ const questions = [
68
+ (0, questions_1.generateSelect)('appName')(promptQuestion)(projects),
69
+ ];
70
+ const prompt = inquirer.createPromptModule();
71
+ return prompt(questions);
83
72
  }
84
73
  exports.askForProjectName = askForProjectName;
85
74
  function moveDefaultProjectToStart(configuration, defaultProjectName, defaultLabel) {
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@nestjs/cli",
3
- "version": "10.0.0-next.2",
3
+ "version": "10.0.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": ">= 12.9.0"
9
+ "node": ">= 16"
10
10
  },
11
11
  "bin": {
12
12
  "nest": "bin/nest.js"
@@ -38,10 +38,10 @@
38
38
  },
39
39
  "homepage": "https://github.com/nestjs/nest-cli#readme",
40
40
  "dependencies": {
41
- "@angular-devkit/core": "16.0.1",
42
- "@angular-devkit/schematics": "16.0.1",
43
- "@angular-devkit/schematics-cli": "16.0.1",
44
- "@nestjs/schematics": "^9.0.4",
41
+ "@angular-devkit/core": "16.1.0",
42
+ "@angular-devkit/schematics": "16.1.0",
43
+ "@angular-devkit/schematics-cli": "16.1.0",
44
+ "@nestjs/schematics": "^10.0.0",
45
45
  "chalk": "4.1.2",
46
46
  "chokidar": "3.5.3",
47
47
  "cli-table3": "0.6.3",
@@ -57,25 +57,25 @@
57
57
  "tree-kill": "1.2.2",
58
58
  "tsconfig-paths": "4.2.0",
59
59
  "tsconfig-paths-webpack-plugin": "4.0.1",
60
- "typescript": "4.9.5",
61
- "webpack": "5.82.1",
60
+ "typescript": "5.1.3",
61
+ "webpack": "5.87.0",
62
62
  "webpack-node-externals": "3.0.0"
63
63
  },
64
64
  "devDependencies": {
65
- "@commitlint/cli": "17.6.3",
66
- "@commitlint/config-angular": "17.6.3",
65
+ "@commitlint/cli": "17.6.5",
66
+ "@commitlint/config-angular": "17.6.5",
67
67
  "@swc/cli": "0.1.62",
68
- "@swc/core": "1.3.62",
68
+ "@swc/core": "1.3.64",
69
69
  "@types/inquirer": "8.2.6",
70
- "@types/jest": "29.5.1",
71
- "@types/node": "18.16.12",
70
+ "@types/jest": "29.5.2",
71
+ "@types/node": "18.16.18",
72
72
  "@types/node-emoji": "1.8.2",
73
73
  "@types/shelljs": "0.8.12",
74
74
  "@types/webpack-node-externals": "3.0.0",
75
- "@typescript-eslint/eslint-plugin": "5.59.6",
76
- "@typescript-eslint/parser": "5.59.6",
75
+ "@typescript-eslint/eslint-plugin": "5.59.11",
76
+ "@typescript-eslint/parser": "5.59.11",
77
77
  "delete-empty": "3.0.0",
78
- "eslint": "8.40.0",
78
+ "eslint": "8.42.0",
79
79
  "eslint-config-prettier": "8.8.0",
80
80
  "gulp": "4.0.2",
81
81
  "gulp-clean": "0.4.0",
@@ -83,9 +83,9 @@
83
83
  "jest": "29.5.0",
84
84
  "lint-staged": "13.2.2",
85
85
  "prettier": "2.8.8",
86
- "release-it": "15.10.3",
86
+ "release-it": "15.11.0",
87
87
  "ts-jest": "29.1.0",
88
- "ts-loader": "9.4.2"
88
+ "ts-loader": "9.4.3"
89
89
  },
90
90
  "lint-staged": {
91
91
  "**/*.{ts,json}": []