@nestjs/cli 8.2.4 → 8.2.7
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 +2 -1
- package/actions/generate.action.js +4 -1
- package/actions/start.action.d.ts +1 -2
- package/actions/start.action.js +7 -4
- package/commands/generate.command.js +8 -0
- package/commands/new.command.js +12 -15
- package/commands/start.command.js +10 -0
- package/lib/schematics/schematic.option.d.ts +2 -1
- package/lib/schematics/schematic.option.js +5 -2
- package/package.json +29 -30
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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/
|
|
2
|
+
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="120" alt="Nest Logo" /></a>
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
<p align="center">A progressive <a href="http://nodejs.org" target="blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
|
|
@@ -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,7 +85,10 @@ const mapSchematicOptions = (inputs) => {
|
|
|
85
85
|
const options = [];
|
|
86
86
|
inputs.forEach((input) => {
|
|
87
87
|
if (!excludedInputNames.includes(input.name) && input.value !== undefined) {
|
|
88
|
-
|
|
88
|
+
const keepInputName = input.options
|
|
89
|
+
? 'keepInputNameFormat' in input.options
|
|
90
|
+
: false;
|
|
91
|
+
options.push(new schematics_1.SchematicOption(input.name, input.value, keepInputName));
|
|
89
92
|
}
|
|
90
93
|
});
|
|
91
94
|
return options;
|
|
@@ -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 () => {
|
|
@@ -27,6 +27,7 @@ class GenerateCommand extends abstract_command_1.AbstractCommand {
|
|
|
27
27
|
.option('--spec', 'Enforce spec files generation.', () => {
|
|
28
28
|
return { value: true, passedAsInput: true };
|
|
29
29
|
}, true)
|
|
30
|
+
.option('--skip-import', 'Skip importing', () => true, false)
|
|
30
31
|
.option('--no-spec', 'Disable spec files generation.', () => {
|
|
31
32
|
return { value: false, passedAsInput: true };
|
|
32
33
|
})
|
|
@@ -56,6 +57,13 @@ class GenerateCommand extends abstract_command_1.AbstractCommand {
|
|
|
56
57
|
name: 'project',
|
|
57
58
|
value: command.project,
|
|
58
59
|
});
|
|
60
|
+
options.push({
|
|
61
|
+
name: 'skipImport',
|
|
62
|
+
value: command.skipImport,
|
|
63
|
+
options: {
|
|
64
|
+
keepInputNameFormat: true,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
59
67
|
const inputs = [];
|
|
60
68
|
inputs.push({ name: 'schematic', value: schematic });
|
|
61
69
|
inputs.push({ name: 'name', value: name });
|
package/commands/new.command.js
CHANGED
|
@@ -19,25 +19,26 @@ class NewCommand extends abstract_command_1.AbstractCommand {
|
|
|
19
19
|
.alias('n')
|
|
20
20
|
.description('Generate Nest application.')
|
|
21
21
|
.option('--directory [directory]', 'Specify the destination directory')
|
|
22
|
-
.option('-d, --dry-run', 'Report actions that would be performed without writing out results.')
|
|
23
|
-
.option('-g, --skip-git', 'Skip git repository initialization.')
|
|
24
|
-
.option('-s, --skip-install', 'Skip package installation.')
|
|
22
|
+
.option('-d, --dry-run', 'Report actions that would be performed without writing out results.', false)
|
|
23
|
+
.option('-g, --skip-git', 'Skip git repository initialization.', false)
|
|
24
|
+
.option('-s, --skip-install', 'Skip package installation.', false)
|
|
25
25
|
.option('-p, --package-manager [package-manager]', 'Specify package manager.')
|
|
26
|
-
.option('-l, --language [language]', 'Programming language to be used (TypeScript or JavaScript)
|
|
27
|
-
.option('-c, --collection [collectionName]', 'Schematics collection to use.
|
|
28
|
-
.option('--strict', 'Enables strict mode in TypeScript.')
|
|
26
|
+
.option('-l, --language [language]', 'Programming language to be used (TypeScript or JavaScript)', 'TypeScript')
|
|
27
|
+
.option('-c, --collection [collectionName]', 'Schematics collection to use', schematics_1.Collection.NESTJS)
|
|
28
|
+
.option('--strict', 'Enables strict mode in TypeScript.', false)
|
|
29
29
|
.action((name, command) => __awaiter(this, void 0, void 0, function* () {
|
|
30
30
|
const options = [];
|
|
31
31
|
const availableLanguages = ['js', 'ts', 'javascript', 'typescript'];
|
|
32
32
|
options.push({ name: 'directory', value: command.directory });
|
|
33
|
-
options.push({ name: 'dry-run', value:
|
|
34
|
-
options.push({ name: 'skip-git', value:
|
|
35
|
-
options.push({ name: 'skip-install', value:
|
|
36
|
-
options.push({ name: 'strict', value:
|
|
33
|
+
options.push({ name: 'dry-run', value: command.dryRun });
|
|
34
|
+
options.push({ name: 'skip-git', value: command.skipGit });
|
|
35
|
+
options.push({ name: 'skip-install', value: command.skipInstall });
|
|
36
|
+
options.push({ name: 'strict', value: command.strict });
|
|
37
37
|
options.push({
|
|
38
38
|
name: 'package-manager',
|
|
39
39
|
value: command.packageManager,
|
|
40
40
|
});
|
|
41
|
+
options.push({ name: 'collection', value: command.collection });
|
|
41
42
|
if (!!command.language) {
|
|
42
43
|
const lowercasedLanguage = command.language.toLowerCase();
|
|
43
44
|
const langMatch = availableLanguages.includes(lowercasedLanguage);
|
|
@@ -58,11 +59,7 @@ class NewCommand extends abstract_command_1.AbstractCommand {
|
|
|
58
59
|
}
|
|
59
60
|
options.push({
|
|
60
61
|
name: 'language',
|
|
61
|
-
value:
|
|
62
|
-
});
|
|
63
|
-
options.push({
|
|
64
|
-
name: 'collection',
|
|
65
|
-
value: command.collection || schematics_1.Collection.NESTJS,
|
|
62
|
+
value: command.language,
|
|
66
63
|
});
|
|
67
64
|
const inputs = [];
|
|
68
65
|
inputs.push({ name: 'name', value: name });
|
|
@@ -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 &&
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export declare class SchematicOption {
|
|
2
2
|
private name;
|
|
3
3
|
private value;
|
|
4
|
-
|
|
4
|
+
private keepInputNameFormat;
|
|
5
|
+
constructor(name: string, value: boolean | string, keepInputNameFormat?: boolean);
|
|
5
6
|
toCommandString(): string;
|
|
6
7
|
private format;
|
|
7
8
|
}
|
|
@@ -3,9 +3,10 @@ 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, keepInputNameFormat = false) {
|
|
7
7
|
this.name = name;
|
|
8
8
|
this.value = value;
|
|
9
|
+
this.keepInputNameFormat = keepInputNameFormat;
|
|
9
10
|
}
|
|
10
11
|
toCommandString() {
|
|
11
12
|
if (typeof this.value === 'string') {
|
|
@@ -20,7 +21,9 @@ class SchematicOption {
|
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
else if (typeof this.value === 'boolean') {
|
|
23
|
-
const str =
|
|
24
|
+
const str = this.keepInputNameFormat
|
|
25
|
+
? this.name
|
|
26
|
+
: (0, formatting_1.normalizeToKebabOrSnakeCase)(this.name);
|
|
24
27
|
return this.value ? `--${str}` : `--no-${str}`;
|
|
25
28
|
}
|
|
26
29
|
else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/cli",
|
|
3
|
-
"version": "8.2.
|
|
3
|
+
"version": "8.2.7",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@cli)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"test": "jest --config test/jest-config.json",
|
|
27
27
|
"test:dev": "npm run clean && jest --config test/jest-config.json --watchAll",
|
|
28
28
|
"prerelease": "npm run build",
|
|
29
|
-
"release": "release-it"
|
|
29
|
+
"release": "release-it",
|
|
30
|
+
"prepare": "husky install"
|
|
30
31
|
},
|
|
31
32
|
"repository": {
|
|
32
33
|
"type": "git",
|
|
@@ -43,15 +44,15 @@
|
|
|
43
44
|
},
|
|
44
45
|
"homepage": "https://github.com/nestjs/nest-cli#readme",
|
|
45
46
|
"dependencies": {
|
|
46
|
-
"@angular-devkit/core": "
|
|
47
|
-
"@angular-devkit/schematics": "
|
|
48
|
-
"@angular-devkit/schematics-cli": "
|
|
47
|
+
"@angular-devkit/core": "14.0.2",
|
|
48
|
+
"@angular-devkit/schematics": "14.0.2",
|
|
49
|
+
"@angular-devkit/schematics-cli": "14.0.2",
|
|
49
50
|
"@nestjs/schematics": "^8.0.3",
|
|
50
51
|
"chalk": "3.0.0",
|
|
51
52
|
"chokidar": "3.5.3",
|
|
52
|
-
"cli-table3": "0.6.
|
|
53
|
+
"cli-table3": "0.6.2",
|
|
53
54
|
"commander": "4.1.1",
|
|
54
|
-
"fork-ts-checker-webpack-plugin": "7.2.
|
|
55
|
+
"fork-ts-checker-webpack-plugin": "7.2.11",
|
|
55
56
|
"inquirer": "7.3.3",
|
|
56
57
|
"node-emoji": "1.11.0",
|
|
57
58
|
"ora": "5.4.1",
|
|
@@ -60,44 +61,42 @@
|
|
|
60
61
|
"shelljs": "0.8.5",
|
|
61
62
|
"source-map-support": "0.5.21",
|
|
62
63
|
"tree-kill": "1.2.2",
|
|
63
|
-
"tsconfig-paths": "3.14.
|
|
64
|
+
"tsconfig-paths": "3.14.1",
|
|
64
65
|
"tsconfig-paths-webpack-plugin": "3.5.2",
|
|
65
|
-
"typescript": "4.
|
|
66
|
-
"webpack": "5.
|
|
66
|
+
"typescript": "4.7.4",
|
|
67
|
+
"webpack": "5.73.0",
|
|
67
68
|
"webpack-node-externals": "3.0.0"
|
|
68
69
|
},
|
|
69
70
|
"devDependencies": {
|
|
70
|
-
"@commitlint/cli": "
|
|
71
|
-
"@commitlint/config-angular": "
|
|
71
|
+
"@commitlint/cli": "17.0.2",
|
|
72
|
+
"@commitlint/config-angular": "17.0.0",
|
|
72
73
|
"@types/copyfiles": "2.4.1",
|
|
73
|
-
"@types/inquirer": "
|
|
74
|
-
"@types/jest": "
|
|
75
|
-
"@types/node": "16.11.
|
|
74
|
+
"@types/inquirer": "8.2.1",
|
|
75
|
+
"@types/jest": "28.1.3",
|
|
76
|
+
"@types/node": "16.11.41",
|
|
76
77
|
"@types/node-emoji": "1.8.1",
|
|
77
78
|
"@types/ora": "3.2.0",
|
|
78
79
|
"@types/os-name": "3.1.0",
|
|
79
80
|
"@types/rimraf": "3.0.2",
|
|
80
81
|
"@types/shelljs": "0.8.11",
|
|
81
82
|
"@types/webpack-node-externals": "2.5.3",
|
|
82
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
83
|
-
"@typescript-eslint/parser": "5.
|
|
83
|
+
"@typescript-eslint/eslint-plugin": "5.29.0",
|
|
84
|
+
"@typescript-eslint/parser": "5.29.0",
|
|
84
85
|
"delete-empty": "3.0.0",
|
|
85
|
-
"eslint": "8.
|
|
86
|
+
"eslint": "8.18.0",
|
|
86
87
|
"eslint-config-prettier": "8.5.0",
|
|
87
|
-
"eslint-plugin-import": "2.
|
|
88
|
+
"eslint-plugin-import": "2.26.0",
|
|
88
89
|
"gulp": "4.0.2",
|
|
89
90
|
"gulp-clean": "0.4.0",
|
|
90
|
-
"husky": "
|
|
91
|
-
"jest": "
|
|
92
|
-
"prettier": "2.
|
|
93
|
-
"release-it": "
|
|
94
|
-
"ts-jest": "
|
|
95
|
-
"ts-loader": "9.
|
|
96
|
-
"ts-node": "10.
|
|
91
|
+
"husky": "8.0.1",
|
|
92
|
+
"jest": "28.1.1",
|
|
93
|
+
"prettier": "2.7.1",
|
|
94
|
+
"release-it": "15.1.0",
|
|
95
|
+
"ts-jest": "28.0.5",
|
|
96
|
+
"ts-loader": "9.3.1",
|
|
97
|
+
"ts-node": "10.8.1"
|
|
97
98
|
},
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"commit-msg": "commitlint -c .commitlintrc.json -E HUSKY_GIT_PARAMS"
|
|
101
|
-
}
|
|
99
|
+
"lint-staged": {
|
|
100
|
+
"**/*.{ts,json}": []
|
|
102
101
|
}
|
|
103
102
|
}
|