@nestjs/cli 8.2.6 → 9.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.
- package/.husky/commit-msg +4 -0
- package/.husky/pre-commit +4 -0
- package/CONTRIBUTING.md +2 -2
- package/README.md +1 -0
- 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/actions/start.action.d.ts +1 -2
- package/actions/start.action.js +7 -4
- package/commands/command.loader.js +0 -2
- package/commands/generate.command.js +0 -3
- package/commands/start.command.js +10 -0
- 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 +28 -34
package/CONTRIBUTING.md
CHANGED
|
@@ -18,7 +18,7 @@ We would love for you to contribute to Nest and help make it even better than it
|
|
|
18
18
|
|
|
19
19
|
To save your and our time, we will systematically close all issues that are requests for general support and redirect people to Stack Overflow.
|
|
20
20
|
|
|
21
|
-
If you would like to chat about the question in real-time, you can reach out via our [
|
|
21
|
+
If you would like to chat about the question in real-time, you can reach out via [our discord channel][discord].
|
|
22
22
|
|
|
23
23
|
## <a name="issue"></a> Found a Bug?
|
|
24
24
|
|
|
@@ -217,7 +217,7 @@ changes to be accepted, the CLA must be signed. It's a quick process, we promise
|
|
|
217
217
|
[commit-message-format]: https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#
|
|
218
218
|
[corporate-cla]: http://code.google.com/legal/corporate-cla-v1.0.html
|
|
219
219
|
[github]: https://github.com/nestjs/nest
|
|
220
|
-
[
|
|
220
|
+
[discord]: https://discord.gg/nestjs
|
|
221
221
|
[individual-cla]: http://code.google.com/legal/individual-cla-v1.0.html
|
|
222
222
|
[js-style-guide]: https://google.github.io/styleguide/jsguide.html
|
|
223
223
|
[jsfiddle]: http://jsfiddle.net
|
package/README.md
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
|
15
15
|
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
|
|
16
16
|
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a>
|
|
17
|
+
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
|
|
17
18
|
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
|
|
18
19
|
|
|
19
20
|
## Description
|
|
@@ -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;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Input } from '../commands';
|
|
2
|
-
import { Configuration } from '../lib/configuration';
|
|
3
2
|
import { BuildAction } from './build.action';
|
|
4
3
|
export declare class StartAction extends BuildAction {
|
|
5
4
|
handle(inputs: Input[], options: Input[]): Promise<void>;
|
|
6
|
-
createOnSuccessHook(
|
|
5
|
+
createOnSuccessHook(entryFile: string, sourceRoot: string, debugFlag: boolean | string | undefined, outDirName: string, binaryToRun?: string): () => void;
|
|
7
6
|
private spawnChildProcess;
|
|
8
7
|
private isSourceMapSupportPkgAvailable;
|
|
9
8
|
}
|
package/actions/start.action.js
CHANGED
|
@@ -22,6 +22,7 @@ const ui_1 = require("../lib/ui");
|
|
|
22
22
|
const build_action_1 = require("./build.action");
|
|
23
23
|
class StartAction extends build_action_1.BuildAction {
|
|
24
24
|
handle(inputs, options) {
|
|
25
|
+
var _a, _b;
|
|
25
26
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
27
|
try {
|
|
27
28
|
const configFileName = options.find((option) => option.name === 'config')
|
|
@@ -40,7 +41,11 @@ class StartAction extends build_action_1.BuildAction {
|
|
|
40
41
|
const binaryToRun = binaryToRunOption && binaryToRunOption.value;
|
|
41
42
|
const { options: tsOptions } = this.tsConfigProvider.getByConfigFilename(pathToTsconfig);
|
|
42
43
|
const outDir = tsOptions.outDir || defaults_1.defaultOutDir;
|
|
43
|
-
const
|
|
44
|
+
const entryFile = ((_a = options.find((option) => option.name === 'entryFile')) === null || _a === void 0 ? void 0 : _a.value) ||
|
|
45
|
+
(0, get_value_or_default_1.getValueOrDefault)(configuration, 'entryFile', appName, undefined, undefined, defaults_1.defaultConfiguration.entryFile);
|
|
46
|
+
const sourceRoot = ((_b = options.find((option) => option.name === 'sourceRoot')) === null || _b === void 0 ? void 0 : _b.value) ||
|
|
47
|
+
(0, get_value_or_default_1.getValueOrDefault)(configuration, 'sourceRoot', appName, undefined, undefined, defaults_1.defaultConfiguration.sourceRoot);
|
|
48
|
+
const onSuccess = this.createOnSuccessHook(entryFile, sourceRoot, debugFlag, outDir, binaryToRun);
|
|
44
49
|
yield this.runBuild(inputs, options, isWatchEnabled, isWatchAssetsEnabled, !!debugFlag, onSuccess);
|
|
45
50
|
}
|
|
46
51
|
catch (err) {
|
|
@@ -53,9 +58,7 @@ class StartAction extends build_action_1.BuildAction {
|
|
|
53
58
|
}
|
|
54
59
|
});
|
|
55
60
|
}
|
|
56
|
-
createOnSuccessHook(
|
|
57
|
-
const sourceRoot = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'sourceRoot', appName);
|
|
58
|
-
const entryFile = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'entryFile', appName);
|
|
61
|
+
createOnSuccessHook(entryFile, sourceRoot, debugFlag, outDirName, binaryToRun = 'node') {
|
|
59
62
|
let childProcessRef;
|
|
60
63
|
process.on('exit', () => childProcessRef && (0, tree_kill_1.treeKillSync)(childProcessRef.pid));
|
|
61
64
|
return () => {
|
|
@@ -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 });
|
|
@@ -23,6 +23,8 @@ class StartCommand extends abstract_command_1.AbstractCommand {
|
|
|
23
23
|
.option('--webpack', 'Use webpack for compilation.')
|
|
24
24
|
.option('--webpackPath [path]', 'Path to webpack configuration.')
|
|
25
25
|
.option('--tsc', 'Use tsc for compilation.')
|
|
26
|
+
.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.')
|
|
27
|
+
.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.")
|
|
26
28
|
.option('-e, --exec [binary]', 'Binary to run (default: "node").')
|
|
27
29
|
.option('--preserveWatchOutput', 'Use "preserveWatchOutput" option when tsc watch mode.')
|
|
28
30
|
.description('Run Nest application.')
|
|
@@ -49,6 +51,14 @@ class StartCommand extends abstract_command_1.AbstractCommand {
|
|
|
49
51
|
name: 'exec',
|
|
50
52
|
value: command.exec,
|
|
51
53
|
});
|
|
54
|
+
options.push({
|
|
55
|
+
name: 'sourceRoot',
|
|
56
|
+
value: command.sourceRoot,
|
|
57
|
+
});
|
|
58
|
+
options.push({
|
|
59
|
+
name: 'entryFile',
|
|
60
|
+
value: command.entryFile,
|
|
61
|
+
});
|
|
52
62
|
options.push({
|
|
53
63
|
name: 'preserveWatchOutput',
|
|
54
64
|
value: !!command.preserveWatchOutput &&
|
|
@@ -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.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": ">=
|
|
10
|
-
"npm": ">= 6.11.0"
|
|
9
|
+
"node": ">= 12.9.0"
|
|
11
10
|
},
|
|
12
11
|
"bin": {
|
|
13
12
|
"nest": "bin/nest.js"
|
|
@@ -26,27 +25,23 @@
|
|
|
26
25
|
"test": "jest --config test/jest-config.json",
|
|
27
26
|
"test:dev": "npm run clean && jest --config test/jest-config.json --watchAll",
|
|
28
27
|
"prerelease": "npm run build",
|
|
29
|
-
"release": "release-it"
|
|
28
|
+
"release": "release-it",
|
|
29
|
+
"prepare": "husky install"
|
|
30
30
|
},
|
|
31
31
|
"repository": {
|
|
32
32
|
"type": "git",
|
|
33
33
|
"url": "git+https://github.com/nestjs/nest-cli.git"
|
|
34
34
|
},
|
|
35
|
-
"contributors": [
|
|
36
|
-
"Kamil Mysliwiec <mail@kamilmysliwiec.com>",
|
|
37
|
-
"Mark Pieszak <mark@trilon.io>",
|
|
38
|
-
"ThomRick"
|
|
39
|
-
],
|
|
40
35
|
"license": "MIT",
|
|
41
36
|
"bugs": {
|
|
42
37
|
"url": "https://github.com/nestjs/nest-cli/issues"
|
|
43
38
|
},
|
|
44
39
|
"homepage": "https://github.com/nestjs/nest-cli#readme",
|
|
45
40
|
"dependencies": {
|
|
46
|
-
"@angular-devkit/core": "
|
|
47
|
-
"@angular-devkit/schematics": "
|
|
48
|
-
"@angular-devkit/schematics-cli": "
|
|
49
|
-
"@nestjs/schematics": "^
|
|
41
|
+
"@angular-devkit/core": "14.0.5",
|
|
42
|
+
"@angular-devkit/schematics": "14.0.5",
|
|
43
|
+
"@angular-devkit/schematics-cli": "14.0.5",
|
|
44
|
+
"@nestjs/schematics": "^9.0.0",
|
|
50
45
|
"chalk": "3.0.0",
|
|
51
46
|
"chokidar": "3.5.3",
|
|
52
47
|
"cli-table3": "0.6.2",
|
|
@@ -62,42 +57,41 @@
|
|
|
62
57
|
"tree-kill": "1.2.2",
|
|
63
58
|
"tsconfig-paths": "3.14.1",
|
|
64
59
|
"tsconfig-paths-webpack-plugin": "3.5.2",
|
|
65
|
-
"typescript": "4.
|
|
66
|
-
"webpack": "5.
|
|
60
|
+
"typescript": "4.7.4",
|
|
61
|
+
"webpack": "5.73.0",
|
|
67
62
|
"webpack-node-externals": "3.0.0"
|
|
68
63
|
},
|
|
69
64
|
"devDependencies": {
|
|
70
|
-
"@commitlint/cli": "
|
|
71
|
-
"@commitlint/config-angular": "
|
|
65
|
+
"@commitlint/cli": "17.0.3",
|
|
66
|
+
"@commitlint/config-angular": "17.0.3",
|
|
72
67
|
"@types/copyfiles": "2.4.1",
|
|
73
|
-
"@types/inquirer": "
|
|
74
|
-
"@types/jest": "
|
|
75
|
-
"@types/node": "16.11.
|
|
68
|
+
"@types/inquirer": "8.2.1",
|
|
69
|
+
"@types/jest": "28.1.4",
|
|
70
|
+
"@types/node": "16.11.43",
|
|
76
71
|
"@types/node-emoji": "1.8.1",
|
|
77
72
|
"@types/ora": "3.2.0",
|
|
78
73
|
"@types/os-name": "3.1.0",
|
|
79
74
|
"@types/rimraf": "3.0.2",
|
|
80
75
|
"@types/shelljs": "0.8.11",
|
|
81
76
|
"@types/webpack-node-externals": "2.5.3",
|
|
82
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
83
|
-
"@typescript-eslint/parser": "5.
|
|
77
|
+
"@typescript-eslint/eslint-plugin": "5.30.5",
|
|
78
|
+
"@typescript-eslint/parser": "5.30.5",
|
|
84
79
|
"delete-empty": "3.0.0",
|
|
85
|
-
"eslint": "8.
|
|
80
|
+
"eslint": "8.19.0",
|
|
86
81
|
"eslint-config-prettier": "8.5.0",
|
|
87
82
|
"eslint-plugin-import": "2.26.0",
|
|
88
83
|
"gulp": "4.0.2",
|
|
89
84
|
"gulp-clean": "0.4.0",
|
|
90
|
-
"husky": "
|
|
91
|
-
"jest": "28.
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"ts-
|
|
96
|
-
"ts-
|
|
85
|
+
"husky": "8.0.1",
|
|
86
|
+
"jest": "28.1.2",
|
|
87
|
+
"lint-staged": "13.0.3",
|
|
88
|
+
"prettier": "2.7.1",
|
|
89
|
+
"release-it": "15.1.1",
|
|
90
|
+
"ts-jest": "28.0.5",
|
|
91
|
+
"ts-loader": "9.3.1",
|
|
92
|
+
"ts-node": "10.8.2"
|
|
97
93
|
},
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"commit-msg": "commitlint -c .commitlintrc.json -E HUSKY_GIT_PARAMS"
|
|
101
|
-
}
|
|
94
|
+
"lint-staged": {
|
|
95
|
+
"**/*.{ts,json}": []
|
|
102
96
|
}
|
|
103
97
|
}
|