nx 19.7.0-beta.0 → 19.7.0-beta.1

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "19.7.0-beta.0",
3
+ "version": "19.7.0-beta.1",
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": {
@@ -71,7 +71,7 @@
71
71
  "yargs-parser": "21.1.1",
72
72
  "node-machine-id": "1.1.12",
73
73
  "ora": "5.3.0",
74
- "@nrwl/tao": "19.7.0-beta.0"
74
+ "@nrwl/tao": "19.7.0-beta.1"
75
75
  },
76
76
  "peerDependencies": {
77
77
  "@swc-node/register": "^1.8.0",
@@ -86,16 +86,16 @@
86
86
  }
87
87
  },
88
88
  "optionalDependencies": {
89
- "@nx/nx-darwin-x64": "19.7.0-beta.0",
90
- "@nx/nx-darwin-arm64": "19.7.0-beta.0",
91
- "@nx/nx-linux-x64-gnu": "19.7.0-beta.0",
92
- "@nx/nx-linux-x64-musl": "19.7.0-beta.0",
93
- "@nx/nx-win32-x64-msvc": "19.7.0-beta.0",
94
- "@nx/nx-linux-arm64-gnu": "19.7.0-beta.0",
95
- "@nx/nx-linux-arm64-musl": "19.7.0-beta.0",
96
- "@nx/nx-linux-arm-gnueabihf": "19.7.0-beta.0",
97
- "@nx/nx-win32-arm64-msvc": "19.7.0-beta.0",
98
- "@nx/nx-freebsd-x64": "19.7.0-beta.0"
89
+ "@nx/nx-darwin-x64": "19.7.0-beta.1",
90
+ "@nx/nx-darwin-arm64": "19.7.0-beta.1",
91
+ "@nx/nx-linux-x64-gnu": "19.7.0-beta.1",
92
+ "@nx/nx-linux-x64-musl": "19.7.0-beta.1",
93
+ "@nx/nx-win32-x64-msvc": "19.7.0-beta.1",
94
+ "@nx/nx-linux-arm64-gnu": "19.7.0-beta.1",
95
+ "@nx/nx-linux-arm64-musl": "19.7.0-beta.1",
96
+ "@nx/nx-linux-arm-gnueabihf": "19.7.0-beta.1",
97
+ "@nx/nx-win32-arm64-msvc": "19.7.0-beta.1",
98
+ "@nx/nx-freebsd-x64": "19.7.0-beta.1"
99
99
  },
100
100
  "nx-migrations": {
101
101
  "migrations": "./migrations.json",
Binary file
@@ -140,15 +140,20 @@ class TargetProjectLocator {
140
140
  return externalNodeName;
141
141
  }
142
142
  const version = (0, semver_1.clean)(externalPackageJson.version);
143
- const npmProjectKey = `npm:${externalPackageJson.name}@${version}`;
144
- let matchingExternalNode = this.npmProjects[npmProjectKey];
143
+ let matchingExternalNode = this.npmProjects[`npm:${externalPackageJson.name}@${version}`];
145
144
  if (!matchingExternalNode) {
146
145
  // check if it's a package alias, where the resolved package key is used as the version
147
- const aliasNpmProjectKey = `npm:${packageName}@${npmProjectKey}`;
146
+ const aliasNpmProjectKey = `npm:${packageName}@npm:${externalPackageJson.name}@${version}`;
148
147
  matchingExternalNode = this.npmProjects[aliasNpmProjectKey];
149
- if (!matchingExternalNode) {
150
- return null;
151
- }
148
+ }
149
+ if (!matchingExternalNode) {
150
+ // Fallback to package name as key. This can happen if the version in project graph is not the same as in the resolved package.json.
151
+ // e.g. Version in project graph is a git remote, but the resolved version is semver.
152
+ matchingExternalNode =
153
+ this.npmProjects[`npm:${externalPackageJson.name}`];
154
+ }
155
+ if (!matchingExternalNode) {
156
+ return null;
152
157
  }
153
158
  this.npmResolutionCache.set(npmImportForProject, matchingExternalNode.name);
154
159
  return matchingExternalNode.name;
@@ -86,7 +86,7 @@ class DbCache {
86
86
  }
87
87
  else {
88
88
  // old nx cloud instance
89
- return default_tasks_runner_1.RemoteCacheV2.fromCacheV1(this.options.nxCloudRemoteCache);
89
+ return await default_tasks_runner_1.RemoteCacheV2.fromCacheV1(this.options.nxCloudRemoteCache);
90
90
  }
91
91
  }
92
92
  else {
@@ -6,7 +6,7 @@ export interface RemoteCache {
6
6
  store: (hash: string, cacheDirectory: string) => Promise<boolean>;
7
7
  }
8
8
  export declare abstract class RemoteCacheV2 {
9
- static fromCacheV1(cache: RemoteCache): RemoteCacheV2;
9
+ static fromCacheV1(cache: RemoteCache): Promise<RemoteCacheV2>;
10
10
  abstract retrieve(hash: string, cacheDirectory: string): Promise<CachedResult | null>;
11
11
  abstract store(hash: string, cacheDirectory: string, terminalOutput: string, code: number): Promise<boolean>;
12
12
  }
@@ -2,21 +2,24 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.defaultTasksRunner = exports.RemoteCacheV2 = void 0;
4
4
  const task_orchestrator_1 = require("./task-orchestrator");
5
+ const cache_directory_1 = require("../utils/cache-directory");
5
6
  const promises_1 = require("fs/promises");
6
7
  const path_1 = require("path");
7
8
  class RemoteCacheV2 {
8
- static fromCacheV1(cache) {
9
+ static async fromCacheV1(cache) {
10
+ await (0, promises_1.mkdir)((0, path_1.join)(cache_directory_1.cacheDir, 'terminalOutputs'), { recursive: true });
9
11
  return {
10
12
  retrieve: async (hash, cacheDirectory) => {
11
- const res = cache.retrieve(hash, cacheDirectory);
12
- const [terminalOutput, code] = await Promise.all([
13
- (0, promises_1.readFile)((0, path_1.join)(cacheDirectory, hash, 'terminalOutputs'), 'utf-8'),
14
- (0, promises_1.readFile)((0, path_1.join)(cacheDirectory, hash, 'code'), 'utf-8').then((s) => +s),
15
- ]);
13
+ const res = await cache.retrieve(hash, cacheDirectory);
16
14
  if (res) {
15
+ const [terminalOutput, oldTerminalOutput, code] = await Promise.all([
16
+ (0, promises_1.readFile)((0, path_1.join)(cacheDirectory, hash, 'terminalOutputs'), 'utf-8').catch(() => null),
17
+ (0, promises_1.readFile)((0, path_1.join)(cache_directory_1.cacheDir, 'terminalOutputs', hash), 'utf-8').catch(() => null),
18
+ (0, promises_1.readFile)((0, path_1.join)(cacheDirectory, hash, 'code'), 'utf-8').then((s) => +s),
19
+ ]);
17
20
  return {
18
21
  outputsPath: cacheDirectory,
19
- terminalOutput,
22
+ terminalOutput: terminalOutput ?? oldTerminalOutput,
20
23
  code,
21
24
  };
22
25
  }