@nestjs/cli 10.3.0 → 10.3.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.
@@ -21,7 +21,7 @@ jobs:
21
21
  build:
22
22
  working_directory: ~/nest
23
23
  docker:
24
- - image: cimg/node:21.5
24
+ - image: cimg/node:21.6
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:21.5
46
+ - image: cimg/node:21.6
47
47
  steps:
48
48
  - checkout
49
49
  - *restore-cache
@@ -53,7 +53,7 @@ class AssetsManager {
53
53
  outDir: item.outDir || outDir,
54
54
  glob: (0, path_1.join)(sourceRoot, item.include),
55
55
  exclude: item.exclude ? (0, path_1.join)(sourceRoot, item.exclude) : undefined,
56
- flat: item.flat,
56
+ flat: item.flat, // deprecated field
57
57
  watchAssets: item.watchAssets,
58
58
  };
59
59
  });
@@ -76,8 +76,7 @@ class AssetsManager {
76
76
  this.watchers.push(watcher);
77
77
  }
78
78
  else {
79
- const files = (0, glob_1.sync)(item.glob, { ignore: item.exclude })
80
- .filter((matched) => (0, fs_1.statSync)(matched).isFile());
79
+ const files = (0, glob_1.sync)(item.glob, { ignore: item.exclude }).filter((matched) => (0, fs_1.statSync)(matched).isFile());
81
80
  for (const path of files) {
82
81
  this.actionOnFile({ ...option, path, action: 'change' });
83
82
  }
@@ -2,6 +2,7 @@ import * as ts from 'typescript';
2
2
  import { Configuration } from '../../configuration';
3
3
  export declare const swcDefaultsFactory: (tsOptions?: ts.CompilerOptions, configuration?: Configuration) => {
4
4
  swcOptions: {
5
+ sourceMaps: string | boolean | undefined;
5
6
  module: {
6
7
  type: string;
7
8
  };
@@ -33,6 +34,7 @@ export declare const swcDefaultsFactory: (tsOptions?: ts.CompilerOptions, config
33
34
  includeDotfiles: boolean;
34
35
  quiet: boolean;
35
36
  watch: boolean;
37
+ stripLeadingPaths: boolean;
36
38
  } | {
37
39
  swcrcPath?: string | undefined;
38
40
  outDir: string;
@@ -43,6 +45,7 @@ export declare const swcDefaultsFactory: (tsOptions?: ts.CompilerOptions, config
43
45
  includeDotfiles: boolean;
44
46
  quiet: boolean;
45
47
  watch: boolean;
48
+ stripLeadingPaths: boolean;
46
49
  } | {
47
50
  configPath?: string | undefined;
48
51
  outDir: string;
@@ -53,5 +56,6 @@ export declare const swcDefaultsFactory: (tsOptions?: ts.CompilerOptions, config
53
56
  includeDotfiles: boolean;
54
57
  quiet: boolean;
55
58
  watch: boolean;
59
+ stripLeadingPaths: boolean;
56
60
  };
57
61
  };
@@ -7,6 +7,7 @@ const swcDefaultsFactory = (tsOptions, configuration) => {
7
7
  : {};
8
8
  return {
9
9
  swcOptions: {
10
+ sourceMaps: tsOptions?.sourceMap || (tsOptions?.inlineSourceMap && 'inline'),
10
11
  module: {
11
12
  type: 'commonjs',
12
13
  },
@@ -38,6 +39,7 @@ const swcDefaultsFactory = (tsOptions, configuration) => {
38
39
  includeDotfiles: false,
39
40
  quiet: false,
40
41
  watch: false,
42
+ stripLeadingPaths: true,
41
43
  ...builderOptions,
42
44
  },
43
45
  };
@@ -3,4 +3,4 @@ export declare const defaultConfiguration: Required<Configuration>;
3
3
  export declare const defaultTsconfigFilename: string;
4
4
  export declare const defaultWebpackConfigFilename = "webpack.config.js";
5
5
  export declare const defaultOutDir = "dist";
6
- export declare const defaultGitIgnore = "# compiled output\n/dist\n/node_modules\n\n# Logs\nlogs\n*.log\nnpm-debug.log*\npnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\nlerna-debug.log*\n\n# OS\n.DS_Store\n\n# Tests\n/coverage\n/.nyc_output\n\n# IDEs and editors\n/.idea\n.project\n.classpath\n.c9/\n*.launch\n.settings/\n*.sublime-workspace\n\n# IDE - VSCode\n.vscode/*\n!.vscode/settings.json\n!.vscode/tasks.json\n!.vscode/launch.json\n!.vscode/extensions.json";
6
+ export declare const defaultGitIgnore = "# compiled output\n/dist\n/node_modules\n/build\n\n# Logs\nlogs\n*.log\nnpm-debug.log*\npnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\nlerna-debug.log*\n\n# OS\n.DS_Store\n\n# Tests\n/coverage\n/.nyc_output\n\n# IDEs and editors\n/.idea\n.project\n.classpath\n.c9/\n*.launch\n.settings/\n*.sublime-workspace\n\n# IDE - VSCode\n.vscode/*\n!.vscode/settings.json\n!.vscode/tasks.json\n!.vscode/launch.json\n!.vscode/extensions.json\n\n# dotenv environment variable files\n.env\n.env.development.local\n.env.test.local\n.env.production.local\n.env.local\n\n# temp directory\n.temp\n.tmp\n\n# Runtime data\npids\n*.pid\n*.seed\n*.pid.lock\n\n# Diagnostic reports (https://nodejs.org/api/report.html)\nreport.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json\n";
@@ -30,6 +30,7 @@ exports.defaultOutDir = 'dist';
30
30
  exports.defaultGitIgnore = `# compiled output
31
31
  /dist
32
32
  /node_modules
33
+ /build
33
34
 
34
35
  # Logs
35
36
  logs
@@ -61,4 +62,25 @@ lerna-debug.log*
61
62
  !.vscode/settings.json
62
63
  !.vscode/tasks.json
63
64
  !.vscode/launch.json
64
- !.vscode/extensions.json`;
65
+ !.vscode/extensions.json
66
+
67
+ # dotenv environment variable files
68
+ .env
69
+ .env.development.local
70
+ .env.test.local
71
+ .env.production.local
72
+ .env.local
73
+
74
+ # temp directory
75
+ .temp
76
+ .tmp
77
+
78
+ # Runtime data
79
+ pids
80
+ *.pid
81
+ *.seed
82
+ *.pid.lock
83
+
84
+ # Diagnostic reports (https://nodejs.org/api/report.html)
85
+ report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
86
+ `;
@@ -4,5 +4,5 @@ import { ConfigurationLoader } from './configuration.loader';
4
4
  export declare class NestConfigurationLoader implements ConfigurationLoader {
5
5
  private readonly reader;
6
6
  constructor(reader: Reader);
7
- load(name?: string): Promise<Required<Configuration>>;
7
+ load(name?: string): Required<Configuration>;
8
8
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NestConfigurationLoader = void 0;
4
+ const readers_1 = require("../readers");
4
5
  const defaults_1 = require("./defaults");
5
6
  /**
6
7
  * A cache table that maps some reader (by its name along with the config path)
@@ -13,23 +14,28 @@ class NestConfigurationLoader {
13
14
  constructor(reader) {
14
15
  this.reader = reader;
15
16
  }
16
- async load(name) {
17
+ load(name) {
17
18
  const cacheEntryKey = `${this.reader.constructor.name}:${name}`;
18
19
  const cachedConfig = loadedConfigsCache.get(cacheEntryKey);
19
20
  if (cachedConfig) {
20
21
  return cachedConfig;
21
22
  }
22
23
  let loadedConfig;
23
- const content = name
24
- ? await this.reader.read(name)
25
- : await this.reader.readAnyOf([
24
+ const contentOrError = name
25
+ ? this.reader.read(name)
26
+ : this.reader.readAnyOf([
26
27
  'nest-cli.json',
27
28
  '.nestcli.json',
28
29
  '.nest-cli.json',
29
30
  'nest.json',
30
31
  ]);
31
- if (content) {
32
- const fileConfig = JSON.parse(content);
32
+ if (contentOrError) {
33
+ const isMissingPersmissionsError = contentOrError instanceof readers_1.ReaderFileLackPersmissionsError;
34
+ if (isMissingPersmissionsError) {
35
+ console.error(contentOrError.message);
36
+ process.exit(1);
37
+ }
38
+ const fileConfig = JSON.parse(contentOrError);
33
39
  if (fileConfig.compilerOptions) {
34
40
  loadedConfig = {
35
41
  ...defaults_1.defaultConfiguration,
@@ -1,8 +1,8 @@
1
- import { Reader } from './reader';
1
+ import { Reader, ReaderFileLackPersmissionsError } from './reader';
2
2
  export declare class FileSystemReader implements Reader {
3
3
  private readonly directory;
4
4
  constructor(directory: string);
5
- list(): Promise<string[]>;
6
- read(name: string): Promise<string>;
7
- readAnyOf(filenames: string[]): Promise<string | undefined>;
5
+ list(): string[];
6
+ read(name: string): string;
7
+ readAnyOf(filenames: string[]): string | undefined | ReaderFileLackPersmissionsError;
8
8
  }
@@ -3,26 +3,43 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FileSystemReader = void 0;
4
4
  const fs = require("fs");
5
5
  const path = require("path");
6
+ const reader_1 = require("./reader");
6
7
  class FileSystemReader {
7
8
  constructor(directory) {
8
9
  this.directory = directory;
9
10
  }
10
11
  list() {
11
- return fs.promises.readdir(this.directory);
12
+ return fs.readdirSync(this.directory);
12
13
  }
13
14
  read(name) {
14
- return fs.promises.readFile(path.join(this.directory, name), 'utf8');
15
+ return fs.readFileSync(path.join(this.directory, name), 'utf8');
15
16
  }
16
- async readAnyOf(filenames) {
17
- try {
18
- for (const file of filenames) {
19
- return await this.read(file);
17
+ readAnyOf(filenames) {
18
+ let firstFilePathFoundButWithInsufficientPermissions;
19
+ for (let id = 0; id < filenames.length; id++) {
20
+ const file = filenames[id];
21
+ try {
22
+ return this.read(file);
23
+ }
24
+ catch (readErr) {
25
+ if (!firstFilePathFoundButWithInsufficientPermissions &&
26
+ typeof readErr?.code === 'string') {
27
+ const isInsufficientPermissionsError = readErr.code === 'EACCES' || readErr.code === 'EPERM';
28
+ if (isInsufficientPermissionsError) {
29
+ firstFilePathFoundButWithInsufficientPermissions = readErr.path;
30
+ }
31
+ }
32
+ const isLastFileToLookFor = id === filenames.length - 1;
33
+ if (!isLastFileToLookFor) {
34
+ continue;
35
+ }
36
+ if (firstFilePathFoundButWithInsufficientPermissions) {
37
+ return new reader_1.ReaderFileLackPersmissionsError(firstFilePathFoundButWithInsufficientPermissions, readErr.code);
38
+ }
39
+ else {
40
+ return undefined;
41
+ }
20
42
  }
21
- }
22
- catch (err) {
23
- return filenames.length > 0
24
- ? await this.readAnyOf(filenames.slice(1, filenames.length))
25
- : undefined;
26
43
  }
27
44
  }
28
45
  }
@@ -1,5 +1,10 @@
1
+ export declare class ReaderFileLackPersmissionsError extends Error {
2
+ readonly filePath: string;
3
+ readonly fsErrorCode: string;
4
+ constructor(filePath: string, fsErrorCode: string);
5
+ }
1
6
  export interface Reader {
2
- list(): string[] | Promise<string[]>;
3
- read(name: string): string | Promise<string>;
4
- readAnyOf(filenames: string[]): string | Promise<string | undefined>;
7
+ list(): string[];
8
+ read(name: string): string;
9
+ readAnyOf(filenames: string[]): string | undefined | ReaderFileLackPersmissionsError;
5
10
  }
@@ -1,2 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReaderFileLackPersmissionsError = void 0;
4
+ class ReaderFileLackPersmissionsError extends Error {
5
+ constructor(filePath, fsErrorCode) {
6
+ super(`File ${filePath} lacks read permissions!`);
7
+ this.filePath = filePath;
8
+ this.fsErrorCode = fsErrorCode;
9
+ }
10
+ }
11
+ exports.ReaderFileLackPersmissionsError = ReaderFileLackPersmissionsError;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/cli",
3
- "version": "10.3.0",
3
+ "version": "10.3.1",
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": "17.0.9",
42
- "@angular-devkit/schematics": "17.0.9",
43
- "@angular-devkit/schematics-cli": "17.0.9",
41
+ "@angular-devkit/core": "17.1.2",
42
+ "@angular-devkit/schematics": "17.1.2",
43
+ "@angular-devkit/schematics-cli": "17.1.2",
44
44
  "@nestjs/schematics": "^10.0.1",
45
45
  "chalk": "4.1.2",
46
46
  "chokidar": "3.5.3",
@@ -58,40 +58,40 @@
58
58
  "tsconfig-paths": "4.2.0",
59
59
  "tsconfig-paths-webpack-plugin": "4.1.0",
60
60
  "typescript": "5.3.3",
61
- "webpack": "5.89.0",
61
+ "webpack": "5.90.1",
62
62
  "webpack-node-externals": "3.0.0"
63
63
  },
64
64
  "devDependencies": {
65
- "@commitlint/cli": "18.4.4",
66
- "@commitlint/config-angular": "18.4.4",
67
- "@swc/cli": "0.1.63",
68
- "@swc/core": "1.3.102",
65
+ "@commitlint/cli": "18.6.0",
66
+ "@commitlint/config-angular": "18.6.0",
67
+ "@swc/cli": "0.3.6",
68
+ "@swc/core": "1.3.107",
69
69
  "@types/inquirer": "9.0.3",
70
- "@types/jest": "29.5.11",
71
- "@types/node": "20.10.7",
70
+ "@types/jest": "29.5.12",
71
+ "@types/node": "20.11.16",
72
72
  "@types/node-emoji": "1.8.2",
73
73
  "@types/shelljs": "0.8.15",
74
74
  "@types/webpack-node-externals": "3.0.4",
75
- "@typescript-eslint/eslint-plugin": "6.18.0",
76
- "@typescript-eslint/parser": "6.18.0",
75
+ "@typescript-eslint/eslint-plugin": "6.20.0",
76
+ "@typescript-eslint/parser": "6.20.0",
77
77
  "delete-empty": "3.0.0",
78
78
  "eslint": "8.56.0",
79
79
  "eslint-config-prettier": "9.1.0",
80
80
  "gulp": "4.0.2",
81
81
  "gulp-clean": "0.4.0",
82
- "husky": "8.0.3",
82
+ "husky": "9.0.10",
83
83
  "jest": "29.7.0",
84
- "lint-staged": "15.2.0",
85
- "prettier": "3.1.1",
86
- "release-it": "17.0.1",
87
- "ts-jest": "29.1.1",
84
+ "lint-staged": "15.2.1",
85
+ "prettier": "3.2.5",
86
+ "release-it": "17.0.3",
87
+ "ts-jest": "29.1.2",
88
88
  "ts-loader": "9.5.1"
89
89
  },
90
90
  "lint-staged": {
91
91
  "**/*.{ts,json}": []
92
92
  },
93
93
  "peerDependencies": {
94
- "@swc/cli": "^0.1.62",
94
+ "@swc/cli": "^0.1.62 || ^0.3.0",
95
95
  "@swc/core": "^1.3.62"
96
96
  },
97
97
  "peerDependenciesMeta": {