@nestjs/cli 9.1.6 → 9.1.8

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.
@@ -88,6 +88,7 @@ class BuildAction extends abstract_action_1.AbstractAction {
88
88
  }
89
89
  else {
90
90
  this.compiler.run(configuration, pathToTsconfig, appName, onSuccess);
91
+ this.assetsManager.closeWatchers();
91
92
  }
92
93
  });
93
94
  }
@@ -2,6 +2,13 @@ import { Configuration } from '../configuration';
2
2
  export declare class AssetsManager {
3
3
  private watchAssetsKeyValue;
4
4
  private watchers;
5
+ private actionInProgress;
6
+ /**
7
+ * Using on `nest build` to close file watch or the build process will not end
8
+ * Interval like process
9
+ * If no action has been taken recently close watchers
10
+ * If action has been taken recently flag and try again
11
+ */
5
12
  closeWatchers(): void;
6
13
  copyAssets(configuration: Required<Configuration>, appName: string, outDir: string, watchAssetsMode: boolean): void;
7
14
  private actionOnFile;
@@ -10,9 +10,27 @@ class AssetsManager {
10
10
  constructor() {
11
11
  this.watchAssetsKeyValue = {};
12
12
  this.watchers = [];
13
+ this.actionInProgress = false;
13
14
  }
15
+ /**
16
+ * Using on `nest build` to close file watch or the build process will not end
17
+ * Interval like process
18
+ * If no action has been taken recently close watchers
19
+ * If action has been taken recently flag and try again
20
+ */
14
21
  closeWatchers() {
15
- this.watchers.forEach((watcher) => watcher.close());
22
+ // Consider adjusting this for larger files
23
+ const timeoutMs = 500;
24
+ const closeFn = () => {
25
+ if (this.actionInProgress) {
26
+ this.actionInProgress = false;
27
+ setTimeout(closeFn, timeoutMs);
28
+ }
29
+ else {
30
+ this.watchers.forEach((watcher) => watcher.close());
31
+ }
32
+ };
33
+ setTimeout(closeFn, timeoutMs);
16
34
  }
17
35
  copyAssets(configuration, appName, outDir, watchAssetsMode) {
18
36
  const assets = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'compilerOptions.assets', appName) || [];
@@ -52,9 +70,6 @@ class AssetsManager {
52
70
  .on('add', (path) => this.actionOnFile(Object.assign(Object.assign({}, option), { path, action: 'change' })))
53
71
  .on('change', (path) => this.actionOnFile(Object.assign(Object.assign({}, option), { path, action: 'change' })))
54
72
  .on('unlink', (path) => this.actionOnFile(Object.assign(Object.assign({}, option), { path, action: 'unlink' })));
55
- if (!isWatchEnabled) {
56
- watcher.on('ready', () => watcher.close());
57
- }
58
73
  this.watchers.push(watcher);
59
74
  }
60
75
  }
@@ -71,6 +86,8 @@ class AssetsManager {
71
86
  }
72
87
  // Set path value to true for watching the first time
73
88
  this.watchAssetsKeyValue[path] = true;
89
+ // Set action to true to avoid watches getting cutoff
90
+ this.actionInProgress = true;
74
91
  const dest = (0, copy_path_resolve_1.copyPathResolve)(path, item.outDir, sourceRoot.split(path_1.sep).length);
75
92
  // Copy to output dir if file is changed or added
76
93
  if (action === 'change') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/cli",
3
- "version": "9.1.6",
3
+ "version": "9.1.8",
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": "14.2.10",
42
- "@angular-devkit/schematics": "14.2.10",
43
- "@angular-devkit/schematics-cli": "14.2.10",
41
+ "@angular-devkit/core": "15.0.4",
42
+ "@angular-devkit/schematics": "15.0.4",
43
+ "@angular-devkit/schematics-cli": "15.0.4",
44
44
  "@nestjs/schematics": "^9.0.0",
45
45
  "chalk": "3.0.0",
46
46
  "chokidar": "3.5.3",
@@ -57,7 +57,7 @@
57
57
  "tree-kill": "1.2.2",
58
58
  "tsconfig-paths": "4.1.1",
59
59
  "tsconfig-paths-webpack-plugin": "4.0.0",
60
- "typescript": "4.8.4",
60
+ "typescript": "4.9.4",
61
61
  "webpack": "5.75.0",
62
62
  "webpack-node-externals": "3.0.0"
63
63
  },
@@ -74,8 +74,8 @@
74
74
  "@types/rimraf": "3.0.2",
75
75
  "@types/shelljs": "0.8.11",
76
76
  "@types/webpack-node-externals": "2.5.3",
77
- "@typescript-eslint/eslint-plugin": "5.42.1",
78
- "@typescript-eslint/parser": "5.42.1",
77
+ "@typescript-eslint/eslint-plugin": "5.47.1",
78
+ "@typescript-eslint/parser": "5.47.1",
79
79
  "delete-empty": "3.0.0",
80
80
  "eslint": "8.30.0",
81
81
  "eslint-config-prettier": "8.5.0",
@@ -84,9 +84,9 @@
84
84
  "gulp-clean": "0.4.0",
85
85
  "husky": "8.0.2",
86
86
  "jest": "29.3.1",
87
- "lint-staged": "13.0.3",
88
- "prettier": "2.7.1",
89
- "release-it": "15.5.1",
87
+ "lint-staged": "13.1.0",
88
+ "prettier": "2.8.1",
89
+ "release-it": "15.6.0",
90
90
  "ts-jest": "29.0.3",
91
91
  "ts-loader": "9.4.2",
92
92
  "ts-node": "10.9.1"