nx 20.5.0-rc.2 → 20.5.0-rc.3
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 +1 -0
- package/package.json +11 -11
- package/src/command-line/activate-key/activate-key.d.ts +2 -0
- package/src/command-line/{activate-powerpack/activate-powerpack.js → activate-key/activate-key.js} +12 -12
- package/src/command-line/activate-key/command-object.d.ts +6 -0
- package/src/command-line/{activate-powerpack → activate-key}/command-object.js +8 -7
- package/src/command-line/nx-commands.js +19 -5
- package/src/command-line/report/report.d.ts +3 -3
- package/src/command-line/report/report.js +33 -31
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/tasks-runner/cache.d.ts +5 -5
- package/src/tasks-runner/cache.js +29 -17
- package/src/tasks-runner/run-command.js +2 -2
- package/src/utils/nx-key.d.ts +5 -0
- package/src/utils/nx-key.js +39 -0
- package/src/command-line/activate-powerpack/activate-powerpack.d.ts +0 -2
- package/src/command-line/activate-powerpack/command-object.d.ts +0 -6
- package/src/utils/powerpack.d.ts +0 -5
- package/src/utils/powerpack.js +0 -33
package/.eslintrc.json
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "20.5.0-rc.
|
3
|
+
"version": "20.5.0-rc.3",
|
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.5.0-rc.
|
86
|
-
"@nx/nx-darwin-x64": "20.5.0-rc.
|
87
|
-
"@nx/nx-freebsd-x64": "20.5.0-rc.
|
88
|
-
"@nx/nx-linux-arm-gnueabihf": "20.5.0-rc.
|
89
|
-
"@nx/nx-linux-arm64-gnu": "20.5.0-rc.
|
90
|
-
"@nx/nx-linux-arm64-musl": "20.5.0-rc.
|
91
|
-
"@nx/nx-linux-x64-gnu": "20.5.0-rc.
|
92
|
-
"@nx/nx-linux-x64-musl": "20.5.0-rc.
|
93
|
-
"@nx/nx-win32-arm64-msvc": "20.5.0-rc.
|
94
|
-
"@nx/nx-win32-x64-msvc": "20.5.0-rc.
|
85
|
+
"@nx/nx-darwin-arm64": "20.5.0-rc.3",
|
86
|
+
"@nx/nx-darwin-x64": "20.5.0-rc.3",
|
87
|
+
"@nx/nx-freebsd-x64": "20.5.0-rc.3",
|
88
|
+
"@nx/nx-linux-arm-gnueabihf": "20.5.0-rc.3",
|
89
|
+
"@nx/nx-linux-arm64-gnu": "20.5.0-rc.3",
|
90
|
+
"@nx/nx-linux-arm64-musl": "20.5.0-rc.3",
|
91
|
+
"@nx/nx-linux-x64-gnu": "20.5.0-rc.3",
|
92
|
+
"@nx/nx-linux-x64-musl": "20.5.0-rc.3",
|
93
|
+
"@nx/nx-win32-arm64-msvc": "20.5.0-rc.3",
|
94
|
+
"@nx/nx-win32-x64-msvc": "20.5.0-rc.3"
|
95
95
|
},
|
96
96
|
"nx-migrations": {
|
97
97
|
"migrations": "./migrations.json",
|
package/src/command-line/{activate-powerpack/activate-powerpack.js → activate-key/activate-key.js}
RENAMED
@@ -1,33 +1,33 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.handleActivateKey = handleActivateKey;
|
4
4
|
const workspace_root_1 = require("../../utils/workspace-root");
|
5
5
|
const enquirer_1 = require("enquirer");
|
6
6
|
const child_process_1 = require("child_process");
|
7
7
|
const package_manager_1 = require("../../utils/package-manager");
|
8
|
-
async function
|
9
|
-
const
|
8
|
+
async function handleActivateKey(options) {
|
9
|
+
const key = options.key ??
|
10
10
|
(await (0, enquirer_1.prompt)({
|
11
11
|
type: 'input',
|
12
|
-
name: '
|
13
|
-
message: 'Enter your
|
12
|
+
name: 'key',
|
13
|
+
message: 'Enter your key',
|
14
14
|
}));
|
15
|
-
const {
|
16
|
-
|
15
|
+
const { activateNxKey } = await requireNxKey();
|
16
|
+
activateNxKey(workspace_root_1.workspaceRoot, key);
|
17
17
|
}
|
18
|
-
async function
|
18
|
+
async function requireNxKey() {
|
19
19
|
// @ts-ignore
|
20
|
-
return Promise.resolve().then(() => require('@nx/
|
20
|
+
return Promise.resolve().then(() => require('@nx/key')).catch(async (e) => {
|
21
21
|
if ('code' in e && e.code === 'MODULE_NOT_FOUND') {
|
22
22
|
try {
|
23
|
-
(0, child_process_1.execSync)(`${(0, package_manager_1.getPackageManagerCommand)().addDev} @nx/
|
23
|
+
(0, child_process_1.execSync)(`${(0, package_manager_1.getPackageManagerCommand)().addDev} @nx/key@latest`, {
|
24
24
|
windowsHide: false,
|
25
25
|
});
|
26
26
|
// @ts-ignore
|
27
|
-
return await Promise.resolve().then(() => require('@nx/
|
27
|
+
return await Promise.resolve().then(() => require('@nx/key'));
|
28
28
|
}
|
29
29
|
catch (e) {
|
30
|
-
throw new Error('Failed to install @nx/
|
30
|
+
throw new Error('Failed to install @nx/key. Please install @nx/key and try again.');
|
31
31
|
}
|
32
32
|
}
|
33
33
|
});
|
@@ -1,10 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.yargsActivateKeyCommand = 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.
|
7
|
-
command: 'activate-
|
6
|
+
exports.yargsActivateKeyCommand = {
|
7
|
+
command: 'activate-key <key>',
|
8
|
+
aliases: ['activate-powerpack'],
|
8
9
|
describe: false,
|
9
10
|
// describe: 'Activate a Nx Powerpack license.',
|
10
11
|
builder: (yargs) => (0, shared_options_1.withVerbose)(yargs)
|
@@ -12,14 +13,14 @@ exports.yargsActivatePowerpackCommand = {
|
|
12
13
|
'strip-dashed': true,
|
13
14
|
'unknown-options-as-args': true,
|
14
15
|
})
|
15
|
-
.positional('
|
16
|
+
.positional('key', {
|
16
17
|
type: 'string',
|
17
|
-
description: 'This is a
|
18
|
+
description: 'This is a key for Nx.',
|
18
19
|
})
|
19
|
-
.example('$0 activate-
|
20
|
+
.example('$0 activate-key <key>', 'Activate a Nx key'),
|
20
21
|
handler: async (args) => {
|
21
22
|
const exitCode = await (0, handle_errors_1.handleErrors)(args.verbose, async () => {
|
22
|
-
return (await Promise.resolve().then(() => require('./activate-
|
23
|
+
return (await Promise.resolve().then(() => require('./activate-key'))).handleActivateKey(args);
|
23
24
|
});
|
24
25
|
process.exit(exitCode);
|
25
26
|
},
|
@@ -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-
|
6
|
+
const command_object_1 = require("./activate-key/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.
|
49
|
+
.command(command_object_1.yargsActivateKeyCommand)
|
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
|
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 } =
|
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
|
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 {
|
@@ -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
|
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
|
-
|
20
|
-
|
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
|
24
|
+
const nx_key_1 = require("../../utils/nx-key");
|
25
25
|
const nxPackageJson = (0, fileutils_1.readJsonFile)((0, path_1.join)(__dirname, '../../../package.json'));
|
26
26
|
exports.packagesWeCareAbout = [
|
27
27
|
'lerna',
|
@@ -46,7 +46,7 @@ const LINE_SEPARATOR = '---------------------------------------';
|
|
46
46
|
*
|
47
47
|
*/
|
48
48
|
async function reportHandler() {
|
49
|
-
const { pm, pmVersion,
|
49
|
+
const { pm, pmVersion, nxKey, nxKeyError, localPlugins, powerpackPlugins, communityPlugins, registeredPlugins, packageVersionsWeCareAbout, outOfSyncPackageGroup, projectGraphError, nativeTarget, } = await getReportData();
|
50
50
|
const fields = [
|
51
51
|
['Node', process.versions.node],
|
52
52
|
['OS', `${process.platform}-${process.arch}`],
|
@@ -61,29 +61,31 @@ async function reportHandler() {
|
|
61
61
|
packageVersionsWeCareAbout.forEach((p) => {
|
62
62
|
bodyLines.push(`${chalk.green(p.package.padEnd(padding))} : ${chalk.bold(p.version)}`);
|
63
63
|
});
|
64
|
-
if (
|
64
|
+
if (nxKey) {
|
65
65
|
bodyLines.push('');
|
66
66
|
bodyLines.push(LINE_SEPARATOR);
|
67
|
-
bodyLines.push(chalk.green('Nx
|
68
|
-
|
69
|
-
bodyLines.push(`Licensed to ${powerpackLicense.organizationName} for ${powerpackLicense.seatCount} user${powerpackLicense.seatCount > 1 ? 's' : ''} in ${powerpackLicense.workspaceCount === 9999
|
67
|
+
bodyLines.push(chalk.green('Nx key licensed packages'));
|
68
|
+
bodyLines.push(`Licensed to ${nxKey.organizationName} for ${nxKey.seatCount} user${nxKey.seatCount > 1 ? 's' : ''} in ${nxKey.workspaceCount === 9999
|
70
69
|
? 'an unlimited number of'
|
71
|
-
:
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
if ('perpetualNxVersion' in powerpackLicense) {
|
83
|
-
bodyLines.push(`License expired on ${licenseExpiryDate.toLocaleDateString()}, but will continue to work with Nx ${powerpackLicense.perpetualNxVersion} and below.`);
|
70
|
+
: nxKey.workspaceCount} workspace${nxKey.workspaceCount > 1 ? 's' : ''}.`);
|
71
|
+
if (nxKey.realExpiresAt || nxKey.expiresAt) {
|
72
|
+
const licenseExpiryDate = new Date((nxKey.realExpiresAt ?? nxKey.expiresAt) * 1000);
|
73
|
+
// license is not expired
|
74
|
+
if (licenseExpiryDate.getTime() >= Date.now()) {
|
75
|
+
if ('perpetualNxVersion' in nxKey) {
|
76
|
+
bodyLines.push(`License expires on ${licenseExpiryDate.toLocaleDateString()}, but will continue to work with Nx ${nxKey.perpetualNxVersion} and below.`);
|
77
|
+
}
|
78
|
+
else {
|
79
|
+
bodyLines.push(`License expires on ${licenseExpiryDate.toLocaleDateString()}.`);
|
80
|
+
}
|
84
81
|
}
|
85
82
|
else {
|
86
|
-
|
83
|
+
if ('perpetualNxVersion' in nxKey) {
|
84
|
+
bodyLines.push(`License expired on ${licenseExpiryDate.toLocaleDateString()}, but will continue to work with Nx ${nxKey.perpetualNxVersion} and below.`);
|
85
|
+
}
|
86
|
+
else {
|
87
|
+
bodyLines.push(`License expired on ${licenseExpiryDate.toLocaleDateString()}.`);
|
88
|
+
}
|
87
89
|
}
|
88
90
|
}
|
89
91
|
bodyLines.push('');
|
@@ -94,11 +96,11 @@ async function reportHandler() {
|
|
94
96
|
}
|
95
97
|
bodyLines.push('');
|
96
98
|
}
|
97
|
-
else if (
|
99
|
+
else if (nxKeyError) {
|
98
100
|
bodyLines.push('');
|
99
|
-
bodyLines.push(chalk.red('Nx
|
101
|
+
bodyLines.push(chalk.red('Nx key'));
|
100
102
|
bodyLines.push(LINE_SEPARATOR);
|
101
|
-
bodyLines.push(
|
103
|
+
bodyLines.push(nxKeyError.message);
|
102
104
|
bodyLines.push('');
|
103
105
|
}
|
104
106
|
if (registeredPlugins.length) {
|
@@ -165,20 +167,20 @@ async function getReportData() {
|
|
165
167
|
}
|
166
168
|
const outOfSyncPackageGroup = findMisalignedPackagesForPackage(nxPackageJson);
|
167
169
|
const native = isNativeAvailable();
|
168
|
-
let
|
169
|
-
let
|
170
|
+
let nxKey = null;
|
171
|
+
let nxKeyError = null;
|
170
172
|
try {
|
171
|
-
|
173
|
+
nxKey = await (0, nx_key_1.getNxKeyInformation)();
|
172
174
|
}
|
173
175
|
catch (e) {
|
174
|
-
if (!(e instanceof
|
175
|
-
|
176
|
+
if (!(e instanceof nx_key_1.NxKeyNotInstalledError)) {
|
177
|
+
nxKeyError = e;
|
176
178
|
}
|
177
179
|
}
|
178
180
|
return {
|
179
181
|
pm,
|
180
|
-
|
181
|
-
|
182
|
+
nxKey,
|
183
|
+
nxKeyError,
|
182
184
|
powerpackPlugins,
|
183
185
|
pmVersion,
|
184
186
|
localPlugins,
|
@@ -256,7 +258,7 @@ function findMisalignedPackagesForPackage(base) {
|
|
256
258
|
}
|
257
259
|
function findInstalledPowerpackPlugins() {
|
258
260
|
const installedPlugins = (0, installed_plugins_1.findInstalledPlugins)();
|
259
|
-
return installedPlugins.filter((dep) => new RegExp('@nx/powerpack*').test(dep.name));
|
261
|
+
return installedPlugins.filter((dep) => new RegExp('@nx/powerpack*|@nx/(.+)-cache|@nx/(conformance|owners|enterprise*)').test(dep.name));
|
260
262
|
}
|
261
263
|
function findInstalledCommunityPlugins() {
|
262
264
|
const installedPlugins = (0, installed_plugins_1.findInstalledPlugins)();
|
Binary file
|
@@ -32,11 +32,11 @@ export declare class DbCache {
|
|
32
32
|
temporaryOutputPath(task: Task): string;
|
33
33
|
private getRemoteCache;
|
34
34
|
private _getRemoteCache;
|
35
|
-
private
|
36
|
-
private
|
37
|
-
private
|
38
|
-
private
|
39
|
-
private
|
35
|
+
private getS3Cache;
|
36
|
+
private getSharedCache;
|
37
|
+
private getGcsCache;
|
38
|
+
private getAzureCache;
|
39
|
+
private resolveRemoteCache;
|
40
40
|
private resolvePackage;
|
41
41
|
private assertCacheIsValid;
|
42
42
|
}
|
@@ -155,26 +155,38 @@ class DbCache {
|
|
155
155
|
}
|
156
156
|
}
|
157
157
|
else {
|
158
|
-
return ((await this.
|
159
|
-
(await this.
|
160
|
-
(await this.
|
161
|
-
(await this.
|
158
|
+
return ((await this.getS3Cache()) ??
|
159
|
+
(await this.getSharedCache()) ??
|
160
|
+
(await this.getGcsCache()) ??
|
161
|
+
(await this.getAzureCache()) ??
|
162
162
|
null);
|
163
163
|
}
|
164
164
|
}
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
return this.
|
170
|
-
}
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
return this.
|
176
|
-
}
|
177
|
-
async
|
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) {
|
178
190
|
let getRemoteCache = null;
|
179
191
|
try {
|
180
192
|
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
|
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,
|
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,39 @@
|
|
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;
|
package/src/utils/powerpack.d.ts
DELETED
@@ -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
|
-
}
|
package/src/utils/powerpack.js
DELETED
@@ -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;
|