nx 20.5.0-rc.3 → 20.5.0-rc.4
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 +0 -1
- package/package.json +11 -11
- package/src/command-line/activate-powerpack/activate-powerpack.d.ts +2 -0
- package/src/command-line/{activate-key/activate-key.js → activate-powerpack/activate-powerpack.js} +12 -12
- package/src/command-line/activate-powerpack/command-object.d.ts +6 -0
- package/src/command-line/{activate-key → activate-powerpack}/command-object.js +7 -8
- package/src/command-line/init/configure-plugins.js +10 -12
- 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 +31 -33
- package/src/core/graph/main.js +1 -1
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/plugins/package-json/create-nodes.js +3 -1
- 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/activate-key/activate-key.d.ts +0 -2
- package/src/command-line/activate-key/command-object.d.ts +0 -6
- package/src/utils/nx-key.d.ts +0 -5
- package/src/utils/nx-key.js +0 -39
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.4",
|
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.4",
|
86
|
+
"@nx/nx-darwin-x64": "20.5.0-rc.4",
|
87
|
+
"@nx/nx-freebsd-x64": "20.5.0-rc.4",
|
88
|
+
"@nx/nx-linux-arm-gnueabihf": "20.5.0-rc.4",
|
89
|
+
"@nx/nx-linux-arm64-gnu": "20.5.0-rc.4",
|
90
|
+
"@nx/nx-linux-arm64-musl": "20.5.0-rc.4",
|
91
|
+
"@nx/nx-linux-x64-gnu": "20.5.0-rc.4",
|
92
|
+
"@nx/nx-linux-x64-musl": "20.5.0-rc.4",
|
93
|
+
"@nx/nx-win32-arm64-msvc": "20.5.0-rc.4",
|
94
|
+
"@nx/nx-win32-x64-msvc": "20.5.0-rc.4"
|
95
95
|
},
|
96
96
|
"nx-migrations": {
|
97
97
|
"migrations": "./migrations.json",
|
package/src/command-line/{activate-key/activate-key.js → activate-powerpack/activate-powerpack.js}
RENAMED
@@ -1,33 +1,33 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.handleActivatePowerpack = handleActivatePowerpack;
|
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 handleActivatePowerpack(options) {
|
9
|
+
const license = options.license ??
|
10
10
|
(await (0, enquirer_1.prompt)({
|
11
11
|
type: 'input',
|
12
|
-
name: '
|
13
|
-
message: 'Enter your
|
12
|
+
name: 'license',
|
13
|
+
message: 'Enter your License Key',
|
14
14
|
}));
|
15
|
-
const {
|
16
|
-
|
15
|
+
const { activatePowerpack } = await requirePowerpack();
|
16
|
+
activatePowerpack(workspace_root_1.workspaceRoot, license);
|
17
17
|
}
|
18
|
-
async function
|
18
|
+
async function requirePowerpack() {
|
19
19
|
// @ts-ignore
|
20
|
-
return Promise.resolve().then(() => require('@nx/
|
20
|
+
return Promise.resolve().then(() => require('@nx/powerpack-license')).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/powerpack-license@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/powerpack-license'));
|
28
28
|
}
|
29
29
|
catch (e) {
|
30
|
-
throw new Error('Failed to install @nx/
|
30
|
+
throw new Error('Failed to install @nx/powerpack-license. Please install @nx/powerpack-license and try again.');
|
31
31
|
}
|
32
32
|
}
|
33
33
|
});
|
@@ -1,11 +1,10 @@
|
|
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: 'activate-
|
8
|
-
aliases: ['activate-powerpack'],
|
6
|
+
exports.yargsActivatePowerpackCommand = {
|
7
|
+
command: 'activate-powerpack <license>',
|
9
8
|
describe: false,
|
10
9
|
// describe: 'Activate a Nx Powerpack license.',
|
11
10
|
builder: (yargs) => (0, shared_options_1.withVerbose)(yargs)
|
@@ -13,14 +12,14 @@ exports.yargsActivateKeyCommand = {
|
|
13
12
|
'strip-dashed': true,
|
14
13
|
'unknown-options-as-args': true,
|
15
14
|
})
|
16
|
-
.positional('
|
15
|
+
.positional('license', {
|
17
16
|
type: 'string',
|
18
|
-
description: 'This is a
|
17
|
+
description: 'This is a License Key for Nx Powerpack.',
|
19
18
|
})
|
20
|
-
.example('$0 activate-
|
19
|
+
.example('$0 activate-powerpack <license key>', 'Activate a Nx Powerpack license'),
|
21
20
|
handler: async (args) => {
|
22
21
|
const exitCode = await (0, handle_errors_1.handleErrors)(args.verbose, async () => {
|
23
|
-
return (await Promise.resolve().then(() => require('./activate-
|
22
|
+
return (await Promise.resolve().then(() => require('./activate-powerpack'))).handleActivatePowerpack(args);
|
24
23
|
});
|
25
24
|
process.exit(exitCode);
|
26
25
|
},
|
@@ -12,9 +12,9 @@ const package_manager_1 = require("../../utils/package-manager");
|
|
12
12
|
const output_1 = require("../../utils/output");
|
13
13
|
const workspace_root_1 = require("../../utils/workspace-root");
|
14
14
|
const utils_1 = require("./implementation/utils");
|
15
|
-
const plugins_1 = require("../../utils/plugins");
|
16
15
|
const angular_json_1 = require("../../adapter/angular-json");
|
17
16
|
const error_types_1 = require("../../project-graph/error-types");
|
17
|
+
const generator_utils_1 = require("../generate/generator-utils");
|
18
18
|
function runPackageManagerInstallPlugins(repoRoot, pmc = (0, package_manager_1.getPackageManagerCommand)(), plugins) {
|
19
19
|
if (plugins.length === 0) {
|
20
20
|
return;
|
@@ -32,23 +32,21 @@ function runPackageManagerInstallPlugins(repoRoot, pmc = (0, package_manager_1.g
|
|
32
32
|
* @returns void
|
33
33
|
*/
|
34
34
|
async function installPlugin(plugin, repoRoot = workspace_root_1.workspaceRoot, updatePackageScripts = false, verbose = false, pmc = (0, package_manager_1.getPackageManagerCommand)()) {
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
try {
|
36
|
+
(0, generator_utils_1.getGeneratorInformation)(plugin, 'init', workspace_root_1.workspaceRoot, {});
|
37
|
+
(0, child_process_1.execSync)(`${pmc.exec} nx g ${plugin}:init --keepExistingVersions ${updatePackageScripts ? '--updatePackageScripts' : ''} ${verbose ? '--verbose' : ''}`, {
|
38
|
+
stdio: [0, 1, 2],
|
39
|
+
cwd: repoRoot,
|
40
|
+
windowsHide: false,
|
41
|
+
});
|
39
42
|
}
|
40
|
-
|
41
|
-
|
43
|
+
catch {
|
44
|
+
// init generator does not exist, so this function should noop
|
42
45
|
output_1.output.log({
|
43
46
|
title: `No "init" generator found in ${plugin}. Skipping initialization.`,
|
44
47
|
});
|
45
48
|
return;
|
46
49
|
}
|
47
|
-
(0, child_process_1.execSync)(`${pmc.exec} nx g ${plugin}:init --keepExistingVersions ${updatePackageScripts ? '--updatePackageScripts' : ''} ${verbose ? '--verbose' : ''}`, {
|
48
|
-
stdio: [0, 1, 2],
|
49
|
-
cwd: repoRoot,
|
50
|
-
windowsHide: false,
|
51
|
-
});
|
52
50
|
}
|
53
51
|
/**
|
54
52
|
* Install plugins
|
@@ -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-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 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, powerpackLicense, powerpackError, 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,31 +61,29 @@ 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 (powerpackLicense) {
|
65
65
|
bodyLines.push('');
|
66
66
|
bodyLines.push(LINE_SEPARATOR);
|
67
|
-
bodyLines.push(chalk.green('Nx
|
68
|
-
|
67
|
+
bodyLines.push(chalk.green('Nx Powerpack'));
|
68
|
+
const licenseExpiryDate = new Date((powerpackLicense.realExpiresAt ?? powerpackLicense.expiresAt) * 1000);
|
69
|
+
bodyLines.push(`Licensed to ${powerpackLicense.organizationName} for ${powerpackLicense.seatCount} user${powerpackLicense.seatCount > 1 ? 's' : ''} in ${powerpackLicense.workspaceCount === 9999
|
69
70
|
? 'an unlimited number of'
|
70
|
-
:
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
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
|
-
}
|
71
|
+
: powerpackLicense.workspaceCount} workspace${powerpackLicense.workspaceCount > 1 ? 's' : ''}.`);
|
72
|
+
// license is not expired
|
73
|
+
if (licenseExpiryDate.getTime() >= Date.now()) {
|
74
|
+
if ('perpetualNxVersion' in powerpackLicense) {
|
75
|
+
bodyLines.push(`License expires on ${licenseExpiryDate.toLocaleDateString()}, but will continue to work with Nx ${powerpackLicense.perpetualNxVersion} and below.`);
|
81
76
|
}
|
82
77
|
else {
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
}
|
78
|
+
bodyLines.push(`License expires on ${licenseExpiryDate.toLocaleDateString()}.`);
|
79
|
+
}
|
80
|
+
}
|
81
|
+
else {
|
82
|
+
if ('perpetualNxVersion' in powerpackLicense) {
|
83
|
+
bodyLines.push(`License expired on ${licenseExpiryDate.toLocaleDateString()}, but will continue to work with Nx ${powerpackLicense.perpetualNxVersion} and below.`);
|
84
|
+
}
|
85
|
+
else {
|
86
|
+
bodyLines.push(`License expired on ${licenseExpiryDate.toLocaleDateString()}.`);
|
89
87
|
}
|
90
88
|
}
|
91
89
|
bodyLines.push('');
|
@@ -96,11 +94,11 @@ async function reportHandler() {
|
|
96
94
|
}
|
97
95
|
bodyLines.push('');
|
98
96
|
}
|
99
|
-
else if (
|
97
|
+
else if (powerpackError) {
|
100
98
|
bodyLines.push('');
|
101
|
-
bodyLines.push(chalk.red('Nx
|
99
|
+
bodyLines.push(chalk.red('Nx Powerpack'));
|
102
100
|
bodyLines.push(LINE_SEPARATOR);
|
103
|
-
bodyLines.push(
|
101
|
+
bodyLines.push(powerpackError.message);
|
104
102
|
bodyLines.push('');
|
105
103
|
}
|
106
104
|
if (registeredPlugins.length) {
|
@@ -167,20 +165,20 @@ async function getReportData() {
|
|
167
165
|
}
|
168
166
|
const outOfSyncPackageGroup = findMisalignedPackagesForPackage(nxPackageJson);
|
169
167
|
const native = isNativeAvailable();
|
170
|
-
let
|
171
|
-
let
|
168
|
+
let powerpackLicense = null;
|
169
|
+
let powerpackError = null;
|
172
170
|
try {
|
173
|
-
|
171
|
+
powerpackLicense = await (0, powerpack_1.getPowerpackLicenseInformation)();
|
174
172
|
}
|
175
173
|
catch (e) {
|
176
|
-
if (!(e instanceof
|
177
|
-
|
174
|
+
if (!(e instanceof powerpack_1.NxPowerpackNotInstalledError)) {
|
175
|
+
powerpackError = e;
|
178
176
|
}
|
179
177
|
}
|
180
178
|
return {
|
181
179
|
pm,
|
182
|
-
|
183
|
-
|
180
|
+
powerpackLicense,
|
181
|
+
powerpackError,
|
184
182
|
powerpackPlugins,
|
185
183
|
pmVersion,
|
186
184
|
localPlugins,
|
@@ -258,7 +256,7 @@ function findMisalignedPackagesForPackage(base) {
|
|
258
256
|
}
|
259
257
|
function findInstalledPowerpackPlugins() {
|
260
258
|
const installedPlugins = (0, installed_plugins_1.findInstalledPlugins)();
|
261
|
-
return installedPlugins.filter((dep) => new RegExp('@nx/powerpack
|
259
|
+
return installedPlugins.filter((dep) => new RegExp('@nx/powerpack*').test(dep.name));
|
262
260
|
}
|
263
261
|
function findInstalledCommunityPlugins() {
|
264
262
|
const installedPlugins = (0, installed_plugins_1.findInstalledPlugins)();
|