nx 20.6.2 → 20.7.0-beta.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.
package/.eslintrc.json CHANGED
@@ -131,8 +131,10 @@
131
131
  "@nx/nx-win32-arm64-msvc",
132
132
  "@nx/nx-freebsd-x64",
133
133
  "@nx/powerpack-license",
134
+ "@nx/key",
134
135
  // Powerpack plugin conditionally available dynamically at runtime
135
- "@nx/powerpack-conformance"
136
+ "@nx/powerpack-conformance",
137
+ "@nx/conformance"
136
138
  ]
137
139
  }
138
140
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "20.6.2",
3
+ "version": "20.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": {
@@ -82,16 +82,16 @@
82
82
  }
83
83
  },
84
84
  "optionalDependencies": {
85
- "@nx/nx-darwin-arm64": "20.6.2",
86
- "@nx/nx-darwin-x64": "20.6.2",
87
- "@nx/nx-freebsd-x64": "20.6.2",
88
- "@nx/nx-linux-arm-gnueabihf": "20.6.2",
89
- "@nx/nx-linux-arm64-gnu": "20.6.2",
90
- "@nx/nx-linux-arm64-musl": "20.6.2",
91
- "@nx/nx-linux-x64-gnu": "20.6.2",
92
- "@nx/nx-linux-x64-musl": "20.6.2",
93
- "@nx/nx-win32-arm64-msvc": "20.6.2",
94
- "@nx/nx-win32-x64-msvc": "20.6.2"
85
+ "@nx/nx-darwin-arm64": "20.7.0-beta.1",
86
+ "@nx/nx-darwin-x64": "20.7.0-beta.1",
87
+ "@nx/nx-freebsd-x64": "20.7.0-beta.1",
88
+ "@nx/nx-linux-arm-gnueabihf": "20.7.0-beta.1",
89
+ "@nx/nx-linux-arm64-gnu": "20.7.0-beta.1",
90
+ "@nx/nx-linux-arm64-musl": "20.7.0-beta.1",
91
+ "@nx/nx-linux-x64-gnu": "20.7.0-beta.1",
92
+ "@nx/nx-linux-x64-musl": "20.7.0-beta.1",
93
+ "@nx/nx-win32-arm64-msvc": "20.7.0-beta.1",
94
+ "@nx/nx-win32-x64-msvc": "20.7.0-beta.1"
95
95
  },
