nx 20.5.0-rc.3 → 20.5.0

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.
Binary file
@@ -86,6 +86,9 @@ function createNodeFromPackageJson(pkgJsonPath, workspaceRoot, cache, isInPackag
86
86
  ...json,
87
87
  root: projectRoot,
88
88
  isInPackageManagerWorkspaces,
89
+ // change this to bust the cache when making changes that result in different
90
+ // results for the same hash
91
+ bust: 1,
89
92
  });
90
93
  const cached = cache[hash];
91
94
  if (cached) {
@@ -126,7 +129,6 @@ function buildProjectConfigurationFromPackageJson(packageJson, workspaceRoot, pa
126
129
  let name = packageJson.name ?? (0, to_project_name_1.toProjectName)(normalizedPath);
127
130
  const projectConfiguration = {
128
131
  root: projectRoot,
129
- sourceRoot: projectRoot,
130
132
  name,
131
133
  ...packageJson.nx,
132
134
  targets: (0, package_json_1.readTargetsFromPackageJson)(packageJson, nxJson),
@@ -32,11 +32,11 @@ export declare class DbCache {
32
32
  temporaryOutputPath(task: Task): string;
33
33
  private getRemoteCache;
34
34
  private _getRemoteCache;
35
- private getS3Cache;
36
- private getSharedCache;
37
- private getGcsCache;
38
- private getAzureCache;
39
- private resolveRemoteCache;
35
+ private getPowerpackS3Cache;
36
+ private getPowerpackSharedCache;
37
+ private getPowerpackGcsCache;
38
+ private getPowerpackAzureCache;
39
+ private getPowerpackCache;
40
40
  private resolvePackage;
41
41
  private assertCacheIsValid;
42
42
  }
@@ -155,38 +155,26 @@ class DbCache {
155
155
  }
156
156
  }
157
157
  else {
158
- return ((await this.getS3Cache()) ??
159
- (await this.getSharedCache()) ??
160
- (await this.getGcsCache()) ??
161
- (await this.getAzureCache()) ??
158
+ return ((await this.getPowerpackS3Cache()) ??
159
+ (await this.getPowerpackSharedCache()) ??
160
+ (await this.getPowerpackGcsCache()) ??
161
+ (await this.getPowerpackAzureCache()) ??
162
162
  null);
163
163
  }
164
164
  }
165
- async getS3Cache() {
166
- const cache = await this.resolveRemoteCache('@nx/s3-cache');
167
- if (cache)
168
- return cache;
169
- return this.resolveRemoteCache('@nx/powerpack-s3-cache');
170
- }
171
- async getSharedCache() {
172
- const cache = await this.resolveRemoteCache('@nx/shared-fs-cache');
173
- if (cache)
174
- return cache;
175
- return this.resolveRemoteCache('@nx/powerpack-shared-fs-cache');
176
- }
177
- async getGcsCache() {
178
- const cache = await this.resolveRemoteCache('@nx/gcs-cache');
179
- if (cache)
180
- return cache;
181
- return this.resolveRemoteCache('@nx/powerpack-gcs-cache');
182
- }
183
- async getAzureCache() {
184
- const cache = await this.resolveRemoteCache('@nx/azure-cache');
185
- if (cache)
186
- return cache;
187
- return this.resolveRemoteCache('@nx/powerpack-azure-cache');
188
- }
189
- async resolveRemoteCache(pkg) {
165
+ getPowerpackS3Cache() {
166
+ return this.getPowerpackCache('@nx/powerpack-s3-cache');
167
+ }
168
+ getPowerpackSharedCache() {
169
+ return this.getPowerpackCache('@nx/powerpack-shared-fs-cache');
170
+ }
171
+ getPowerpackGcsCache() {
172
+ return this.getPowerpackCache('@nx/powerpack-gcs-cache');
173
+ }
174
+ getPowerpackAzureCache() {
175
+ return this.getPowerpackCache('@nx/powerpack-azure-cache');
176
+ }
177
+ async getPowerpackCache(pkg) {
190
178
  let getRemoteCache = null;
191
179
  try {
192
180
  getRemoteCache = (await Promise.resolve(`${this.resolvePackage(pkg)}`).then(s => require(s))).getRemoteCache;
@@ -36,7 +36,7 @@ const task_results_life_cycle_1 = require("./life-cycles/task-results-life-cycle
36
36
  const task_graph_utils_1 = require("./task-graph-utils");
37
37
  const utils_1 = require("./utils");
38
38
  const chalk = require("chalk");
39
- const nx_key_1 = require("../utils/nx-key");
39
+ const powerpack_1 = require("../utils/powerpack");
40
40
  const tasks_execution_hooks_1 = require("../project-graph/plugins/tasks-execution-hooks");
41
41
  async function getTerminalOutputLifeCycle(initiatingProject, projectNames, tasks, nxArgs, nxJson, overrides) {
42
42
  const { runnerOptions } = getRunner(nxArgs, nxJson);
@@ -141,7 +141,7 @@ async function runCommandForTasks(projectsToRun, currentProjectGraph, { nxJson }
141
141
  initiatingProject,
142
142
  });
143
143
  await renderIsDone;
144
- await (0, nx_key_1.printNxKey)();
144
+ await (0, powerpack_1.printPowerpackLicense)();
145
145
  return taskResults;
146
146
  }
147
147
  async function ensureWorkspaceIsInSyncAndGetGraphs(projectGraph, nxJson, projectNames, nxArgs, overrides, extraTargetDependencies, extraOptions) {
@@ -0,0 +1,5 @@
1
+ export declare function printPowerpackLicense(): Promise<void>;
2
+ export declare function getPowerpackLicenseInformation(): Promise<import("@nx/powerpack-license").PowerpackLicense>;
3
+ export declare class NxPowerpackNotInstalledError extends Error {
4
+ constructor(e: Error);
5
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NxPowerpackNotInstalledError = void 0;
4
+ exports.printPowerpackLicense = printPowerpackLicense;
5
+ exports.getPowerpackLicenseInformation = getPowerpackLicenseInformation;
6
+ const logger_1 = require("./logger");
7
+ const package_manager_1 = require("./package-manager");
8
+ const workspace_root_1 = require("./workspace-root");
9
+ async function printPowerpackLicense() {
10
+ try {
11
+ const { organizationName, seatCount, workspaceCount } = await getPowerpackLicenseInformation();
12
+ logger_1.logger.log(`Nx Powerpack Licensed to ${organizationName} for ${seatCount} user${seatCount > 1 ? 's' : ''} in ${workspaceCount === 9999 ? 'an unlimited number of' : workspaceCount} workspace${workspaceCount > 1 ? 's' : ''}`);
13
+ }
14
+ catch { }
15
+ }
16
+ async function getPowerpackLicenseInformation() {
17
+ try {
18
+ const { getPowerpackLicenseInformation, getPowerpackLicenseInformationAsync, } = (await Promise.resolve().then(() => require('@nx/powerpack-license')));
19
+ return (getPowerpackLicenseInformationAsync ?? getPowerpackLicenseInformation)(workspace_root_1.workspaceRoot);
20
+ }
21
+ catch (e) {
22
+ if ('code' in e && e.code === 'MODULE_NOT_FOUND') {
23
+ throw new NxPowerpackNotInstalledError(e);
24
+ }
25
+ throw e;
26
+ }
27
+ }
28
+ class NxPowerpackNotInstalledError extends Error {
29
+ constructor(e) {
30
+ super(`The "@nx/powerpack-license" package is needed to use Nx Powerpack enabled features. Please install the @nx/powerpack-license with ${(0, package_manager_1.getPackageManagerCommand)().addDev} @nx/powerpack-license`, { cause: e });
31
+ }
32
+ }
33
+ exports.NxPowerpackNotInstalledError = NxPowerpackNotInstalledError;
@@ -1,2 +0,0 @@
1
- import { ActivateKeyOptions } from './command-object';
2
- export declare function handleActivateKey(options: ActivateKeyOptions): Promise<void>;
@@ -1,6 +0,0 @@
1
- import { CommandModule } from 'yargs';
2
- export interface ActivateKeyOptions {
3
- key: string;
4
- verbose: boolean;
5
- }
6
- export declare const yargsActivateKeyCommand: CommandModule<{}, ActivateKeyOptions>;
@@ -1,5 +0,0 @@
1
- export declare function printNxKey(): Promise<void>;
2
- export declare function getNxKeyInformation(): Promise<any>;
3
- export declare class NxKeyNotInstalledError extends Error {
4
- constructor(e: Error);
5
- }
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NxKeyNotInstalledError = void 0;
4
- exports.printNxKey = printNxKey;
5
- exports.getNxKeyInformation = getNxKeyInformation;
6
- const logger_1 = require("./logger");
7
- const package_manager_1 = require("./package-manager");
8
- const workspace_root_1 = require("./workspace-root");
9
- async function printNxKey() {
10
- try {
11
- const { organizationName, seatCount, workspaceCount } = await getNxKeyInformation();
12
- logger_1.logger.log(`Nx key licensed to ${organizationName} for ${seatCount} user${seatCount > 1 ? 's' : ''} in ${workspaceCount === 9999 ? 'an unlimited number of' : workspaceCount} workspace${workspaceCount > 1 ? 's' : ''}`);
13
- }
14
- catch { }
15
- }
16
- async function getNxKeyInformation() {
17
- try {
18
- const { getPowerpackLicenseInformation, getPowerpackLicenseInformationAsync, } = (await Promise.resolve().then(() => require('@nx/powerpack-license')));
19
- return (getPowerpackLicenseInformationAsync ?? getPowerpackLicenseInformation)(workspace_root_1.workspaceRoot);
20
- }
21
- catch (e) {
22
- try {
23
- const { getNxKeyInformationAsync } = (await Promise.resolve().then(() => require('@nx/key')));
24
- return getNxKeyInformationAsync(workspace_root_1.workspaceRoot);
25
- }
26
- catch (e) {
27
- if ('code' in e && e.code === 'MODULE_NOT_FOUND') {
28
- throw new NxKeyNotInstalledError(e);
29
- }
30
- throw e;
31
- }
32
- }
33
- }
34
- class NxKeyNotInstalledError extends Error {
35
- constructor(e) {
36
- super(`The "@nx/key" package is needed to use Nx key enabled features. Please install it with ${(0, package_manager_1.getPackageManagerCommand)().addDev} @nx/key`, { cause: e });
37
- }
38
- }
39
- exports.NxKeyNotInstalledError = NxKeyNotInstalledError;