nx 20.5.0-rc.4 → 20.6.0-beta.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 +3 -1
- package/package.json +11 -11
- package/src/adapter/compat.d.ts +1 -1
- package/src/adapter/compat.js +1 -0
- package/src/command-line/nx-commands.js +19 -5
- package/src/command-line/register/command-object.d.ts +6 -0
- package/src/command-line/{activate-powerpack → register}/command-object.js +9 -9
- package/src/command-line/register/register.d.ts +2 -0
- package/src/command-line/register/register.js +25 -0
- package/src/command-line/report/report.d.ts +3 -3
- package/src/command-line/report/report.js +32 -32
- package/src/config/nx-json.d.ts +4 -0
- package/src/core/graph/main.js +1 -1
- package/src/native/index.d.ts +5 -4
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/tasks-runner/cache.d.ts +17 -6
- package/src/tasks-runner/cache.js +72 -21
- package/src/tasks-runner/run-command.js +2 -2
- package/src/tasks-runner/task-orchestrator.js +6 -1
- package/src/utils/nx-key.d.ts +7 -0
- package/src/utils/nx-key.js +52 -0
- package/src/utils/require-nx-key.d.ts +1 -0
- package/src/utils/require-nx-key.js +22 -0
- package/src/command-line/activate-powerpack/activate-powerpack.d.ts +0 -2
- package/src/command-line/activate-powerpack/activate-powerpack.js +0 -34
- 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
@@ -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.
|
3
|
+
"version": "20.6.0-beta.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": {
|
@@ -82,16 +82,16 @@
|
|
82
82
|
}
|
83
83
|
},
|
84
84
|
"optionalDependencies": {
|
85
|
-
"@nx/nx-darwin-arm64": "20.
|
86
|
-
"@nx/nx-darwin-x64": "20.
|
87
|
-
"@nx/nx-freebsd-x64": "20.
|
88
|
-
"@nx/nx-linux-arm-gnueabihf": "20.
|
89
|
-
"@nx/nx-linux-arm64-gnu": "20.
|
90
|
-
"@nx/nx-linux-arm64-musl": "20.
|
91
|
-
"@nx/nx-linux-x64-gnu": "20.
|
92
|
-
"@nx/nx-linux-x64-musl": "20.
|
93
|
-
"@nx/nx-win32-arm64-msvc": "20.
|
94
|
-
"@nx/nx-win32-x64-msvc": "20.
|
85
|
+
"@nx/nx-darwin-arm64": "20.6.0-beta.0",
|
86
|
+
"@nx/nx-darwin-x64": "20.6.0-beta.0",
|
87
|
+
"@nx/nx-freebsd-x64": "20.6.0-beta.0",
|
88
|
+
"@nx/nx-linux-arm-gnueabihf": "20.6.0-beta.0",
|
89
|
+
"@nx/nx-linux-arm64-gnu": "20.6.0-beta.0",
|
90
|
+
"@nx/nx-linux-arm64-musl": "20.6.0-beta.0",
|
91
|
+
"@nx/nx-linux-x64-gnu": "20.6.0-beta.0",
|
92
|
+
"@nx/nx-linux-x64-musl": "20.6.0-beta.0",
|
93
|
+
"@nx/nx-win32-arm64-msvc": "20.6.0-beta.0",
|
94
|
+
"@nx/nx-win32-x64-msvc": "20.6.0-beta.0"
|
95
95
|
},
|
96
96
|
"nx-migrations": {
|
97
97
|
"migrations": "./migrations.json",
|
package/src/adapter/compat.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
export declare const allowedProjectExtensions: readonly ["tags", "implicitDependencies", "configFilePath", "$schema", "generators", "namedInputs", "name", "files", "root", "sourceRoot", "projectType", "release", "includedScripts", "metadata"];
|
2
|
-
export declare const allowedWorkspaceExtensions: readonly ["$schema", "implicitDependencies", "affected", "defaultBase", "tasksRunnerOptions", "workspaceLayout", "plugins", "targetDefaults", "files", "generators", "namedInputs", "extends", "cli", "pluginsConfig", "defaultProject", "installation", "release", "nxCloudAccessToken", "nxCloudId", "nxCloudUrl", "nxCloudEncryptionKey", "parallel", "cacheDirectory", "useDaemonProcess", "useInferencePlugins", "neverConnectToCloud", "sync", "useLegacyCache"];
|
2
|
+
export declare const allowedWorkspaceExtensions: readonly ["$schema", "implicitDependencies", "affected", "defaultBase", "tasksRunnerOptions", "workspaceLayout", "plugins", "targetDefaults", "files", "generators", "namedInputs", "extends", "cli", "pluginsConfig", "defaultProject", "installation", "release", "nxCloudAccessToken", "nxCloudId", "nxCloudUrl", "nxCloudEncryptionKey", "parallel", "cacheDirectory", "useDaemonProcess", "useInferencePlugins", "neverConnectToCloud", "sync", "useLegacyCache", "maxCacheSize"];
|
package/src/adapter/compat.js
CHANGED
@@ -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("./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.
|
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
|
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,25 +1,25 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
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.
|
7
|
-
command: '
|
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('
|
15
|
+
.positional('key', {
|
16
16
|
type: 'string',
|
17
|
-
description: 'This is a
|
17
|
+
description: 'This is a key for Nx.',
|
18
18
|
})
|
19
|
-
.example('$0
|
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('./
|
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,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
|
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,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 (nxKey) {
|
65
65
|
bodyLines.push('');
|
66
66
|
bodyLines.push(LINE_SEPARATOR);
|
67
|
-
bodyLines.push(chalk.green('Nx
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
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.`);
|
67
|
+
bodyLines.push(chalk.green('Nx key licensed packages'));
|
68
|
+
bodyLines.push((0, nx_key_1.createNxKeyLicenseeInformation)(nxKey));
|
69
|
+
if (nxKey.realExpiresAt || nxKey.expiresAt) {
|
70
|
+
const licenseExpiryDate = new Date((nxKey.realExpiresAt ?? nxKey.expiresAt) * 1000);
|
71
|
+
// license is not expired
|
72
|
+
if (licenseExpiryDate.getTime() >= Date.now()) {
|
73
|
+
if ('perpetualNxVersion' in nxKey) {
|
74
|
+
bodyLines.push(`License expires on ${licenseExpiryDate.toLocaleDateString()}, but will continue to work with Nx ${nxKey.perpetualNxVersion} and below.`);
|
75
|
+
}
|
76
|
+
else {
|
77
|
+
bodyLines.push(`License expires on ${licenseExpiryDate.toLocaleDateString()}.`);
|
78
|
+
}
|
84
79
|
}
|
85
80
|
else {
|
86
|
-
|
81
|
+
if ('perpetualNxVersion' in nxKey) {
|
82
|
+
bodyLines.push(`License expired on ${licenseExpiryDate.toLocaleDateString()}, but will continue to work with Nx ${nxKey.perpetualNxVersion} and below.`);
|
83
|
+
}
|
84
|
+
else {
|
85
|
+
bodyLines.push(`License expired on ${licenseExpiryDate.toLocaleDateString()}.`);
|
86
|
+
}
|
87
87
|
}
|
88
88
|
}
|
89
89
|
bodyLines.push('');
|
@@ -94,11 +94,11 @@ async function reportHandler() {
|
|
94
94
|
}
|
95
95
|
bodyLines.push('');
|
96
96
|
}
|
97
|
-
else if (
|
97
|
+
else if (nxKeyError) {
|
98
98
|
bodyLines.push('');
|
99
|
-
bodyLines.push(chalk.red('Nx
|
99
|
+
bodyLines.push(chalk.red('Nx key'));
|
100
100
|
bodyLines.push(LINE_SEPARATOR);
|
101
|
-
bodyLines.push(
|
101
|
+
bodyLines.push(nxKeyError.message);
|
102
102
|
bodyLines.push('');
|
103
103
|
}
|
104
104
|
if (registeredPlugins.length) {
|
@@ -165,20 +165,20 @@ async function getReportData() {
|
|
165
165
|
}
|
166
166
|
const outOfSyncPackageGroup = findMisalignedPackagesForPackage(nxPackageJson);
|
167
167
|
const native = isNativeAvailable();
|
168
|
-
let
|
169
|
-
let
|
168
|
+
let nxKey = null;
|
169
|
+
let nxKeyError = null;
|
170
170
|
try {
|
171
|
-
|
171
|
+
nxKey = await (0, nx_key_1.getNxKeyInformation)();
|
172
172
|
}
|
173
173
|
catch (e) {
|
174
|
-
if (!(e instanceof
|
175
|
-
|
174
|
+
if (!(e instanceof nx_key_1.NxKeyNotInstalledError)) {
|
175
|
+
nxKeyError = e;
|
176
176
|
}
|
177
177
|
}
|
178
178
|
return {
|
179
179
|
pm,
|
180
|
-
|
181
|
-
|
180
|
+
nxKey,
|
181
|
+
nxKeyError,
|
182
182
|
powerpackPlugins,
|
183
183
|
pmVersion,
|
184
184
|
localPlugins,
|
@@ -256,7 +256,7 @@ function findMisalignedPackagesForPackage(base) {
|
|
256
256
|
}
|
257
257
|
function findInstalledPowerpackPlugins() {
|
258
258
|
const installedPlugins = (0, installed_plugins_1.findInstalledPlugins)();
|
259
|
-
return installedPlugins.filter((dep) => new RegExp('@nx/powerpack*').test(dep.name));
|
259
|
+
return installedPlugins.filter((dep) => new RegExp('@nx/powerpack*|@nx/(.+)-cache|@nx/(conformance|owners|enterprise*)').test(dep.name));
|
260
260
|
}
|
261
261
|
function findInstalledCommunityPlugins() {
|
262
262
|
const installedPlugins = (0, installed_plugins_1.findInstalledPlugins)();
|
package/src/config/nx-json.d.ts
CHANGED
@@ -490,6 +490,10 @@ export interface NxJsonConfiguration<T = '*' | string[]> {
|
|
490
490
|
* Use the legacy file system cache instead of the db cache
|
491
491
|
*/
|
492
492
|
useLegacyCache?: boolean;
|
493
|
+
/**
|
494
|
+
* Sets the maximum size of the local cache. Accepts a number followed by a unit (e.g. 100MB). Accepted units are B, KB, MB, and GB.
|
495
|
+
*/
|
496
|
+
maxCacheSize?: string;
|
493
497
|
}
|
494
498
|
export type PluginConfiguration = string | ExpandedPluginConfiguration;
|
495
499
|
export type ExpandedPluginConfiguration<T = unknown> = {
|