nx 19.8.14 → 19.8.15

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/bin/nx.js CHANGED
@@ -17,6 +17,7 @@ const perf_hooks_1 = require("perf_hooks");
17
17
  const workspace_context_1 = require("../src/utils/workspace-context");
18
18
  const client_1 = require("../src/daemon/client/client");
19
19
  const db_connection_1 = require("../src/utils/db-connection");
20
+ const exit_codes_1 = require("../src/utils/exit-codes");
20
21
  function main() {
21
22
  if (process.argv[2] !== 'report' &&
22
23
  process.argv[2] !== '--version' &&
@@ -224,11 +225,25 @@ const getLatestVersionOfNx = ((fn) => {
224
225
  let cache = null;
225
226
  return () => cache || (cache = fn());
226
227
  })(_getLatestVersionOfNx);
227
- function nxCleanup() {
228
+ function nxCleanup(signal) {
228
229
  (0, db_connection_1.removeDbConnections)();
230
+ if (signal) {
231
+ process.exit((0, exit_codes_1.signalToCode)(signal));
232
+ }
233
+ else {
234
+ process.exit();
235
+ }
229
236
  }
230
- process.on('exit', nxCleanup);
231
- process.on('SIGINT', nxCleanup);
232
- process.on('SIGTERM', nxCleanup);
233
- process.on('SIGHUP', nxCleanup);
237
+ process.on('exit', () => {
238
+ nxCleanup();
239
+ });
240
+ process.on('SIGINT', () => {
241
+ nxCleanup('SIGINT');
242
+ });
243
+ process.on('SIGTERM', () => {
244
+ nxCleanup('SIGTERM');
245
+ });
246
+ process.on('SIGHUP', () => {
247
+ nxCleanup('SIGHUP');
248
+ });
234
249
  main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "19.8.14",
3
+ "version": "19.8.15",
4
4
  "private": false,
5
5
  "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
6
6
  "repository": {
@@ -67,7 +67,7 @@
67
67
  "yargs-parser": "21.1.1",
68
68
  "node-machine-id": "1.1.12",
69
69
  "ora": "5.3.0",
70
- "@nrwl/tao": "19.8.14"
70
+ "@nrwl/tao": "19.8.15"
71
71
  },
72
72
  "peerDependencies": {
73
73
  "@swc-node/register": "^1.8.0",
@@ -82,16 +82,16 @@
82
82
  }
83
83
  },
84
84
  "optionalDependencies": {
85
- "@nx/nx-darwin-x64": "19.8.14",
86
- "@nx/nx-darwin-arm64": "19.8.14",
87
- "@nx/nx-linux-x64-gnu": "19.8.14",
88
- "@nx/nx-linux-x64-musl": "19.8.14",
89
- "@nx/nx-win32-x64-msvc": "19.8.14",
90
- "@nx/nx-linux-arm64-gnu": "19.8.14",
91
- "@nx/nx-linux-arm64-musl": "19.8.14",
92
- "@nx/nx-linux-arm-gnueabihf": "19.8.14",
93
- "@nx/nx-win32-arm64-msvc": "19.8.14",
94
- "@nx/nx-freebsd-x64": "19.8.14"
85
+ "@nx/nx-darwin-x64": "19.8.15",
86
+ "@nx/nx-darwin-arm64": "19.8.15",
87
+ "@nx/nx-linux-x64-gnu": "19.8.15",
88
+ "@nx/nx-linux-x64-musl": "19.8.15",
89
+ "@nx/nx-win32-x64-msvc": "19.8.15",
90
+ "@nx/nx-linux-arm64-gnu": "19.8.15",
91
+ "@nx/nx-linux-arm64-musl": "19.8.15",
92
+ "@nx/nx-linux-arm-gnueabihf": "19.8.15",
93
+ "@nx/nx-win32-arm64-msvc": "19.8.15",
94
+ "@nx/nx-freebsd-x64": "19.8.15"
95
95
  },
96
96
  "nx-migrations": {
97
97
  "migrations": "./migrations.json",
@@ -181,8 +181,8 @@ async function handleResult(socket, type, hrFn) {
181
181
  logger_1.serverLogger.log(`Handled ${type}. Handling time: ${doneHandlingMark.getTime() - startMark.getTime()}. Response time: ${endMark.getTime() - doneHandlingMark.getTime()}.`);
182
182
  }
183
183
  function handleInactivityTimeout() {
184
- if (numberOfOpenConnections > 0) {
185
- logger_1.serverLogger.log(`There are ${numberOfOpenConnections} open connections. Reset inactivity timer.`);
184
+ if ((0, file_watcher_sockets_1.hasRegisteredFileWatcherSockets)()) {
185
+ logger_1.serverLogger.log(`There are open file watchers. Resetting inactivity timer.`);
186
186
  (0, shutdown_utils_1.resetInactivityTimeout)(handleInactivityTimeout);
187
187
  }
188
188
  else {
Binary file
@@ -18,7 +18,7 @@ class RemoteCacheV2 {
18
18
  (0, promises_1.readFile)((0, path_1.join)(cacheDirectory, hash, 'code'), 'utf-8').then((s) => +s),
19
19
  ]);
20
20
  return {
21
- outputsPath: cacheDirectory,
21
+ outputsPath: (0, path_1.join)(cacheDirectory, hash, 'outputs'),
22
22
  terminalOutput: terminalOutput ?? oldTerminalOutput,
23
23
  code,
24
24
  };
@@ -27,8 +27,26 @@ class RemoteCacheV2 {
27
27
  return null;
28
28
  }
29
29
  },
30
- store: async (hash, cacheDirectory, __, code) => {
30
+ store: async (hash, cacheDirectory, terminalOutput, code) => {
31
+ // The new db cache places the outputs directly into the cacheDirectory + hash.
32
+ // old instances of Nx Cloud expect these outputs to be in cacheDirectory + hash + outputs
33
+ // this ensures that everything that was in the cache directory is moved to the outputs directory
34
+ const cacheDir = (0, path_1.join)(cacheDirectory, hash);
35
+ const outputDir = (0, path_1.join)(cacheDir, 'outputs');
36
+ await (0, promises_1.mkdir)(outputDir, { recursive: true });
37
+ const files = await (0, promises_1.readdir)(cacheDir);
38
+ await Promise.all(files.map(async (file) => {
39
+ const filePath = (0, path_1.join)(cacheDir, file);
40
+ // we don't want to move these files to the outputs directory because they are not artifacts of the task
41
+ if (filePath === outputDir ||
42
+ file === 'code' ||
43
+ file === 'terminalOutput') {
44
+ return;
45
+ }
46
+ await (0, promises_1.rename)(filePath, (0, path_1.join)(outputDir, file));
47
+ }));
31
48
  await (0, promises_1.writeFile)((0, path_1.join)(cacheDirectory, hash, 'code'), code.toString());
49
+ await (0, promises_1.writeFile)((0, path_1.join)(cacheDirectory, hash, 'terminalOutput'), terminalOutput);
32
50
  return cache.store(hash, cacheDirectory);
33
51
  },
34
52
  };