nx 20.6.0-canary.20250314-beb1784 → 20.6.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.
- package/.eslintrc.json +1 -3
- package/package.json +12 -12
- package/src/command-line/activate-powerpack/activate-powerpack.d.ts +2 -0
- package/src/command-line/activate-powerpack/activate-powerpack.js +34 -0
- package/src/command-line/activate-powerpack/command-object.d.ts +6 -0
- package/src/command-line/{register → activate-powerpack}/command-object.js +9 -9
- package/src/command-line/init/init-v2.js +1 -0
- package/src/command-line/nx-commands.js +5 -19
- package/src/command-line/report/report.d.ts +3 -3
- package/src/command-line/report/report.js +32 -32
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/tasks-runner/cache.d.ts +5 -5
- package/src/tasks-runner/cache.js +17 -29
- package/src/tasks-runner/run-command.js +2 -2
- package/src/utils/powerpack.d.ts +5 -0
- package/src/utils/powerpack.js +33 -0
- package/src/command-line/register/command-object.d.ts +0 -6
- package/src/command-line/register/register.d.ts +0 -2
- package/src/command-line/register/register.js +0 -25
- package/src/utils/nx-key.d.ts +0 -7
- package/src/utils/nx-key.js +0 -52
- package/src/utils/require-nx-key.d.ts +0 -1
- package/src/utils/require-nx-key.js +0 -22
package/.eslintrc.json
CHANGED
@@ -131,10 +131,8 @@
|
|
131
131
|
"@nx/nx-win32-arm64-msvc",
|
132
132
|
"@nx/nx-freebsd-x64",
|
133
133
|
"@nx/powerpack-license",
|
134
|
-
"@nx/key",
|
135
134
|
// Powerpack plugin conditionally available dynamically at runtime
|
136
|
-
"@nx/powerpack-conformance"
|
137
|
-
"@nx/conformance"
|
135
|
+
"@nx/powerpack-conformance"
|
138
136
|
]
|
139
137
|
}
|
140
138
|
]
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "20.6.0
|
3
|
+
"version": "20.6.0",
|
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": {
|
@@ -38,7 +38,7 @@
|
|
38
38
|
"@yarnpkg/lockfile": "^1.1.0",
|
39
39
|
"@yarnpkg/parsers": "3.0.2",
|
40
40
|
"@zkochan/js-yaml": "0.0.7",
|
41
|
-
"axios": "^1.
|
41
|
+
"axios": "^1.8.3",
|
42
42
|
"chalk": "^4.1.0",
|
43
43
|
"cli-cursor": "3.1.0",
|
44
44
|
"cli-spinners": "2.6.1",
|
@@ -82,16 +82,16 @@
|
|
82
82
|
}
|
83
83
|
},
|
84
84
|
"optionalDependencies": {
|
85
|
-
"@nx/nx-darwin-arm64": "20.6.0
|
86
|
-
"@nx/nx-darwin-x64": "20.6.0
|
87
|
-
"@nx/nx-freebsd-x64": "20.6.0
|
88
|
-
"@nx/nx-linux-arm-gnueabihf": "20.6.0
|
89
|
-
"@nx/nx-linux-arm64-gnu": "20.6.0
|
90
|
-
"@nx/nx-linux-arm64-musl": "20.6.0
|
91
|
-
"@nx/nx-linux-x64-gnu": "20.6.0
|
92
|
-
"@nx/nx-linux-x64-musl": "20.6.0
|
93
|
-
"@nx/nx-win32-arm64-msvc": "20.6.0
|
94
|
-
"@nx/nx-win32-x64-msvc": "20.6.0
|
85
|
+
"@nx/nx-darwin-arm64": "20.6.0",
|
86
|
+
"@nx/nx-darwin-x64": "20.6.0",
|
87
|
+
"@nx/nx-freebsd-x64": "20.6.0",
|
88
|
+
"@nx/nx-linux-arm-gnueabihf": "20.6.0",
|
89
|
+
"@nx/nx-linux-arm64-gnu": "20.6.0",
|
90
|
+
"@nx/nx-linux-arm64-musl": "20.6.0",
|
91
|
+
"@nx/nx-linux-x64-gnu": "20.6.0",
|
92
|
+
"@nx/nx-linux-x64-musl": "20.6.0",
|
93
|
+
"@nx/nx-win32-arm64-msvc": "20.6.0",
|
94
|
+
"@nx/nx-win32-x64-msvc": "20.6.0"
|
95
95
|
},
|
96
96
|
"nx-migrations": {
|
97
97
|
"migrations": "./migrations.json",
|
@@ -0,0 +1,34 @@
|
|
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,25 +1,25 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.yargsActivatePowerpackCommand = 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: '
|
8
|
-
aliases: ['activate-powerpack'],
|
6
|
+
exports.yargsActivatePowerpackCommand = {
|
7
|
+
command: 'activate-powerpack <license>',
|
9
8
|
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('
|
15
|
+
.positional('license', {
|
16
16
|
type: 'string',
|
17
|
-
description: 'This is a
|
17
|
+
description: 'This is a License Key for Nx Powerpack.',
|
18
18
|
})
|
19
|
-
.example('$0
|
19
|
+
.example('$0 activate-powerpack <license key>', 'Activate a Nx Powerpack license'),
|
20
20
|
handler: async (args) => {
|
21
|
-
const exitCode = await (0, handle_errors_1.handleErrors)(args.verbose
|
22
|
-
return (await Promise.resolve().then(() => require('./
|
21
|
+
const exitCode = await (0, handle_errors_1.handleErrors)(args.verbose, async () => {
|
22
|
+
return (await Promise.resolve().then(() => require('./activate-powerpack'))).handleActivatePowerpack(args);
|
23
23
|
});
|
24
24
|
process.exit(exitCode);
|
25
25
|
},
|
@@ -156,6 +156,7 @@ const npmPackageToPluginMap = {
|
|
156
156
|
'react-native': '@nx/react-native',
|
157
157
|
'@remix-run/dev': '@nx/remix',
|
158
158
|
'@rsbuild/core': '@nx/rsbuild',
|
159
|
+
'@react-router/dev': '@nx/react',
|
159
160
|
};
|
160
161
|
async function detectPlugins(nxJson, interactive, includeAngularCli) {
|
161
162
|
let files = ['package.json'].concat((0, workspace_context_1.globWithWorkspaceContextSync)(process.cwd(), ['**/*/package.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("./
|
6
|
+
const command_object_1 = require("./activate-powerpack/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.yargsActivatePowerpackCommand)
|
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 Powerpack license and the \`@nx/powerpack-conformance\` plugin installed.`,
|
103
103
|
'',
|
104
104
|
'To learn more, visit https://nx.dev/nx-enterprise/powerpack/conformance',
|
105
105
|
],
|
@@ -110,14 +110,7 @@ function createMissingConformanceCommand(command) {
|
|
110
110
|
}
|
111
111
|
function resolveConformanceCommandObject() {
|
112
112
|
try {
|
113
|
-
const { yargsConformanceCommand } = (
|
114
|
-
try {
|
115
|
-
return require('@nx/powerpack-conformance');
|
116
|
-
}
|
117
|
-
catch {
|
118
|
-
return require('@nx/conformance');
|
119
|
-
}
|
120
|
-
})();
|
113
|
+
const { yargsConformanceCommand } = require('@nx/powerpack-conformance');
|
121
114
|
return yargsConformanceCommand;
|
122
115
|
}
|
123
116
|
catch {
|
@@ -126,14 +119,7 @@ function resolveConformanceCommandObject() {
|
|
126
119
|
}
|
127
120
|
function resolveConformanceCheckCommandObject() {
|
128
121
|
try {
|
129
|
-
const { yargsConformanceCheckCommand } = (
|
130
|
-
try {
|
131
|
-
return require('@nx/powerpack-conformance');
|
132
|
-
}
|
133
|
-
catch {
|
134
|
-
return require('@nx/conformance');
|
135
|
-
}
|
136
|
-
})();
|
122
|
+
const { yargsConformanceCheckCommand, } = require('@nx/powerpack-conformance');
|
137
123
|
return yargsConformanceCheckCommand;
|
138
124
|
}
|
139
125
|
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 {
|
4
|
+
import type { PowerpackLicense } from '@nx/powerpack-license';
|
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
|
+
powerpackLicense: PowerpackLicense | null;
|
20
|
+
powerpackError: 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 powerpack_1 = require("../../utils/powerpack");
|
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,
|
52
|
+
const { pm, pmVersion, powerpackLicense, powerpackError, 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 (
|
67
|
+
if (powerpackLicense) {
|
68
68
|
bodyLines.push('');
|
69
69
|
bodyLines.push(LINE_SEPARATOR);
|
70
|
-
bodyLines.push(chalk.green('Nx
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
}
|
79
|
-
else {
|
80
|
-
bodyLines.push(`License expires on ${licenseExpiryDate.toLocaleDateString()}.`);
|
81
|
-
}
|
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.`);
|
82
79
|
}
|
83
80
|
else {
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
}
|
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.`);
|
87
|
+
}
|
88
|
+
else {
|
89
|
+
bodyLines.push(`License expired on ${licenseExpiryDate.toLocaleDateString()}.`);
|
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 (
|
100
|
+
else if (powerpackError) {
|
101
101
|
bodyLines.push('');
|
102
|
-
bodyLines.push(chalk.red('Nx
|
102
|
+
bodyLines.push(chalk.red('Nx Powerpack'));
|
103
103
|
bodyLines.push(LINE_SEPARATOR);
|
104
|
-
bodyLines.push(
|
104
|
+
bodyLines.push(powerpackError.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
|
176
|
-
let
|
175
|
+
let powerpackLicense = null;
|
176
|
+
let powerpackError = null;
|
177
177
|
try {
|
178
|
-
|
178
|
+
powerpackLicense = await (0, powerpack_1.getPowerpackLicenseInformation)();
|
179
179
|
}
|
180
180
|
catch (e) {
|
181
|
-
if (!(e instanceof
|
182
|
-
|
181
|
+
if (!(e instanceof powerpack_1.NxPowerpackNotInstalledError)) {
|
182
|
+
powerpackError = 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
|
-
|
196
|
-
|
195
|
+
powerpackLicense,
|
196
|
+
powerpackError,
|
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
|
275
|
+
return installedPlugins.filter((dep) => new RegExp('@nx/powerpack*').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
|
38
|
-
private
|
39
|
-
private
|
40
|
-
private
|
41
|
-
private
|
37
|
+
private getPowerpackS3Cache;
|
38
|
+
private getPowerpackSharedCache;
|
39
|
+
private getPowerpackGcsCache;
|
40
|
+
private getPowerpackAzureCache;
|
41
|
+
private getPowerpackCache;
|
42
42
|
private resolvePackage;
|
43
43
|
private assertCacheIsValid;
|
44
44
|
}
|
@@ -163,38 +163,26 @@ class DbCache {
|
|
163
163
|
}
|
164
164
|
}
|
165
165
|
else {
|
166
|
-
return ((await this.
|
167
|
-
(await this.
|
168
|
-
(await this.
|
169
|
-
(await this.
|
166
|
+
return ((await this.getPowerpackS3Cache()) ??
|
167
|
+
(await this.getPowerpackSharedCache()) ??
|
168
|
+
(await this.getPowerpackGcsCache()) ??
|
169
|
+
(await this.getPowerpackAzureCache()) ??
|
170
170
|
null);
|
171
171
|
}
|
172
172
|
}
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
return this.
|
178
|
-
}
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
return this.
|
184
|
-
}
|
185
|
-
async
|
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) {
|
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) {
|
198
186
|
let getRemoteCache = null;
|
199
187
|
try {
|
200
188
|
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 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,
|
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,25 +0,0 @@
|
|
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
|
-
}
|
package/src/utils/nx-key.d.ts
DELETED
@@ -1,7 +0,0 @@
|
|
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
|
-
}
|
package/src/utils/nx-key.js
DELETED
@@ -1,52 +0,0 @@
|
|
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;
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare function requireNxKey(): Promise<typeof import('@nx/key')>;
|
@@ -1,22 +0,0 @@
|
|
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
|
-
}
|