@nestjs/cli 10.3.2 → 10.4.0-next.1
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.d.ts +0 -2
- package/actions/build.action.js +2 -3
- package/lib/compiler/assets-manager.js +12 -15
- package/lib/compiler/helpers/delete-out-dir.d.ts +2 -0
- package/lib/compiler/helpers/delete-out-dir.js +13 -0
- package/lib/configuration/nest-configuration.loader.js +2 -2
- package/lib/readers/file-system.reader.d.ts +2 -2
- package/lib/readers/file-system.reader.js +1 -1
- package/lib/readers/reader.d.ts +2 -2
- package/lib/readers/reader.js +3 -3
- package/package.json +21 -24
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:22.3
|
|
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:22.3
|
|
47
47
|
steps:
|
|
48
48
|
- checkout
|
|
49
49
|
- *restore-cache
|
|
@@ -3,7 +3,6 @@ import { AssetsManager } from '../lib/compiler/assets-manager';
|
|
|
3
3
|
import { TsConfigProvider } from '../lib/compiler/helpers/tsconfig-provider';
|
|
4
4
|
import { PluginsLoader } from '../lib/compiler/plugins/plugins-loader';
|
|
5
5
|
import { TypeScriptBinaryLoader } from '../lib/compiler/typescript-loader';
|
|
6
|
-
import { WorkspaceUtils } from '../lib/compiler/workspace-utils';
|
|
7
6
|
import { ConfigurationLoader } from '../lib/configuration';
|
|
8
7
|
import { FileSystemReader } from '../lib/readers';
|
|
9
8
|
import { AbstractAction } from './abstract.action';
|
|
@@ -14,7 +13,6 @@ export declare class BuildAction extends AbstractAction {
|
|
|
14
13
|
protected readonly fileSystemReader: FileSystemReader;
|
|
15
14
|
protected readonly loader: ConfigurationLoader;
|
|
16
15
|
protected readonly assetsManager: AssetsManager;
|
|
17
|
-
protected readonly workspaceUtils: WorkspaceUtils;
|
|
18
16
|
handle(commandInputs: Input[], commandOptions: Input[]): Promise<void>;
|
|
19
17
|
runBuild(commandInputs: Input[], commandOptions: Input[], watchMode: boolean, watchAssetsMode: boolean, isDebugEnabled?: boolean, onSuccess?: () => void): Promise<void>;
|
|
20
18
|
private runSwc;
|
package/actions/build.action.js
CHANGED
|
@@ -11,7 +11,7 @@ const get_webpack_config_path_1 = require("../lib/compiler/helpers/get-webpack-c
|
|
|
11
11
|
const tsconfig_provider_1 = require("../lib/compiler/helpers/tsconfig-provider");
|
|
12
12
|
const plugins_loader_1 = require("../lib/compiler/plugins/plugins-loader");
|
|
13
13
|
const typescript_loader_1 = require("../lib/compiler/typescript-loader");
|
|
14
|
-
const
|
|
14
|
+
const delete_out_dir_1 = require("../lib/compiler/helpers/delete-out-dir");
|
|
15
15
|
const configuration_1 = require("../lib/configuration");
|
|
16
16
|
const defaults_1 = require("../lib/configuration/defaults");
|
|
17
17
|
const readers_1 = require("../lib/readers");
|
|
@@ -26,7 +26,6 @@ class BuildAction extends abstract_action_1.AbstractAction {
|
|
|
26
26
|
this.fileSystemReader = new readers_1.FileSystemReader(process.cwd());
|
|
27
27
|
this.loader = new configuration_1.NestConfigurationLoader(this.fileSystemReader);
|
|
28
28
|
this.assetsManager = new assets_manager_1.AssetsManager();
|
|
29
|
-
this.workspaceUtils = new workspace_utils_1.WorkspaceUtils();
|
|
30
29
|
}
|
|
31
30
|
async handle(commandInputs, commandOptions) {
|
|
32
31
|
try {
|
|
@@ -58,7 +57,7 @@ class BuildAction extends abstract_action_1.AbstractAction {
|
|
|
58
57
|
const builder = isWebpackEnabled
|
|
59
58
|
? { type: 'webpack' }
|
|
60
59
|
: (0, get_builder_1.getBuilder)(configuration, commandOptions, appName);
|
|
61
|
-
await
|
|
60
|
+
await (0, delete_out_dir_1.deleteOutDirIfEnabled)(configuration, appName, outDir);
|
|
62
61
|
this.assetsManager.copyAssets(configuration, appName, outDir, watchAssetsMode);
|
|
63
62
|
switch (builder.type) {
|
|
64
63
|
case 'tsc':
|
|
@@ -5,7 +5,6 @@ const chokidar = require("chokidar");
|
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
6
|
const glob_1 = require("glob");
|
|
7
7
|
const path_1 = require("path");
|
|
8
|
-
const shell = require("shelljs");
|
|
9
8
|
const copy_path_resolve_1 = require("./helpers/copy-path-resolve");
|
|
10
9
|
const get_value_or_default_1 = require("./helpers/get-value-or-default");
|
|
11
10
|
class AssetsManager {
|
|
@@ -43,18 +42,16 @@ class AssetsManager {
|
|
|
43
42
|
let sourceRoot = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'sourceRoot', appName);
|
|
44
43
|
sourceRoot = (0, path_1.join)(process.cwd(), sourceRoot);
|
|
45
44
|
const filesToCopy = assets.map((item) => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
};
|
|
51
|
-
}
|
|
45
|
+
let includePath = typeof item === 'string' ? item : item.include;
|
|
46
|
+
let excludePath = typeof item !== 'string' && item.exclude ? item.exclude : undefined;
|
|
47
|
+
includePath = (0, path_1.join)(sourceRoot, includePath).replace(/\\/g, '/');
|
|
48
|
+
excludePath = excludePath ? (0, path_1.join)(sourceRoot, excludePath).replace(/\\/g, '/') : undefined;
|
|
52
49
|
return {
|
|
53
|
-
outDir: item.outDir || outDir,
|
|
54
|
-
glob:
|
|
55
|
-
exclude:
|
|
56
|
-
flat: item.flat, // deprecated field
|
|
57
|
-
watchAssets: item.watchAssets,
|
|
50
|
+
outDir: typeof item !== 'string' ? item.outDir || outDir : outDir,
|
|
51
|
+
glob: includePath,
|
|
52
|
+
exclude: excludePath,
|
|
53
|
+
flat: typeof item !== 'string' ? item.flat : undefined, // deprecated field
|
|
54
|
+
watchAssets: typeof item !== 'string' ? item.watchAssets : undefined,
|
|
58
55
|
};
|
|
59
56
|
});
|
|
60
57
|
const isWatchEnabled = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'compilerOptions.watchAssets', appName) || watchAssetsMode;
|
|
@@ -101,12 +98,12 @@ class AssetsManager {
|
|
|
101
98
|
const dest = (0, copy_path_resolve_1.copyPathResolve)(path, item.outDir, sourceRoot.split(path_1.sep).length);
|
|
102
99
|
// Copy to output dir if file is changed or added
|
|
103
100
|
if (action === 'change') {
|
|
104
|
-
|
|
105
|
-
|
|
101
|
+
(0, fs_1.mkdirSync)((0, path_1.dirname)(dest), { recursive: true });
|
|
102
|
+
(0, fs_1.copyFileSync)(path, dest);
|
|
106
103
|
}
|
|
107
104
|
else if (action === 'unlink') {
|
|
108
105
|
// Remove from output dir if file is deleted
|
|
109
|
-
|
|
106
|
+
(0, fs_1.rmSync)(dest, { force: true });
|
|
110
107
|
}
|
|
111
108
|
}
|
|
112
109
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deleteOutDirIfEnabled = void 0;
|
|
4
|
+
const promises_1 = require("fs/promises");
|
|
5
|
+
const get_value_or_default_1 = require("./get-value-or-default");
|
|
6
|
+
async function deleteOutDirIfEnabled(configuration, appName, dirPath) {
|
|
7
|
+
const isDeleteEnabled = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'compilerOptions.deleteOutDir', appName);
|
|
8
|
+
if (!isDeleteEnabled) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
await (0, promises_1.rm)(dirPath, { recursive: true, force: true });
|
|
12
|
+
}
|
|
13
|
+
exports.deleteOutDirIfEnabled = deleteOutDirIfEnabled;
|
|
@@ -30,8 +30,8 @@ class NestConfigurationLoader {
|
|
|
30
30
|
'nest.json',
|
|
31
31
|
]);
|
|
32
32
|
if (contentOrError) {
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
33
|
+
const isMissingPermissionsError = contentOrError instanceof readers_1.ReaderFileLackPermissionsError;
|
|
34
|
+
if (isMissingPermissionsError) {
|
|
35
35
|
console.error(contentOrError.message);
|
|
36
36
|
process.exit(1);
|
|
37
37
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Reader,
|
|
1
|
+
import { Reader, ReaderFileLackPermissionsError } from './reader';
|
|
2
2
|
export declare class FileSystemReader implements Reader {
|
|
3
3
|
private readonly directory;
|
|
4
4
|
constructor(directory: string);
|
|
5
5
|
list(): string[];
|
|
6
6
|
read(name: string): string;
|
|
7
|
-
readAnyOf(filenames: string[]): string | undefined |
|
|
7
|
+
readAnyOf(filenames: string[]): string | undefined | ReaderFileLackPermissionsError;
|
|
8
8
|
}
|
|
@@ -34,7 +34,7 @@ class FileSystemReader {
|
|
|
34
34
|
continue;
|
|
35
35
|
}
|
|
36
36
|
if (firstFilePathFoundButWithInsufficientPermissions) {
|
|
37
|
-
return new reader_1.
|
|
37
|
+
return new reader_1.ReaderFileLackPermissionsError(firstFilePathFoundButWithInsufficientPermissions, readErr.code);
|
|
38
38
|
}
|
|
39
39
|
else {
|
|
40
40
|
return undefined;
|
package/lib/readers/reader.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare class
|
|
1
|
+
export declare class ReaderFileLackPermissionsError extends Error {
|
|
2
2
|
readonly filePath: string;
|
|
3
3
|
readonly fsErrorCode: string;
|
|
4
4
|
constructor(filePath: string, fsErrorCode: string);
|
|
@@ -6,5 +6,5 @@ export declare class ReaderFileLackPersmissionsError extends Error {
|
|
|
6
6
|
export interface Reader {
|
|
7
7
|
list(): string[];
|
|
8
8
|
read(name: string): string;
|
|
9
|
-
readAnyOf(filenames: string[]): string | undefined |
|
|
9
|
+
readAnyOf(filenames: string[]): string | undefined | ReaderFileLackPermissionsError;
|
|
10
10
|
}
|
package/lib/readers/reader.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
class
|
|
3
|
+
exports.ReaderFileLackPermissionsError = void 0;
|
|
4
|
+
class ReaderFileLackPermissionsError extends Error {
|
|
5
5
|
constructor(filePath, fsErrorCode) {
|
|
6
6
|
super(`File ${filePath} lacks read permissions!`);
|
|
7
7
|
this.filePath = filePath;
|
|
8
8
|
this.fsErrorCode = fsErrorCode;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
exports.
|
|
11
|
+
exports.ReaderFileLackPermissionsError = ReaderFileLackPermissionsError;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/cli",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.4.0-next.1",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@cli)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -38,53 +38,50 @@
|
|
|
38
38
|
},
|
|
39
39
|
"homepage": "https://github.com/nestjs/nest-cli#readme",
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@angular-devkit/core": "17.
|
|
42
|
-
"@angular-devkit/schematics": "17.
|
|
43
|
-
"@angular-devkit/schematics-cli": "17.
|
|
41
|
+
"@angular-devkit/core": "17.3.8",
|
|
42
|
+
"@angular-devkit/schematics": "17.3.8",
|
|
43
|
+
"@angular-devkit/schematics-cli": "17.3.8",
|
|
44
44
|
"@nestjs/schematics": "^10.0.1",
|
|
45
45
|
"chalk": "4.1.2",
|
|
46
46
|
"chokidar": "3.6.0",
|
|
47
|
-
"cli-table3": "0.6.
|
|
47
|
+
"cli-table3": "0.6.5",
|
|
48
48
|
"commander": "4.1.1",
|
|
49
49
|
"fork-ts-checker-webpack-plugin": "9.0.2",
|
|
50
|
-
"glob": "10.
|
|
50
|
+
"glob": "10.4.2",
|
|
51
51
|
"inquirer": "8.2.6",
|
|
52
52
|
"node-emoji": "1.11.0",
|
|
53
53
|
"ora": "5.4.1",
|
|
54
|
-
"rimraf": "4.4.1",
|
|
55
|
-
"shelljs": "0.8.5",
|
|
56
54
|
"source-map-support": "0.5.21",
|
|
57
55
|
"tree-kill": "1.2.2",
|
|
58
56
|
"tsconfig-paths": "4.2.0",
|
|
59
57
|
"tsconfig-paths-webpack-plugin": "4.1.0",
|
|
60
58
|
"typescript": "5.3.3",
|
|
61
|
-
"webpack": "5.
|
|
59
|
+
"webpack": "5.92.1",
|
|
62
60
|
"webpack-node-externals": "3.0.0"
|
|
63
61
|
},
|
|
64
62
|
"devDependencies": {
|
|
65
|
-
"@commitlint/cli": "
|
|
66
|
-
"@commitlint/config-angular": "
|
|
67
|
-
"@swc/cli": "0.3.
|
|
68
|
-
"@swc/core": "1.
|
|
63
|
+
"@commitlint/cli": "19.3.0",
|
|
64
|
+
"@commitlint/config-angular": "19.3.0",
|
|
65
|
+
"@swc/cli": "0.3.12",
|
|
66
|
+
"@swc/core": "1.5.7",
|
|
69
67
|
"@types/inquirer": "9.0.3",
|
|
70
68
|
"@types/jest": "29.5.12",
|
|
71
|
-
"@types/node": "20.
|
|
69
|
+
"@types/node": "20.14.9",
|
|
72
70
|
"@types/node-emoji": "1.8.2",
|
|
73
|
-
"@types/shelljs": "0.8.15",
|
|
74
71
|
"@types/webpack-node-externals": "3.0.4",
|
|
75
|
-
"@typescript-eslint/eslint-plugin": "
|
|
76
|
-
"@typescript-eslint/parser": "
|
|
72
|
+
"@typescript-eslint/eslint-plugin": "7.10.0",
|
|
73
|
+
"@typescript-eslint/parser": "7.10.0",
|
|
77
74
|
"delete-empty": "3.0.0",
|
|
78
|
-
"eslint": "8.
|
|
75
|
+
"eslint": "8.57.0",
|
|
79
76
|
"eslint-config-prettier": "9.1.0",
|
|
80
|
-
"gulp": "
|
|
77
|
+
"gulp": "5.0.0",
|
|
81
78
|
"gulp-clean": "0.4.0",
|
|
82
|
-
"husky": "9.0.
|
|
79
|
+
"husky": "9.0.11",
|
|
83
80
|
"jest": "29.7.0",
|
|
84
|
-
"lint-staged": "15.2.
|
|
85
|
-
"prettier": "3.2
|
|
86
|
-
"release-it": "17.0
|
|
87
|
-
"ts-jest": "29.1.
|
|
81
|
+
"lint-staged": "15.2.7",
|
|
82
|
+
"prettier": "3.3.2",
|
|
83
|
+
"release-it": "17.3.0",
|
|
84
|
+
"ts-jest": "29.1.5",
|
|
88
85
|
"ts-loader": "9.5.1"
|
|
89
86
|
},
|
|
90
87
|
"lint-staged": {
|