@nestjs/cli 9.4.1 → 9.5.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/actions/build.action.js +1 -1
- package/actions/new.action.js +1 -2
- package/lib/compiler/watch-compiler.js +10 -5
- package/lib/compiler/webpack-compiler.d.ts +2 -1
- package/lib/compiler/webpack-compiler.js +3 -3
- package/lib/configuration/configuration.d.ts +1 -0
- package/lib/configuration/defaults.js +1 -0
- package/lib/configuration/nest-configuration.loader.js +1 -1
- package/lib/package-managers/package-manager.factory.js +17 -19
- package/lib/readers/file-system.reader.js +3 -24
- package/package.json +14 -14
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:
|
|
24
|
+
- image: cimg/node:20.2
|
|
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:
|
|
46
|
+
- image: cimg/node:20.2
|
|
47
47
|
steps:
|
|
48
48
|
- checkout
|
|
49
49
|
- *restore-cache
|
package/actions/build.action.js
CHANGED
|
@@ -76,7 +76,7 @@ class BuildAction extends abstract_action_1.AbstractAction {
|
|
|
76
76
|
if (isWebpackEnabled) {
|
|
77
77
|
const webpackPath = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'compilerOptions.webpackConfigPath', appName, 'webpackPath', options);
|
|
78
78
|
const webpackConfigFactoryOrConfig = this.getWebpackConfigFactoryByPath(webpackPath, configuration.compilerOptions.webpackConfigPath);
|
|
79
|
-
return this.webpackCompiler.run(configuration, webpackConfigFactoryOrConfig, pathToTsconfig, appName, isDebugEnabled, watchMode, this.assetsManager, onSuccess);
|
|
79
|
+
return this.webpackCompiler.run(configuration, options, webpackConfigFactoryOrConfig, pathToTsconfig, appName, isDebugEnabled, watchMode, this.assetsManager, onSuccess);
|
|
80
80
|
}
|
|
81
81
|
if (watchMode) {
|
|
82
82
|
const tsCompilerOptions = {};
|
package/actions/new.action.js
CHANGED
|
@@ -15,7 +15,6 @@ const child_process_1 = require("child_process");
|
|
|
15
15
|
const fs = require("fs");
|
|
16
16
|
const inquirer = require("inquirer");
|
|
17
17
|
const path_1 = require("path");
|
|
18
|
-
const util_1 = require("util");
|
|
19
18
|
const defaults_1 = require("../lib/configuration/defaults");
|
|
20
19
|
const package_managers_1 = require("../lib/package-managers");
|
|
21
20
|
const questions_1 = require("../lib/questions/questions");
|
|
@@ -144,7 +143,7 @@ const createGitIgnoreFile = (dir, content) => {
|
|
|
144
143
|
if (fileExists(filePath)) {
|
|
145
144
|
return;
|
|
146
145
|
}
|
|
147
|
-
return
|
|
146
|
+
return fs.promises.writeFile(filePath, fileContent);
|
|
148
147
|
};
|
|
149
148
|
const printCollective = () => {
|
|
150
149
|
const dim = print('dim');
|
|
@@ -22,13 +22,16 @@ class WatchCompiler {
|
|
|
22
22
|
const origDiagnosticReporter = tsBin.createDiagnosticReporter(tsBin.sys, true);
|
|
23
23
|
const origWatchStatusReporter = tsBin.createWatchStatusReporter(tsBin.sys, true);
|
|
24
24
|
const host = tsBin.createWatchCompilerHost(configPath, Object.assign(Object.assign({}, options), tsCompilerOptions), tsBin.sys, createProgram, this.createDiagnosticReporter(origDiagnosticReporter), this.createWatchStatusChanged(origWatchStatusReporter, onSuccess));
|
|
25
|
+
const manualRestart = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'compilerOptions.manualRestart', appName);
|
|
25
26
|
const pluginsConfig = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'compilerOptions.plugins', appName);
|
|
26
27
|
const plugins = this.pluginsLoader.load(pluginsConfig);
|
|
27
28
|
const origCreateProgram = host.createProgram;
|
|
28
29
|
host.createProgram = (rootNames, options,
|
|
29
30
|
// tslint:disable-next-line:no-shadowed-variable
|
|
30
31
|
host, oldProgram) => {
|
|
31
|
-
|
|
32
|
+
if (manualRestart) {
|
|
33
|
+
(0, manual_restart_1.displayManualRestartTip)();
|
|
34
|
+
}
|
|
32
35
|
const tsconfigPathsPlugin = options
|
|
33
36
|
? (0, tsconfig_paths_hook_1.tsconfigPathsBeforeHookFactory)(options)
|
|
34
37
|
: null;
|
|
@@ -51,10 +54,12 @@ class WatchCompiler {
|
|
|
51
54
|
return program;
|
|
52
55
|
};
|
|
53
56
|
const watchProgram = tsBin.createWatchProgram(host);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
if (manualRestart) {
|
|
58
|
+
(0, manual_restart_1.listenForManualRestart)(() => {
|
|
59
|
+
watchProgram.close();
|
|
60
|
+
this.run(configuration, configFilename, appName, tsCompilerOptions, onSuccess);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
58
63
|
}
|
|
59
64
|
createDiagnosticReporter(diagnosticReporter) {
|
|
60
65
|
return function (diagnostic, ...args) {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Configuration } from '../configuration';
|
|
2
2
|
import { AssetsManager } from './assets-manager';
|
|
3
3
|
import { PluginsLoader } from './plugins-loader';
|
|
4
|
+
import { Input } from '../../commands';
|
|
4
5
|
import webpack = require('webpack');
|
|
5
6
|
type WebpackConfigFactory = (config: webpack.Configuration, webpackRef: typeof webpack) => webpack.Configuration;
|
|
6
7
|
type WebpackConfigFactoryOrConfig = WebpackConfigFactory | webpack.Configuration;
|
|
7
8
|
export declare class WebpackCompiler {
|
|
8
9
|
private readonly pluginsLoader;
|
|
9
10
|
constructor(pluginsLoader: PluginsLoader);
|
|
10
|
-
run(configuration: Required<Configuration>, webpackConfigFactoryOrConfig: WebpackConfigFactoryOrConfig | WebpackConfigFactoryOrConfig[], tsConfigPath: string, appName: string, isDebugEnabled: boolean | undefined, watchMode: boolean | undefined, assetsManager: AssetsManager, onSuccess?: () => void): void;
|
|
11
|
+
run(configuration: Required<Configuration>, options: Input[], webpackConfigFactoryOrConfig: WebpackConfigFactoryOrConfig | WebpackConfigFactoryOrConfig[], tsConfigPath: string, appName: string, isDebugEnabled: boolean | undefined, watchMode: boolean | undefined, assetsManager: AssetsManager, onSuccess?: () => void): void;
|
|
11
12
|
}
|
|
12
13
|
export {};
|
|
@@ -11,7 +11,7 @@ class WebpackCompiler {
|
|
|
11
11
|
constructor(pluginsLoader) {
|
|
12
12
|
this.pluginsLoader = pluginsLoader;
|
|
13
13
|
}
|
|
14
|
-
run(configuration, webpackConfigFactoryOrConfig, tsConfigPath, appName, isDebugEnabled = false, watchMode = false, assetsManager, onSuccess) {
|
|
14
|
+
run(configuration, options, webpackConfigFactoryOrConfig, tsConfigPath, appName, isDebugEnabled = false, watchMode = false, assetsManager, onSuccess) {
|
|
15
15
|
const cwd = process.cwd();
|
|
16
16
|
const configPath = (0, path_1.join)(cwd, tsConfigPath);
|
|
17
17
|
if (!(0, fs_1.existsSync)(configPath)) {
|
|
@@ -20,11 +20,11 @@ class WebpackCompiler {
|
|
|
20
20
|
const pluginsConfig = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'compilerOptions.plugins', appName);
|
|
21
21
|
const plugins = this.pluginsLoader.load(pluginsConfig);
|
|
22
22
|
const relativeRootPath = (0, path_1.dirname)((0, path_1.relative)(cwd, configPath));
|
|
23
|
-
const sourceRoot = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'sourceRoot', appName);
|
|
23
|
+
const sourceRoot = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'sourceRoot', appName, 'sourceRoot', options);
|
|
24
24
|
const pathToSource = (0, path_1.normalize)(sourceRoot).indexOf((0, path_1.normalize)(relativeRootPath)) >= 0
|
|
25
25
|
? (0, path_1.join)(cwd, sourceRoot)
|
|
26
26
|
: (0, path_1.join)(cwd, relativeRootPath, sourceRoot);
|
|
27
|
-
const entryFile = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'entryFile', appName);
|
|
27
|
+
const entryFile = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'entryFile', appName, 'entryFile', options);
|
|
28
28
|
const entryFileRoot = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'root', appName) || '';
|
|
29
29
|
const defaultOptions = (0, webpack_defaults_1.webpackDefaultsFactory)(pathToSource, entryFileRoot, entryFile, isDebugEnabled, tsConfigPath, plugins);
|
|
30
30
|
let compiler;
|
|
@@ -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.PackageManagerFactory = void 0;
|
|
13
|
-
const
|
|
13
|
+
const fs = require("fs");
|
|
14
14
|
const npm_package_manager_1 = require("./npm.package-manager");
|
|
15
15
|
const package_manager_1 = require("./package-manager");
|
|
16
16
|
const yarn_package_manager_1 = require("./yarn.package-manager");
|
|
@@ -30,24 +30,22 @@ class PackageManagerFactory {
|
|
|
30
30
|
}
|
|
31
31
|
static find() {
|
|
32
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
});
|
|
50
|
-
});
|
|
33
|
+
const DEFAULT_PACKAGE_MANAGER = package_manager_1.PackageManager.NPM;
|
|
34
|
+
try {
|
|
35
|
+
const files = yield fs.promises.readdir(process.cwd());
|
|
36
|
+
const hasYarnLockFile = files.includes('yarn.lock');
|
|
37
|
+
if (hasYarnLockFile) {
|
|
38
|
+
return this.create(package_manager_1.PackageManager.YARN);
|
|
39
|
+
}
|
|
40
|
+
const hasPnpmLockFile = files.includes('pnpm-lock.yaml');
|
|
41
|
+
if (hasPnpmLockFile) {
|
|
42
|
+
return this.create(package_manager_1.PackageManager.PNPM);
|
|
43
|
+
}
|
|
44
|
+
return this.create(DEFAULT_PACKAGE_MANAGER);
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
return this.create(DEFAULT_PACKAGE_MANAGER);
|
|
48
|
+
}
|
|
51
49
|
});
|
|
52
50
|
}
|
|
53
51
|
}
|
|
@@ -11,37 +11,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.FileSystemReader = void 0;
|
|
13
13
|
const fs = require("fs");
|
|
14
|
+
const path = require("path");
|
|
14
15
|
class FileSystemReader {
|
|
15
16
|
constructor(directory) {
|
|
16
17
|
this.directory = directory;
|
|
17
18
|
}
|
|
18
19
|
list() {
|
|
19
|
-
return
|
|
20
|
-
return new Promise((resolve, reject) => {
|
|
21
|
-
fs.readdir(this.directory, (error, filenames) => {
|
|
22
|
-
if (error) {
|
|
23
|
-
reject(error);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
resolve(filenames);
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
});
|
|
20
|
+
return fs.promises.readdir(this.directory);
|
|
31
21
|
}
|
|
32
22
|
read(name) {
|
|
33
|
-
return
|
|
34
|
-
return new Promise((resolve, reject) => {
|
|
35
|
-
fs.readFile(`${this.directory}/${name}`, (error, data) => {
|
|
36
|
-
if (error) {
|
|
37
|
-
reject(error);
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
resolve(data.toString());
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
});
|
|
23
|
+
return fs.promises.readFile(path.join(this.directory, name), 'utf8');
|
|
45
24
|
}
|
|
46
25
|
readAnyOf(filenames) {
|
|
47
26
|
return __awaiter(this, void 0, void 0, function* () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/cli",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.5.0",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@cli)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
},
|
|
39
39
|
"homepage": "https://github.com/nestjs/nest-cli#readme",
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@angular-devkit/core": "
|
|
42
|
-
"@angular-devkit/schematics": "
|
|
43
|
-
"@angular-devkit/schematics-cli": "
|
|
41
|
+
"@angular-devkit/core": "16.0.1",
|
|
42
|
+
"@angular-devkit/schematics": "16.0.1",
|
|
43
|
+
"@angular-devkit/schematics-cli": "16.0.1",
|
|
44
44
|
"@nestjs/schematics": "^9.0.4",
|
|
45
45
|
"chalk": "4.1.2",
|
|
46
46
|
"chokidar": "3.5.3",
|
|
@@ -58,30 +58,30 @@
|
|
|
58
58
|
"tsconfig-paths": "4.2.0",
|
|
59
59
|
"tsconfig-paths-webpack-plugin": "4.0.1",
|
|
60
60
|
"typescript": "4.9.5",
|
|
61
|
-
"webpack": "5.
|
|
61
|
+
"webpack": "5.82.1",
|
|
62
62
|
"webpack-node-externals": "3.0.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@commitlint/cli": "17.6.
|
|
66
|
-
"@commitlint/config-angular": "17.6.
|
|
65
|
+
"@commitlint/cli": "17.6.3",
|
|
66
|
+
"@commitlint/config-angular": "17.6.3",
|
|
67
67
|
"@types/inquirer": "8.2.6",
|
|
68
68
|
"@types/jest": "29.5.1",
|
|
69
|
-
"@types/node": "18.
|
|
69
|
+
"@types/node": "18.16.12",
|
|
70
70
|
"@types/node-emoji": "1.8.2",
|
|
71
71
|
"@types/shelljs": "0.8.12",
|
|
72
72
|
"@types/webpack-node-externals": "3.0.0",
|
|
73
|
-
"@typescript-eslint/eslint-plugin": "5.59.
|
|
74
|
-
"@typescript-eslint/parser": "5.59.
|
|
73
|
+
"@typescript-eslint/eslint-plugin": "5.59.6",
|
|
74
|
+
"@typescript-eslint/parser": "5.59.6",
|
|
75
75
|
"delete-empty": "3.0.0",
|
|
76
|
-
"eslint": "8.
|
|
76
|
+
"eslint": "8.40.0",
|
|
77
77
|
"eslint-config-prettier": "8.8.0",
|
|
78
78
|
"gulp": "4.0.2",
|
|
79
79
|
"gulp-clean": "0.4.0",
|
|
80
80
|
"husky": "8.0.3",
|
|
81
81
|
"jest": "29.5.0",
|
|
82
|
-
"lint-staged": "13.2.
|
|
83
|
-
"prettier": "2.8.
|
|
84
|
-
"release-it": "15.10.
|
|
82
|
+
"lint-staged": "13.2.2",
|
|
83
|
+
"prettier": "2.8.8",
|
|
84
|
+
"release-it": "15.10.3",
|
|
85
85
|
"ts-jest": "29.1.0",
|
|
86
86
|
"ts-loader": "9.4.2"
|
|
87
87
|
},
|