@nestjs/cli 9.2.0 → 9.4.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 +2 -2
- package/README.md +1 -3
- package/actions/start.action.d.ts +1 -1
- package/actions/start.action.js +4 -8
- package/lib/compiler/helpers/get-value-or-default.d.ts +1 -1
- package/lib/compiler/helpers/manual-restart.d.ts +2 -0
- package/lib/compiler/helpers/manual-restart.js +18 -0
- package/lib/compiler/watch-compiler.js +10 -2
- package/lib/compiler/workspace-utils.js +2 -2
- package/lib/configuration/configuration.d.ts +2 -0
- package/lib/configuration/defaults.js +1 -0
- package/lib/schematics/nest.collection.js +10 -10
- package/package.json +29 -35
package/.circleci/config.yml
CHANGED
|
@@ -21,7 +21,7 @@ jobs:
|
|
|
21
21
|
build:
|
|
22
22
|
working_directory: ~/nest
|
|
23
23
|
docker:
|
|
24
|
-
- image: cimg/node:19.
|
|
24
|
+
- image: cimg/node:19.9
|
|
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:19.
|
|
46
|
+
- image: cimg/node:19.9
|
|
47
47
|
steps:
|
|
48
48
|
- checkout
|
|
49
49
|
- *restore-cache
|
package/README.md
CHANGED
|
@@ -7,8 +7,6 @@
|
|
|
7
7
|
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/v/@nestjs/cli.svg" alt="NPM Version" /></a>
|
|
8
8
|
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/l/@nestjs/cli.svg" alt="Package License" /></a>
|
|
9
9
|
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/dm/@nestjs/cli.svg" alt="NPM Downloads" /></a>
|
|
10
|
-
<a href="https://travis-ci.org/nestjs/nest"><img src="https://api.travis-ci.org/nestjs/nest.svg?branch=master" alt="Travis" /></a>
|
|
11
|
-
<a href="https://travis-ci.org/nestjs/nest"><img src="https://img.shields.io/travis/nestjs/nest/master.svg?label=linux" alt="Linux" /></a>
|
|
12
10
|
<a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a>
|
|
13
11
|
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
|
|
14
12
|
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
|
@@ -42,4 +40,4 @@ Learn more in the [official documentation](https://docs.nestjs.com/cli/overview)
|
|
|
42
40
|
|
|
43
41
|
## License
|
|
44
42
|
|
|
45
|
-
Nest is [MIT licensed](LICENSE).
|
|
43
|
+
Nest is [MIT licensed](LICENSE).
|
|
@@ -2,7 +2,7 @@ import { Input } from '../commands';
|
|
|
2
2
|
import { BuildAction } from './build.action';
|
|
3
3
|
export declare class StartAction extends BuildAction {
|
|
4
4
|
handle(inputs: Input[], options: Input[]): Promise<void>;
|
|
5
|
-
createOnSuccessHook(entryFile: string, sourceRoot: string, debugFlag: boolean | string | undefined, outDirName: string, binaryToRun
|
|
5
|
+
createOnSuccessHook(entryFile: string, sourceRoot: string, debugFlag: boolean | string | undefined, outDirName: string, binaryToRun: string): () => void;
|
|
6
6
|
private spawnChildProcess;
|
|
7
7
|
private isSourceMapSupportPkgAvailable;
|
|
8
8
|
}
|
package/actions/start.action.js
CHANGED
|
@@ -22,7 +22,6 @@ 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;
|
|
26
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
27
26
|
try {
|
|
28
27
|
const configFileName = options.find((option) => option.name === 'config')
|
|
@@ -31,20 +30,17 @@ class StartAction extends build_action_1.BuildAction {
|
|
|
31
30
|
const appName = inputs.find((input) => input.name === 'app')
|
|
32
31
|
.value;
|
|
33
32
|
const pathToTsconfig = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'compilerOptions.tsConfigPath', appName, 'path', options);
|
|
34
|
-
const binaryToRunOption = options.find((option) => option.name === 'exec');
|
|
35
33
|
const debugModeOption = options.find((option) => option.name === 'debug');
|
|
36
34
|
const watchModeOption = options.find((option) => option.name === 'watch');
|
|
37
35
|
const isWatchEnabled = !!(watchModeOption && watchModeOption.value);
|
|
38
36
|
const watchAssetsModeOption = options.find((option) => option.name === 'watchAssets');
|
|
39
37
|
const isWatchAssetsEnabled = !!(watchAssetsModeOption && watchAssetsModeOption.value);
|
|
40
38
|
const debugFlag = debugModeOption && debugModeOption.value;
|
|
41
|
-
const binaryToRun =
|
|
39
|
+
const binaryToRun = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'exec', appName, 'exec', options, defaults_1.defaultConfiguration.exec);
|
|
42
40
|
const { options: tsOptions } = this.tsConfigProvider.getByConfigFilename(pathToTsconfig);
|
|
43
41
|
const outDir = tsOptions.outDir || defaults_1.defaultOutDir;
|
|
44
|
-
const entryFile = (
|
|
45
|
-
|
|
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);
|
|
42
|
+
const entryFile = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'entryFile', appName, 'entryFile', options, defaults_1.defaultConfiguration.entryFile);
|
|
43
|
+
const sourceRoot = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'sourceRoot', appName, 'sourceRoot', options, defaults_1.defaultConfiguration.sourceRoot);
|
|
48
44
|
const onSuccess = this.createOnSuccessHook(entryFile, sourceRoot, debugFlag, outDir, binaryToRun);
|
|
49
45
|
yield this.runBuild(inputs, options, isWatchEnabled, isWatchAssetsEnabled, !!debugFlag, onSuccess);
|
|
50
46
|
}
|
|
@@ -58,7 +54,7 @@ class StartAction extends build_action_1.BuildAction {
|
|
|
58
54
|
}
|
|
59
55
|
});
|
|
60
56
|
}
|
|
61
|
-
createOnSuccessHook(entryFile, sourceRoot, debugFlag, outDirName, binaryToRun
|
|
57
|
+
createOnSuccessHook(entryFile, sourceRoot, debugFlag, outDirName, binaryToRun) {
|
|
62
58
|
let childProcessRef;
|
|
63
59
|
process.on('exit', () => childProcessRef && (0, tree_kill_1.treeKillSync)(childProcessRef.pid));
|
|
64
60
|
return () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Input } from '../../../commands';
|
|
2
2
|
import { Configuration } from '../../configuration';
|
|
3
|
-
export declare function getValueOrDefault<T = any>(configuration: Required<Configuration>, propertyPath: string, appName: string, key?: 'path' | 'webpack' | 'webpackPath', options?: Input[], defaultValue?: T): T;
|
|
3
|
+
export declare function getValueOrDefault<T = any>(configuration: Required<Configuration>, propertyPath: string, appName: string, key?: 'path' | 'webpack' | 'webpackPath' | 'entryFile' | 'sourceRoot' | 'exec', options?: Input[], defaultValue?: T): T;
|
|
4
4
|
export declare function getValueOfPath<T = any>(object: Record<string, any>, propertyPath: string): T;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.displayManualRestartTip = exports.listenForManualRestart = void 0;
|
|
4
|
+
const chalk = require("chalk");
|
|
5
|
+
function listenForManualRestart(callback) {
|
|
6
|
+
const stdinListener = (data) => {
|
|
7
|
+
if (data.toString().trim() === 'rs') {
|
|
8
|
+
process.stdin.removeListener('data', stdinListener);
|
|
9
|
+
callback();
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
process.stdin.on('data', stdinListener);
|
|
13
|
+
}
|
|
14
|
+
exports.listenForManualRestart = listenForManualRestart;
|
|
15
|
+
function displayManualRestartTip() {
|
|
16
|
+
console.log(`To restart at any time, enter ${chalk.gray('rs')}.\n`);
|
|
17
|
+
}
|
|
18
|
+
exports.displayManualRestartTip = displayManualRestartTip;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.WatchCompiler = void 0;
|
|
4
4
|
const errors_1 = require("../ui/errors");
|
|
5
5
|
const get_value_or_default_1 = require("./helpers/get-value-or-default");
|
|
6
|
+
const manual_restart_1 = require("./helpers/manual-restart");
|
|
6
7
|
const tsconfig_paths_hook_1 = require("./hooks/tsconfig-paths.hook");
|
|
7
8
|
class WatchCompiler {
|
|
8
9
|
constructor(pluginsLoader, tsConfigProvider, typescriptLoader) {
|
|
@@ -27,7 +28,10 @@ class WatchCompiler {
|
|
|
27
28
|
host.createProgram = (rootNames, options,
|
|
28
29
|
// tslint:disable-next-line:no-shadowed-variable
|
|
29
30
|
host, oldProgram) => {
|
|
30
|
-
|
|
31
|
+
(0, manual_restart_1.displayManualRestartTip)();
|
|
32
|
+
const tsconfigPathsPlugin = options
|
|
33
|
+
? (0, tsconfig_paths_hook_1.tsconfigPathsBeforeHookFactory)(options)
|
|
34
|
+
: null;
|
|
31
35
|
const program = origCreateProgram(rootNames, options, host, oldProgram, undefined, projectReferences);
|
|
32
36
|
const origProgramEmit = program.emit;
|
|
33
37
|
program.emit = (targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) => {
|
|
@@ -46,7 +50,11 @@ class WatchCompiler {
|
|
|
46
50
|
};
|
|
47
51
|
return program;
|
|
48
52
|
};
|
|
49
|
-
tsBin.createWatchProgram(host);
|
|
53
|
+
const watchProgram = tsBin.createWatchProgram(host);
|
|
54
|
+
(0, manual_restart_1.listenForManualRestart)(() => {
|
|
55
|
+
watchProgram.close();
|
|
56
|
+
this.run(configuration, configFilename, appName, tsCompilerOptions, onSuccess);
|
|
57
|
+
});
|
|
50
58
|
}
|
|
51
59
|
createDiagnosticReporter(diagnosticReporter) {
|
|
52
60
|
return function (diagnostic, ...args) {
|
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.WorkspaceUtils = void 0;
|
|
13
|
-
const
|
|
13
|
+
const rimraf_1 = require("rimraf");
|
|
14
14
|
const get_value_or_default_1 = require("./helpers/get-value-or-default");
|
|
15
15
|
class WorkspaceUtils {
|
|
16
16
|
deleteOutDirIfEnabled(configuration, appName, dirPath) {
|
|
@@ -19,7 +19,7 @@ class WorkspaceUtils {
|
|
|
19
19
|
if (!isDeleteEnabled) {
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
-
yield
|
|
22
|
+
yield (0, rimraf_1.default)(dirPath);
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -34,6 +34,7 @@ export interface ProjectConfiguration {
|
|
|
34
34
|
type?: string;
|
|
35
35
|
root?: string;
|
|
36
36
|
entryFile?: string;
|
|
37
|
+
exec?: string;
|
|
37
38
|
sourceRoot?: string;
|
|
38
39
|
compilerOptions?: CompilerOptions;
|
|
39
40
|
}
|
|
@@ -43,6 +44,7 @@ export interface Configuration {
|
|
|
43
44
|
collection?: string;
|
|
44
45
|
sourceRoot?: string;
|
|
45
46
|
entryFile?: string;
|
|
47
|
+
exec?: string;
|
|
46
48
|
monorepo?: boolean;
|
|
47
49
|
compilerOptions?: CompilerOptions;
|
|
48
50
|
generateOptions?: GenerateOptions;
|
|
@@ -92,6 +92,11 @@ NestCollection.schematics = [
|
|
|
92
92
|
alias: 'itf',
|
|
93
93
|
description: 'Generate an interface',
|
|
94
94
|
},
|
|
95
|
+
{
|
|
96
|
+
name: 'library',
|
|
97
|
+
alias: 'lib',
|
|
98
|
+
description: 'Generate a new library within a monorepo',
|
|
99
|
+
},
|
|
95
100
|
{
|
|
96
101
|
name: 'middleware',
|
|
97
102
|
alias: 'mi',
|
|
@@ -117,24 +122,19 @@ NestCollection.schematics = [
|
|
|
117
122
|
alias: 'r',
|
|
118
123
|
description: 'Generate a GraphQL resolver declaration',
|
|
119
124
|
},
|
|
125
|
+
{
|
|
126
|
+
name: 'resource',
|
|
127
|
+
alias: 'res',
|
|
128
|
+
description: 'Generate a new CRUD resource',
|
|
129
|
+
},
|
|
120
130
|
{
|
|
121
131
|
name: 'service',
|
|
122
132
|
alias: 's',
|
|
123
133
|
description: 'Generate a service declaration',
|
|
124
134
|
},
|
|
125
|
-
{
|
|
126
|
-
name: 'library',
|
|
127
|
-
alias: 'lib',
|
|
128
|
-
description: 'Generate a new library within a monorepo',
|
|
129
|
-
},
|
|
130
135
|
{
|
|
131
136
|
name: 'sub-app',
|
|
132
137
|
alias: 'app',
|
|
133
138
|
description: 'Generate a new application within a monorepo',
|
|
134
139
|
},
|
|
135
|
-
{
|
|
136
|
-
name: 'resource',
|
|
137
|
-
alias: 'res',
|
|
138
|
-
description: 'Generate a new CRUD resource',
|
|
139
|
-
},
|
|
140
140
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/cli",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.4.0",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@cli)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -38,58 +38,52 @@
|
|
|
38
38
|
},
|
|
39
39
|
"homepage": "https://github.com/nestjs/nest-cli#readme",
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@angular-devkit/core": "15.
|
|
42
|
-
"@angular-devkit/schematics": "15.
|
|
43
|
-
"@angular-devkit/schematics-cli": "15.
|
|
44
|
-
"@nestjs/schematics": "^9.0.
|
|
45
|
-
"chalk": "
|
|
41
|
+
"@angular-devkit/core": "15.2.6",
|
|
42
|
+
"@angular-devkit/schematics": "15.2.6",
|
|
43
|
+
"@angular-devkit/schematics-cli": "15.2.6",
|
|
44
|
+
"@nestjs/schematics": "^9.0.4",
|
|
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": "
|
|
50
|
-
"inquirer": "
|
|
49
|
+
"fork-ts-checker-webpack-plugin": "8.0.0",
|
|
50
|
+
"inquirer": "8.2.5",
|
|
51
51
|
"node-emoji": "1.11.0",
|
|
52
52
|
"ora": "5.4.1",
|
|
53
53
|
"os-name": "4.0.1",
|
|
54
|
-
"rimraf": "4.1
|
|
54
|
+
"rimraf": "4.4.1",
|
|
55
55
|
"shelljs": "0.8.5",
|
|
56
56
|
"source-map-support": "0.5.21",
|
|
57
57
|
"tree-kill": "1.2.2",
|
|
58
|
-
"tsconfig-paths": "4.
|
|
59
|
-
"tsconfig-paths-webpack-plugin": "4.0.
|
|
58
|
+
"tsconfig-paths": "4.2.0",
|
|
59
|
+
"tsconfig-paths-webpack-plugin": "4.0.1",
|
|
60
60
|
"typescript": "4.9.5",
|
|
61
|
-
"webpack": "5.
|
|
61
|
+
"webpack": "5.79.0",
|
|
62
62
|
"webpack-node-externals": "3.0.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@commitlint/cli": "17.
|
|
66
|
-
"@commitlint/config-angular": "17.4.
|
|
67
|
-
"@types/
|
|
68
|
-
"@types/
|
|
69
|
-
"@types/
|
|
70
|
-
"@types/node": "18.11.18",
|
|
65
|
+
"@commitlint/cli": "17.5.1",
|
|
66
|
+
"@commitlint/config-angular": "17.4.4",
|
|
67
|
+
"@types/inquirer": "8.2.6",
|
|
68
|
+
"@types/jest": "29.5.0",
|
|
69
|
+
"@types/node": "18.15.11",
|
|
71
70
|
"@types/node-emoji": "1.8.2",
|
|
72
|
-
"@types/
|
|
73
|
-
"@types/
|
|
74
|
-
"@
|
|
75
|
-
"@
|
|
76
|
-
"@types/webpack-node-externals": "2.5.3",
|
|
77
|
-
"@typescript-eslint/eslint-plugin": "5.50.0",
|
|
78
|
-
"@typescript-eslint/parser": "5.50.0",
|
|
71
|
+
"@types/shelljs": "0.8.12",
|
|
72
|
+
"@types/webpack-node-externals": "3.0.0",
|
|
73
|
+
"@typescript-eslint/eslint-plugin": "5.58.0",
|
|
74
|
+
"@typescript-eslint/parser": "5.58.0",
|
|
79
75
|
"delete-empty": "3.0.0",
|
|
80
|
-
"eslint": "8.
|
|
81
|
-
"eslint-config-prettier": "8.
|
|
82
|
-
"eslint-plugin-import": "2.27.5",
|
|
76
|
+
"eslint": "8.38.0",
|
|
77
|
+
"eslint-config-prettier": "8.8.0",
|
|
83
78
|
"gulp": "4.0.2",
|
|
84
79
|
"gulp-clean": "0.4.0",
|
|
85
80
|
"husky": "8.0.3",
|
|
86
|
-
"jest": "29.
|
|
87
|
-
"lint-staged": "13.1
|
|
88
|
-
"prettier": "2.8.
|
|
89
|
-
"release-it": "15.
|
|
90
|
-
"ts-jest": "29.0
|
|
91
|
-
"ts-loader": "9.4.2"
|
|
92
|
-
"ts-node": "10.9.1"
|
|
81
|
+
"jest": "29.5.0",
|
|
82
|
+
"lint-staged": "13.2.1",
|
|
83
|
+
"prettier": "2.8.7",
|
|
84
|
+
"release-it": "15.10.1",
|
|
85
|
+
"ts-jest": "29.1.0",
|
|
86
|
+
"ts-loader": "9.4.2"
|
|
93
87
|
},
|
|
94
88
|
"lint-staged": {
|
|
95
89
|
"**/*.{ts,json}": []
|