@nestjs/cli 8.2.7 → 9.1.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.
- package/.circleci/config.yml +3 -3
- package/.husky/pre-commit +1 -1
- package/actions/generate.action.js +1 -4
- package/actions/index.d.ts +0 -1
- package/actions/index.js +0 -1
- package/actions/new.action.js +15 -0
- package/commands/command.loader.js +0 -2
- package/commands/generate.command.js +0 -3
- package/lib/compiler/compiler.js +3 -1
- package/lib/compiler/hooks/tsconfig-paths.hook.d.ts +1 -1
- package/lib/compiler/hooks/tsconfig-paths.hook.js +12 -6
- package/lib/schematics/nest.collection.js +2 -2
- package/lib/schematics/schematic.option.d.ts +2 -2
- package/lib/schematics/schematic.option.js +9 -9
- package/package.json +22 -27
- package/actions/update.action.d.ts +0 -5
- package/actions/update.action.js +0 -26
- package/commands/update.command.d.ts +0 -5
- package/commands/update.command.js +0 -30
package/.circleci/config.yml
CHANGED
|
@@ -21,12 +21,12 @@ jobs:
|
|
|
21
21
|
build:
|
|
22
22
|
working_directory: ~/nest
|
|
23
23
|
docker:
|
|
24
|
-
- image:
|
|
24
|
+
- image: cimg/node:17.9
|
|
25
25
|
steps:
|
|
26
26
|
- checkout
|
|
27
27
|
- run:
|
|
28
28
|
name: Update NPM version
|
|
29
|
-
command:
|
|
29
|
+
command: npm install -g npm@latest
|
|
30
30
|
- restore_cache:
|
|
31
31
|
key: dependency-cache-{{ checksum "package.json" }}
|
|
32
32
|
- run:
|
|
@@ -43,7 +43,7 @@ jobs:
|
|
|
43
43
|
unit_tests:
|
|
44
44
|
working_directory: ~/nest
|
|
45
45
|
docker:
|
|
46
|
-
- image:
|
|
46
|
+
- image: cimg/node:17.9
|
|
47
47
|
steps:
|
|
48
48
|
- checkout
|
|
49
49
|
- *restore-cache
|
package/.husky/pre-commit
CHANGED
|
@@ -85,10 +85,7 @@ const mapSchematicOptions = (inputs) => {
|
|
|
85
85
|
const options = [];
|
|
86
86
|
inputs.forEach((input) => {
|
|
87
87
|
if (!excludedInputNames.includes(input.name) && input.value !== undefined) {
|
|
88
|
-
|
|
89
|
-
? 'keepInputNameFormat' in input.options
|
|
90
|
-
: false;
|
|
91
|
-
options.push(new schematics_1.SchematicOption(input.name, input.value, keepInputName));
|
|
88
|
+
options.push(new schematics_1.SchematicOption(input.name, input.value));
|
|
92
89
|
}
|
|
93
90
|
});
|
|
94
91
|
return options;
|
package/actions/index.d.ts
CHANGED
package/actions/index.js
CHANGED
|
@@ -19,6 +19,5 @@ __exportStar(require("./build.action"), exports);
|
|
|
19
19
|
__exportStar(require("./generate.action"), exports);
|
|
20
20
|
__exportStar(require("./info.action"), exports);
|
|
21
21
|
__exportStar(require("./new.action"), exports);
|
|
22
|
-
__exportStar(require("./update.action"), exports);
|
|
23
22
|
__exportStar(require("./start.action"), exports);
|
|
24
23
|
__exportStar(require("./add.action"), exports);
|
package/actions/new.action.js
CHANGED
|
@@ -146,6 +146,9 @@ const initializeGitRepository = (dir) => __awaiter(void 0, void 0, void 0, funct
|
|
|
146
146
|
const createGitIgnoreFile = (dir, content) => {
|
|
147
147
|
const fileContent = content || defaults_1.defaultGitIgnore;
|
|
148
148
|
const filePath = (0, path_1.join)(process.cwd(), dir, '.gitignore');
|
|
149
|
+
if (fileExists(filePath)) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
149
152
|
return (0, util_1.promisify)(fs.writeFile)(filePath, fileContent);
|
|
150
153
|
};
|
|
151
154
|
const printCollective = () => {
|
|
@@ -184,5 +187,17 @@ const retrieveCols = () => {
|
|
|
184
187
|
}
|
|
185
188
|
};
|
|
186
189
|
exports.retrieveCols = retrieveCols;
|
|
190
|
+
const fileExists = (path) => {
|
|
191
|
+
try {
|
|
192
|
+
fs.accessSync(path);
|
|
193
|
+
return true;
|
|
194
|
+
}
|
|
195
|
+
catch (err) {
|
|
196
|
+
if (err.code === 'ENOENT') {
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
throw err;
|
|
200
|
+
}
|
|
201
|
+
};
|
|
187
202
|
const exit = () => process.exit(1);
|
|
188
203
|
exports.exit = exit;
|
|
@@ -10,14 +10,12 @@ const generate_command_1 = require("./generate.command");
|
|
|
10
10
|
const info_command_1 = require("./info.command");
|
|
11
11
|
const new_command_1 = require("./new.command");
|
|
12
12
|
const start_command_1 = require("./start.command");
|
|
13
|
-
const update_command_1 = require("./update.command");
|
|
14
13
|
class CommandLoader {
|
|
15
14
|
static load(program) {
|
|
16
15
|
new new_command_1.NewCommand(new actions_1.NewAction()).load(program);
|
|
17
16
|
new build_command_1.BuildCommand(new actions_1.BuildAction()).load(program);
|
|
18
17
|
new start_command_1.StartCommand(new actions_1.StartAction()).load(program);
|
|
19
18
|
new info_command_1.InfoCommand(new actions_1.InfoAction()).load(program);
|
|
20
|
-
new update_command_1.UpdateCommand(new actions_1.UpdateAction()).load(program);
|
|
21
19
|
new add_command_1.AddCommand(new actions_1.AddAction()).load(program);
|
|
22
20
|
new generate_command_1.GenerateCommand(new actions_1.GenerateAction()).load(program);
|
|
23
21
|
this.handleInvalidCommand(program);
|
|
@@ -60,9 +60,6 @@ class GenerateCommand extends abstract_command_1.AbstractCommand {
|
|
|
60
60
|
options.push({
|
|
61
61
|
name: 'skipImport',
|
|
62
62
|
value: command.skipImport,
|
|
63
|
-
options: {
|
|
64
|
-
keepInputNameFormat: true,
|
|
65
|
-
},
|
|
66
63
|
});
|
|
67
64
|
const inputs = [];
|
|
68
65
|
inputs.push({ name: 'schematic', value: schematic });
|
package/lib/compiler/compiler.js
CHANGED
|
@@ -34,7 +34,9 @@ class Compiler {
|
|
|
34
34
|
const after = plugins.afterHooks.map((hook) => hook(programRef));
|
|
35
35
|
const afterDeclarations = plugins.afterDeclarationsHooks.map((hook) => hook(programRef));
|
|
36
36
|
const emitResult = program.emit(undefined, undefined, undefined, undefined, {
|
|
37
|
-
before:
|
|
37
|
+
before: tsconfigPathsPlugin
|
|
38
|
+
? before.concat(tsconfigPathsPlugin)
|
|
39
|
+
: before,
|
|
38
40
|
after,
|
|
39
41
|
afterDeclarations,
|
|
40
42
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import * as ts from 'typescript';
|
|
2
|
-
export declare function tsconfigPathsBeforeHookFactory(compilerOptions: ts.CompilerOptions): (ctx: ts.TransformationContext) => ts.Transformer<any
|
|
2
|
+
export declare function tsconfigPathsBeforeHookFactory(compilerOptions: ts.CompilerOptions): ((ctx: ts.TransformationContext) => ts.Transformer<any>) | undefined;
|
|
@@ -9,26 +9,32 @@ function tsconfigPathsBeforeHookFactory(compilerOptions) {
|
|
|
9
9
|
const tsBinary = new typescript_loader_1.TypeScriptBinaryLoader().load();
|
|
10
10
|
const { paths = {}, baseUrl = './' } = compilerOptions;
|
|
11
11
|
const matcher = tsPaths.createMatchPath(baseUrl, paths, ['main']);
|
|
12
|
+
if (Object.keys(paths).length === 0) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
12
15
|
return (ctx) => {
|
|
13
16
|
return (sf) => {
|
|
14
17
|
const visitNode = (node) => {
|
|
15
18
|
if (tsBinary.isImportDeclaration(node) ||
|
|
16
19
|
(tsBinary.isExportDeclaration(node) && node.moduleSpecifier)) {
|
|
17
20
|
try {
|
|
18
|
-
const newNode = tsBinary.getMutableClone(node);
|
|
19
21
|
const importPathWithQuotes = node.moduleSpecifier && node.moduleSpecifier.getText();
|
|
20
22
|
if (!importPathWithQuotes) {
|
|
21
23
|
return node;
|
|
22
24
|
}
|
|
23
|
-
const text = importPathWithQuotes.
|
|
25
|
+
const text = importPathWithQuotes.substring(1, importPathWithQuotes.length - 1);
|
|
24
26
|
const result = getNotAliasedPath(sf, matcher, text);
|
|
25
27
|
if (!result) {
|
|
26
28
|
return node;
|
|
27
29
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
const moduleSpecifier = tsBinary.factory.createStringLiteral(result);
|
|
31
|
+
moduleSpecifier.parent = node.moduleSpecifier.parent;
|
|
32
|
+
if (tsBinary.isImportDeclaration(node)) {
|
|
33
|
+
return tsBinary.factory.updateImportDeclaration(node, node.decorators, node.modifiers, node.importClause, moduleSpecifier, node.assertClause);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
return tsBinary.factory.updateExportDeclaration(node, node.decorators, node.modifiers, node.isTypeOnly, node.exportClause, moduleSpecifier, node.assertClause);
|
|
37
|
+
}
|
|
32
38
|
}
|
|
33
39
|
catch (_a) {
|
|
34
40
|
return node;
|
|
@@ -84,12 +84,12 @@ NestCollection.schematics = [
|
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
86
|
name: 'interceptor',
|
|
87
|
-
alias: '
|
|
87
|
+
alias: 'itc',
|
|
88
88
|
description: 'Generate an interceptor declaration',
|
|
89
89
|
},
|
|
90
90
|
{
|
|
91
91
|
name: 'interface',
|
|
92
|
-
alias: '
|
|
92
|
+
alias: 'itf',
|
|
93
93
|
description: 'Generate an interface',
|
|
94
94
|
},
|
|
95
95
|
{
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export declare class SchematicOption {
|
|
2
2
|
private name;
|
|
3
3
|
private value;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
constructor(name: string, value: boolean | string);
|
|
5
|
+
get normalizedName(): string;
|
|
6
6
|
toCommandString(): string;
|
|
7
7
|
private format;
|
|
8
8
|
}
|
|
@@ -3,31 +3,31 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SchematicOption = void 0;
|
|
4
4
|
const formatting_1 = require("../utils/formatting");
|
|
5
5
|
class SchematicOption {
|
|
6
|
-
constructor(name, value
|
|
6
|
+
constructor(name, value) {
|
|
7
7
|
this.name = name;
|
|
8
8
|
this.value = value;
|
|
9
|
-
|
|
9
|
+
}
|
|
10
|
+
get normalizedName() {
|
|
11
|
+
return (0, formatting_1.normalizeToKebabOrSnakeCase)(this.name);
|
|
10
12
|
}
|
|
11
13
|
toCommandString() {
|
|
12
14
|
if (typeof this.value === 'string') {
|
|
13
15
|
if (this.name === 'name') {
|
|
14
|
-
return `--${this.
|
|
16
|
+
return `--${this.normalizedName}=${this.format()}`;
|
|
15
17
|
}
|
|
16
18
|
else if (this.name === 'version' || this.name === 'path') {
|
|
17
|
-
return `--${this.
|
|
19
|
+
return `--${this.normalizedName}=${this.value}`;
|
|
18
20
|
}
|
|
19
21
|
else {
|
|
20
|
-
return `--${this.
|
|
22
|
+
return `--${this.normalizedName}="${this.value}"`;
|
|
21
23
|
}
|
|
22
24
|
}
|
|
23
25
|
else if (typeof this.value === 'boolean') {
|
|
24
|
-
const str = this.
|
|
25
|
-
? this.name
|
|
26
|
-
: (0, formatting_1.normalizeToKebabOrSnakeCase)(this.name);
|
|
26
|
+
const str = this.normalizedName;
|
|
27
27
|
return this.value ? `--${str}` : `--no-${str}`;
|
|
28
28
|
}
|
|
29
29
|
else {
|
|
30
|
-
return `--${
|
|
30
|
+
return `--${this.normalizedName}=${this.value}`;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
format() {
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.1.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": ">=
|
|
10
|
-
"npm": ">= 6.11.0"
|
|
9
|
+
"node": ">= 12.9.0"
|
|
11
10
|
},
|
|
12
11
|
"bin": {
|
|
13
12
|
"nest": "bin/nest.js"
|
|
@@ -33,26 +32,21 @@
|
|
|
33
32
|
"type": "git",
|
|
34
33
|
"url": "git+https://github.com/nestjs/nest-cli.git"
|
|
35
34
|
},
|
|
36
|
-
"contributors": [
|
|
37
|
-
"Kamil Mysliwiec <mail@kamilmysliwiec.com>",
|
|
38
|
-
"Mark Pieszak <mark@trilon.io>",
|
|
39
|
-
"ThomRick"
|
|
40
|
-
],
|
|
41
35
|
"license": "MIT",
|
|
42
36
|
"bugs": {
|
|
43
37
|
"url": "https://github.com/nestjs/nest-cli/issues"
|
|
44
38
|
},
|
|
45
39
|
"homepage": "https://github.com/nestjs/nest-cli#readme",
|
|
46
40
|
"dependencies": {
|
|
47
|
-
"@angular-devkit/core": "14.0
|
|
48
|
-
"@angular-devkit/schematics": "14.0
|
|
49
|
-
"@angular-devkit/schematics-cli": "14.0
|
|
50
|
-
"@nestjs/schematics": "^
|
|
41
|
+
"@angular-devkit/core": "14.2.0",
|
|
42
|
+
"@angular-devkit/schematics": "14.2.0",
|
|
43
|
+
"@angular-devkit/schematics-cli": "14.2.0",
|
|
44
|
+
"@nestjs/schematics": "^9.0.0",
|
|
51
45
|
"chalk": "3.0.0",
|
|
52
46
|
"chokidar": "3.5.3",
|
|
53
47
|
"cli-table3": "0.6.2",
|
|
54
48
|
"commander": "4.1.1",
|
|
55
|
-
"fork-ts-checker-webpack-plugin": "7.2.
|
|
49
|
+
"fork-ts-checker-webpack-plugin": "7.2.13",
|
|
56
50
|
"inquirer": "7.3.3",
|
|
57
51
|
"node-emoji": "1.11.0",
|
|
58
52
|
"ora": "5.4.1",
|
|
@@ -61,40 +55,41 @@
|
|
|
61
55
|
"shelljs": "0.8.5",
|
|
62
56
|
"source-map-support": "0.5.21",
|
|
63
57
|
"tree-kill": "1.2.2",
|
|
64
|
-
"tsconfig-paths": "
|
|
65
|
-
"tsconfig-paths-webpack-plugin": "
|
|
58
|
+
"tsconfig-paths": "4.1.0",
|
|
59
|
+
"tsconfig-paths-webpack-plugin": "4.0.0",
|
|
66
60
|
"typescript": "4.7.4",
|
|
67
61
|
"webpack": "5.73.0",
|
|
68
62
|
"webpack-node-externals": "3.0.0"
|
|
69
63
|
},
|
|
70
64
|
"devDependencies": {
|
|
71
|
-
"@commitlint/cli": "17.0.
|
|
72
|
-
"@commitlint/config-angular": "17.0.
|
|
65
|
+
"@commitlint/cli": "17.0.3",
|
|
66
|
+
"@commitlint/config-angular": "17.0.3",
|
|
73
67
|
"@types/copyfiles": "2.4.1",
|
|
74
|
-
"@types/inquirer": "8.2.
|
|
75
|
-
"@types/jest": "28.1.
|
|
76
|
-
"@types/node": "16.11.
|
|
68
|
+
"@types/inquirer": "8.2.2",
|
|
69
|
+
"@types/jest": "28.1.6",
|
|
70
|
+
"@types/node": "16.11.47",
|
|
77
71
|
"@types/node-emoji": "1.8.1",
|
|
78
72
|
"@types/ora": "3.2.0",
|
|
79
73
|
"@types/os-name": "3.1.0",
|
|
80
74
|
"@types/rimraf": "3.0.2",
|
|
81
75
|
"@types/shelljs": "0.8.11",
|
|
82
76
|
"@types/webpack-node-externals": "2.5.3",
|
|
83
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
84
|
-
"@typescript-eslint/parser": "5.
|
|
77
|
+
"@typescript-eslint/eslint-plugin": "5.30.7",
|
|
78
|
+
"@typescript-eslint/parser": "5.30.7",
|
|
85
79
|
"delete-empty": "3.0.0",
|
|
86
|
-
"eslint": "8.
|
|
80
|
+
"eslint": "8.20.0",
|
|
87
81
|
"eslint-config-prettier": "8.5.0",
|
|
88
82
|
"eslint-plugin-import": "2.26.0",
|
|
89
83
|
"gulp": "4.0.2",
|
|
90
84
|
"gulp-clean": "0.4.0",
|
|
91
85
|
"husky": "8.0.1",
|
|
92
|
-
"jest": "28.1.
|
|
86
|
+
"jest": "28.1.3",
|
|
87
|
+
"lint-staged": "13.0.3",
|
|
93
88
|
"prettier": "2.7.1",
|
|
94
|
-
"release-it": "15.
|
|
95
|
-
"ts-jest": "28.0.
|
|
89
|
+
"release-it": "15.3.0",
|
|
90
|
+
"ts-jest": "28.0.7",
|
|
96
91
|
"ts-loader": "9.3.1",
|
|
97
|
-
"ts-node": "10.
|
|
92
|
+
"ts-node": "10.9.1"
|
|
98
93
|
},
|
|
99
94
|
"lint-staged": {
|
|
100
95
|
"**/*.{ts,json}": []
|
package/actions/update.action.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.UpdateAction = void 0;
|
|
13
|
-
const dependency_managers_1 = require("../lib/dependency-managers");
|
|
14
|
-
const package_managers_1 = require("../lib/package-managers");
|
|
15
|
-
const abstract_action_1 = require("./abstract.action");
|
|
16
|
-
class UpdateAction extends abstract_action_1.AbstractAction {
|
|
17
|
-
handle(inputs, options) {
|
|
18
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
const force = options.find((option) => option.name === 'force');
|
|
20
|
-
const tag = options.find((option) => option.name === 'tag');
|
|
21
|
-
const manager = new dependency_managers_1.NestDependencyManager(yield package_managers_1.PackageManagerFactory.find());
|
|
22
|
-
yield manager.update(force.value, tag.value);
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
exports.UpdateAction = UpdateAction;
|
|
@@ -1,30 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.UpdateCommand = void 0;
|
|
13
|
-
const abstract_command_1 = require("./abstract.command");
|
|
14
|
-
class UpdateCommand extends abstract_command_1.AbstractCommand {
|
|
15
|
-
load(program) {
|
|
16
|
-
program
|
|
17
|
-
.command('update')
|
|
18
|
-
.alias('u')
|
|
19
|
-
.description('Update Nest dependencies.')
|
|
20
|
-
.option('-f, --force', 'Remove and re-install dependencies (instead of update).')
|
|
21
|
-
.option('-t, --tag <tag>', 'Upgrade to tagged packages (latest | beta | rc | next tag).')
|
|
22
|
-
.action((command) => __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
const options = [];
|
|
24
|
-
options.push({ name: 'force', value: !!command.force });
|
|
25
|
-
options.push({ name: 'tag', value: command.tag });
|
|
26
|
-
yield this.action.handle([], options);
|
|
27
|
-
}));
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.UpdateCommand = UpdateCommand;
|