96
96
  "nx-migrations": {
97
97
  "migrations": "./migrations.json",
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.commandsObject = exports.parserConfiguration = void 0;
4
4
  const chalk = require("chalk");
5
5
  const yargs = require("yargs");
6
- const command_object_1 = require("./activate-powerpack/command-object");
6
+ const command_object_1 = require("./register/command-object");
7
7
  const command_object_2 = require("./affected/command-object");
8
8
  const command_object_3 = require("./connect/command-object");
9
9
  const command_object_4 = require("./daemon/command-object");
@@ -46,7 +46,7 @@ exports.commandsObject = yargs
46
46
  .parserConfiguration(exports.parserConfiguration)
47
47
  .usage(chalk.bold('Smart Monorepos · Fast CI'))
48
48
  .demandCommand(1, '')
49
- .command(command_object_1.yargsActivatePowerpackCommand)
49
+ .command(command_object_1.yargsRegisterCommand)
50
50
  .command(command_object_22.yargsAddCommand)
51
51
  .command(command_object_2.yargsAffectedBuildCommand)
52
52
  .command(command_object_2.yargsAffectedCommand)
@@ -99,7 +99,7 @@ function createMissingConformanceCommand(command) {
99
99
  output_1.output.error({
100
100
  title: `${command} is not available`,
101
101
  bodyLines: [
102
- `In order to use the \`nx ${command}\` command you must have an active Powerpack license and the \`@nx/powerpack-conformance\` plugin installed.`,
102
+ `In order to use the \`nx ${command}\` command you must have an active Nx key and the \`@nx/conformance\` plugin installed.`,
103
103
  '',
104
104
  'To learn more, visit https://nx.dev/nx-enterprise/powerpack/conformance',
105
105
  ],
@@ -110,7 +110,14 @@ function createMissingConformanceCommand(command) {
110
110
  }
111
111
  function resolveConformanceCommandObject() {
112
112
  try {
113
- const { yargsConformanceCommand } = require('@nx/powerpack-conformance');
113
+ const { yargsConformanceCommand } = (() => {
114
+ try {
115
+ return require('@nx/powerpack-conformance');
116
+ }
117
+ catch {
118
+ return require('@nx/conformance');
119
+ }
120
+ })();
114
121
  return yargsConformanceCommand;
115
122
  }
116
123
  catch {
@@ -119,7 +126,14 @@ function resolveConformanceCommandObject() {
119
126
  }
120
127
  function resolveConformanceCheckCommandObject() {
121
128
  try {
122
- const { yargsConformanceCheckCommand, } = require('@nx/powerpack-conformance');
129
+ const { yargsConformanceCheckCommand } = (() => {
130
+ try {
131
+ return require('@nx/powerpack-conformance');
132
+ }
133
+ catch {
134
+ return require('@nx/conformance');
135
+ }
136
+ })();
123
137
  return yargsConformanceCheckCommand;
124
138
  }
125
139
  catch {
@@ -0,0 +1,6 @@
1
+ import { CommandModule } from 'yargs';
2
+ export interface RegisterOptions {
3
+ key?: string;
4
+ verbose?: boolean;
5
+ }
6
+ export declare const yargsRegisterCommand: CommandModule<{}, RegisterOptions>;
@@ -1,25 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.yargsActivatePowerpackCommand = void 0;
3
+ exports.yargsRegisterCommand = void 0;
4
4
  const shared_options_1 = require("../yargs-utils/shared-options");
5
5
  const handle_errors_1 = require("../../utils/handle-errors");
6
- exports.yargsActivatePowerpackCommand = {
7
- command: 'activate-powerpack <license>',
6
+ exports.yargsRegisterCommand = {
7
+ command: 'register [key]',
8
+ aliases: ['activate-powerpack'],
8
9
  describe: false,
9
- // describe: 'Activate a Nx Powerpack license.',
10
10
  builder: (yargs) => (0, shared_options_1.withVerbose)(yargs)
11
11
  .parserConfiguration({
12
12
  'strip-dashed': true,
13
13
  'unknown-options-as-args': true,
14
14
  })
15
- .positional('license', {
15
+ .positional('key', {
16
16
  type: 'string',
17
- description: 'This is a License Key for Nx Powerpack.',
17
+ description: 'This is a key for Nx.',
18
18
  })
19
- .example('$0 activate-powerpack <license key>', 'Activate a Nx Powerpack license'),
19
+ .example('$0 register <key>', 'Register a Nx key'),
20
20
  handler: async (args) => {
21
- const exitCode = await (0, handle_errors_1.handleErrors)(args.verbose, async () => {
22
- return (await Promise.resolve().then(() => require('./activate-powerpack'))).handleActivatePowerpack(args);
21
+ const exitCode = await (0, handle_errors_1.handleErrors)(args.verbose ?? false, async () => {
22
+ return (await Promise.resolve().then(() => require('./register'))).handleRegister(args);
23
23
  });
24
24
  process.exit(exitCode);
25
25
  },
@@ -0,0 +1,2 @@
1
+ import { RegisterOptions } from './command-object';
2
+ export declare function handleRegister(options: RegisterOptions): Promise<import("@nx/key").NxKey>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handleRegister = handleRegister;
4
+ const workspace_root_1 = require("../../utils/workspace-root");
5
+ const enquirer_1 = require("enquirer");
6
+ const require_nx_key_1 = require("../../utils/require-nx-key");
7
+ async function handleRegister(options) {
8
+ const nxKey = await (0, require_nx_key_1.requireNxKey)();
9
+ // If a key was provided through options, activate it directly
10
+ if (options.key) {
11
+ return nxKey.activateNxKey(workspace_root_1.workspaceRoot, options.key);
12
+ }
13
+ // Try to auto-register a key
14
+ const generatedKey = await nxKey.autoRegisterNxKey(workspace_root_1.workspaceRoot);
15
+ if (generatedKey) {
16
+ return;
17
+ }
18
+ // If auto-registration was skipped, prompt for a key
19
+ const { key } = await (0, enquirer_1.prompt)({
20
+ type: 'input',
21
+ name: 'key',
22
+ message: 'Enter your key',
23
+ });
24
+ return nxKey.activateNxKey(workspace_root_1.workspaceRoot, key);
25
+ }
@@ -1,7 +1,7 @@
1
1
  import { PackageManager } from '../../utils/package-manager';
2
2
  import { PackageJson } from '../../utils/package-json';
3
3
  import { NxJsonConfiguration } from '../../config/nx-json';
4
- import type { PowerpackLicense } from '@nx/powerpack-license';
4
+ import { type NxKey } from '@nx/key';
5
5
  export declare const packagesWeCareAbout: string[];
6
6
  export declare const patternsWeIgnoreInCommunityReport: Array<string | RegExp>;
7
7
  /**
@@ -16,8 +16,8 @@ export declare function reportHandler(): Promise<void>;
16
16
  export interface ReportData {
17
17
  pm: PackageManager;
18
18
  pmVersion: string;
19
- powerpackLicense: PowerpackLicense | null;
20
- powerpackError: Error | null;
19
+ nxKey: NxKey | null;
20
+ nxKeyError: Error | null;
21
21
  powerpackPlugins: PackageJson[];
22
22
  localPlugins: string[];
23
23
  communityPlugins: PackageJson[];
@@ -21,7 +21,7 @@ const installed_plugins_1 = require("../../utils/plugins/installed-plugins");
21
21
  const installation_directory_1 = require("../../utils/installation-directory");
22
22
  const nx_json_1 = require("../../config/nx-json");
23
23
  const error_types_1 = require("../../project-graph/error-types");
24
- const powerpack_1 = require("../../utils/powerpack");
24
+ const nx_key_1 = require("../../utils/nx-key");
25
25
  const cache_1 = require("../../tasks-runner/cache");
26
26
  const native_1 = require("../../native");
27
27
  const cache_directory_1 = require("../../utils/cache-directory");
@@ -49,7 +49,7 @@ const LINE_SEPARATOR = '---------------------------------------';
49
49
  *
50
50
  */
51
51
  async function reportHandler() {
52
- const { pm, pmVersion, powerpackLicense, powerpackError, localPlugins, powerpackPlugins, communityPlugins, registeredPlugins, packageVersionsWeCareAbout, outOfSyncPackageGroup, projectGraphError, nativeTarget, cache, } = await getReportData();
52
+ const { pm, pmVersion, nxKey, nxKeyError, localPlugins, powerpackPlugins, communityPlugins, registeredPlugins, packageVersionsWeCareAbout, outOfSyncPackageGroup, projectGraphError, nativeTarget, cache, } = await getReportData();
53
53
  const fields = [
54
54
  ['Node', process.versions.node],
55
55
  ['OS', `${process.platform}-${process.arch}`],
@@ -64,29 +64,29 @@ async function reportHandler() {
64
64
  packageVersionsWeCareAbout.forEach((p) => {
65
65
  bodyLines.push(`${chalk.green(p.package.padEnd(padding))} : ${chalk.bold(p.version)}`);
66
66
  });
67
- if (powerpackLicense) {
67
+ if (nxKey) {
68
68
  bodyLines.push('');
69
69
  bodyLines.push(LINE_SEPARATOR);
70
- bodyLines.push(chalk.green('Nx Powerpack'));
71
- const licenseExpiryDate = new Date((powerpackLicense.realExpiresAt ?? powerpackLicense.expiresAt) * 1000);
72
- bodyLines.push(`Licensed to ${powerpackLicense.organizationName} for ${powerpackLicense.seatCount} user${powerpackLicense.seatCount > 1 ? 's' : ''} in ${powerpackLicense.workspaceCount === 9999
73
- ? 'an unlimited number of'
74
- : powerpackLicense.workspaceCount} workspace${powerpackLicense.workspaceCount > 1 ? 's' : ''}.`);
75
- // license is not expired
76
- if (licenseExpiryDate.getTime() >= Date.now()) {
77
- if ('perpetualNxVersion' in powerpackLicense) {
78
- bodyLines.push(`License expires on ${licenseExpiryDate.toLocaleDateString()}, but will continue to work with Nx ${powerpackLicense.perpetualNxVersion} and below.`);
79
- }
80
- else {
81
- bodyLines.push(`License expires on ${licenseExpiryDate.toLocaleDateString()}.`);
82
- }
83
- }
84
- else {
85
- if ('perpetualNxVersion' in powerpackLicense) {
86
- bodyLines.push(`License expired on ${licenseExpiryDate.toLocaleDateString()}, but will continue to work with Nx ${powerpackLicense.perpetualNxVersion} and below.`);
70
+ bodyLines.push(chalk.green('Nx key licensed packages'));
71
+ bodyLines.push((0, nx_key_1.createNxKeyLicenseeInformation)(nxKey));
72
+ if (nxKey.realExpiresAt || nxKey.expiresAt) {
73
+ const licenseExpiryDate = new Date((nxKey.realExpiresAt ?? nxKey.expiresAt) * 1000);
74
+ // license is not expired
75
+ if (licenseExpiryDate.getTime() >= Date.now()) {
76
+ if ('perpetualNxVersion' in nxKey) {
77
+ bodyLines.push(`License expires on ${licenseExpiryDate.toLocaleDateString()}, but will continue to work with Nx ${nxKey.perpetualNxVersion} and below.`);
78
+ }
79
+ else {
80
+ bodyLines.push(`License expires on ${licenseExpiryDate.toLocaleDateString()}.`);
81
+ }
87
82
  }
88
83
  else {
89
- bodyLines.push(`License expired on ${licenseExpiryDate.toLocaleDateString()}.`);
84
+ if ('perpetualNxVersion' in nxKey) {
85
+ bodyLines.push(`License expired on ${licenseExpiryDate.toLocaleDateString()}, but will continue to work with Nx ${nxKey.perpetualNxVersion} and below.`);
86
+ }
87
+ else {
88
+ bodyLines.push(`License expired on ${licenseExpiryDate.toLocaleDateString()}.`);
89
+ }
90
90
  }
91
91
  }
92
92
  bodyLines.push('');
@@ -97,11 +97,11 @@ async function reportHandler() {
97
97
  }
98
98
  bodyLines.push('');
99
99
  }
100
- else if (powerpackError) {
100
+ else if (nxKeyError) {
101
101
  bodyLines.push('');
102
- bodyLines.push(chalk.red('Nx Powerpack'));
102
+ bodyLines.push(chalk.red('Nx key'));
103
103
  bodyLines.push(LINE_SEPARATOR);
104
- bodyLines.push(powerpackError.message);
104
+ bodyLines.push(nxKeyError.message);
105
105
  bodyLines.push('');
106
106
  }
107
107
  if (registeredPlugins.length) {
@@ -172,14 +172,14 @@ async function getReportData() {
172
172
  }
173
173
  const outOfSyncPackageGroup = findMisalignedPackagesForPackage(nxPackageJson);
174
174
  const native = isNativeAvailable();
175
- let powerpackLicense = null;
176
- let powerpackError = null;
175
+ let nxKey = null;
176
+ let nxKeyError = null;
177
177
  try {
178
- powerpackLicense = await (0, powerpack_1.getPowerpackLicenseInformation)();
178
+ nxKey = await (0, nx_key_1.getNxKeyInformation)();
179
179
  }
180
180
  catch (e) {
181
- if (!(e instanceof powerpack_1.NxPowerpackNotInstalledError)) {
182
- powerpackError = e;
181
+ if (!(e instanceof nx_key_1.NxKeyNotInstalledError)) {
182
+ nxKeyError = e;
183
183
  }
184
184
  }
185
185
  let cache = (0, cache_1.dbCacheEnabled)(nxJson)
@@ -192,8 +192,8 @@ async function getReportData() {
192
192
  : null;
193
193
  return {
194
194
  pm,
195
- powerpackLicense,
196
- powerpackError,
195
+ nxKey,
196
+ nxKeyError,
197
197
  powerpackPlugins,
198
198
  pmVersion,
199
199
  localPlugins,
@@ -272,7 +272,7 @@ function findMisalignedPackagesForPackage(base) {
272
272
  }
273
273
  function findInstalledPowerpackPlugins() {
274
274
  const installedPlugins = (0, installed_plugins_1.findInstalledPlugins)();
275
- return installedPlugins.filter((dep) => new RegExp('@nx/powerpack*').test(dep.name));
275
+ return installedPlugins.filter((dep) => new RegExp('@nx/powerpack*|@nx/(.+)-cache|@nx/(conformance|owners|enterprise*)').test(dep.name));
276
276
  }
277
277
  function findInstalledCommunityPlugins() {
278
278
  const installedPlugins = (0, installed_plugins_1.findInstalledPlugins)();
Binary file
@@ -34,11 +34,11 @@ export declare class DbCache {
34
34
  temporaryOutputPath(task: Task): string;
35
35
  private getRemoteCache;
36
36
  private _getRemoteCache;
37
- private getPowerpackS3Cache;
38
- private getPowerpackSharedCache;
39
- private getPowerpackGcsCache;
40
- private getPowerpackAzureCache;
41
- private getPowerpackCache;
37
+ private getS3Cache;
38
+ private getSharedCache;
39
+ private getGcsCache;
40
+ private getAzureCache;
41
+ private resolveRemoteCache;
42
42
  private resolvePackage;
43
43
  private assertCacheIsValid;
44
44
  }
@@ -163,26 +163,38 @@ class DbCache {
163
163
  }
164
164
  }
165
165
  else {
166
- return ((await this.getPowerpackS3Cache()) ??
167
- (await this.getPowerpackSharedCache()) ??
168
- (await this.getPowerpackGcsCache()) ??
169
- (await this.getPowerpackAzureCache()) ??
166
+ return ((await this.getS3Cache()) ??
167
+ (await this.getSharedCache()) ??
168
+ (await this.getGcsCache()) ??
169
+ (await this.getAzureCache()) ??
170
170
  null);
171
171
  }
172
172
  }
173
- getPowerpackS3Cache() {
174
- return this.getPowerpackCache('@nx/powerpack-s3-cache');
175
- }
176
- getPowerpackSharedCache() {
177
- return this.getPowerpackCache('@nx/powerpack-shared-fs-cache');
178
- }
179
- getPowerpackGcsCache() {
180
- return this.getPowerpackCache('@nx/powerpack-gcs-cache');
181
- }
182
- getPowerpackAzureCache() {
183
- return this.getPowerpackCache('@nx/powerpack-azure-cache');
184
- }
185
- async getPowerpackCache(pkg) {
173
+ async getS3Cache() {
174
+ const cache = await this.resolveRemoteCache('@nx/s3-cache');
175
+ if (cache)
176
+ return cache;
177
+ return this.resolveRemoteCache('@nx/powerpack-s3-cache');
178
+ }
179
+ async getSharedCache() {
180
+ const cache = await this.resolveRemoteCache('@nx/shared-fs-cache');
181
+ if (cache)
182
+ return cache;
183
+ return this.resolveRemoteCache('@nx/powerpack-shared-fs-cache');
184
+ }
185
+ async getGcsCache() {
186
+ const cache = await this.resolveRemoteCache('@nx/gcs-cache');
187
+ if (cache)
188
+ return cache;
189
+ return this.resolveRemoteCache('@nx/powerpack-gcs-cache');
190
+ }
191
+ async getAzureCache() {
192
+ const cache = await this.resolveRemoteCache('@nx/azure-cache');
193
+ if (cache)
194
+ return cache;
195
+ return this.resolveRemoteCache('@nx/powerpack-azure-cache');
196
+ }
197
+ async resolveRemoteCache(pkg) {
186
198
  let getRemoteCache = null;
187
199
  try {
188
200
  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 powerpack_1 = require("../utils/powerpack");
39
+ const nx_key_1 = require("../utils/nx-key");
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, powerpack_1.printPowerpackLicense)();
144
+ await (0, nx_key_1.printNxKey)();
145
145
  return taskResults;
146
146
  }
147
147
  async function ensureWorkspaceIsInSyncAndGetGraphs(projectGraph, nxJson, projectNames, nxArgs, overrides, extraTargetDependencies, extraOptions) {
@@ -0,0 +1,7 @@
1
+ import type { NxKey } from '@nx/key';
2
+ export declare function createNxKeyLicenseeInformation(nxKey: NxKey): string;
3
+ export declare function printNxKey(): Promise<void>;
4
+ export declare function getNxKeyInformation(): Promise<NxKey | null>;
5
+ export declare class NxKeyNotInstalledError extends Error {
6
+ constructor(e: Error);
7
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NxKeyNotInstalledError = void 0;
4
+ exports.createNxKeyLicenseeInformation = createNxKeyLicenseeInformation;
5
+ exports.printNxKey = printNxKey;
6
+ exports.getNxKeyInformation = getNxKeyInformation;
7
+ const logger_1 = require("./logger");
8
+ const package_manager_1 = require("./package-manager");
9
+ const workspace_root_1 = require("./workspace-root");
10
+ function createNxKeyLicenseeInformation(nxKey) {
11
+ if ('isPowerpack' in nxKey && nxKey.isPowerpack) {
12
+ return `Licensed to ${nxKey.organizationName} for ${nxKey.seatCount} user${nxKey.seatCount > 1 ? 's' : ''} in ${nxKey.workspaceCount === 9999
13
+ ? 'an unlimited number of'
14
+ : nxKey.workspaceCount} workspace${nxKey.workspaceCount > 1 ? 's' : ''}.`;
15
+ }
16
+ else {
17
+ return `Licensed to ${nxKey.organizationName}.`;
18
+ }
19
+ }
20
+ async function printNxKey() {
21
+ try {
22
+ const key = await getNxKeyInformation();
23
+ if (key) {
24
+ logger_1.logger.log(createNxKeyLicenseeInformation(key));
25
+ }
26
+ }
27
+ catch { }
28
+ }
29
+ async function getNxKeyInformation() {
30
+ try {
31
+ const { getPowerpackLicenseInformation, getPowerpackLicenseInformationAsync, } = (await Promise.resolve().then(() => require('@nx/powerpack-license')));
32
+ return (getPowerpackLicenseInformationAsync ?? getPowerpackLicenseInformation)(workspace_root_1.workspaceRoot);
33
+ }
34
+ catch (e) {
35
+ try {
36
+ const { getNxKeyInformationAsync } = (await Promise.resolve().then(() => require('@nx/key')));
37
+ return getNxKeyInformationAsync(workspace_root_1.workspaceRoot);
38
+ }
39
+ catch (e) {
40
+ if ('code' in e && e.code === 'MODULE_NOT_FOUND') {
41
+ throw new NxKeyNotInstalledError(e);
42
+ }
43
+ throw e;
44
+ }
45
+ }
46
+ }
47
+ class NxKeyNotInstalledError extends Error {
48
+ constructor(e) {
49
+ 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 });
50
+ }
51
+ }
52
+ exports.NxKeyNotInstalledError = NxKeyNotInstalledError;
@@ -0,0 +1 @@
1
+ export declare function requireNxKey(): Promise<typeof import('@nx/key')>;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.requireNxKey = requireNxKey;
4
+ const child_process_1 = require("child_process");
5
+ const package_manager_1 = require("./package-manager");
6
+ async function requireNxKey() {
7
+ // @ts-ignore
8
+ return Promise.resolve().then(() => require('@nx/key')).catch(async (e) => {
9
+ if ('code' in e && e.code === 'MODULE_NOT_FOUND') {
10
+ try {
11
+ (0, child_process_1.execSync)(`${(0, package_manager_1.getPackageManagerCommand)().addDev} @nx/key@latest`, {
12
+ windowsHide: false,
13
+ });
14
+ // @ts-ignore
15
+ return await Promise.resolve().then(() => require('@nx/key'));
16
+ }
17
+ catch (e) {
18
+ throw new Error('Failed to install @nx/key. Please install @nx/key and try again.');
19
+ }
20
+ }
21
+ });
22
+ }
@@ -1,2 +0,0 @@
1
- import { ActivatePowerpackOptions } from './command-object';
2
- export declare function handleActivatePowerpack(options: ActivatePowerpackOptions): Promise<void>;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.handleActivatePowerpack = handleActivatePowerpack;
4
- const workspace_root_1 = require("../../utils/workspace-root");
5
- const enquirer_1 = require("enquirer");
6
- const child_process_1 = require("child_process");
7
- const package_manager_1 = require("../../utils/package-manager");
8
- async function handleActivatePowerpack(options) {
9
- const license = options.license ??
10
- (await (0, enquirer_1.prompt)({
11
- type: 'input',
12
- name: 'license',
13
- message: 'Enter your License Key',
14
- }));
15
- const { activatePowerpack } = await requirePowerpack();
16
- activatePowerpack(workspace_root_1.workspaceRoot, license);
17
- }
18
- async function requirePowerpack() {
19
- // @ts-ignore
20
- return Promise.resolve().then(() => require('@nx/powerpack-license')).catch(async (e) => {
21
- if ('code' in e && e.code === 'MODULE_NOT_FOUND') {
22
- try {
23
- (0, child_process_1.execSync)(`${(0, package_manager_1.getPackageManagerCommand)().addDev} @nx/powerpack-license@latest`, {
24
- windowsHide: false,
25
- });
26
- // @ts-ignore
27
- return await Promise.resolve().then(() => require('@nx/powerpack-license'));
28
- }
29
- catch (e) {
30
- throw new Error('Failed to install @nx/powerpack-license. Please install @nx/powerpack-license and try again.');
31
- }
32
- }
33
- });
34
- }
@@ -1,6 +0,0 @@
1
- import { CommandModule } from 'yargs';
2
- export interface ActivatePowerpackOptions {
3
- license: string;
4
- verbose: boolean;
5
- }
6
- export declare const yargsActivatePowerpackCommand: CommandModule<{}, ActivatePowerpackOptions>;
@@ -1,5 +0,0 @@
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
- }
@@ -1,33 +0,0 @@
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;