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 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.5.0-rc.4",
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.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"
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",
@@ -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"];
@@ -65,6 +65,7 @@ exports.allowedWorkspaceExtensions = [
65
65
  'neverConnectToCloud',
66
66
  'sync',
67
67
  'useLegacyCache',
68
+ 'maxCacheSize',
68
69
  ];
69
70
  if (!patched) {
70
71
  Module.prototype.require = function () {
@@ -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 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, powerpackLicense, powerpackError, localPlugins, powerpackPlugins, communityPlugins, registeredPlugins, packageVersionsWeCareAbout, outOfSyncPackageGroup, projectGraphError, nativeTarget, } = await getReportData();
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 (powerpackLicense) {
64
+ if (nxKey) {
65
65
  bodyLines.push('');
66
66
  bodyLines.push(LINE_SEPARATOR);
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
70
- ? 'an unlimited number of'
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.`);
76
- }
77
- else {
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.`);
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
- bodyLines.push(`License expired on ${licenseExpiryDate.toLocaleDateString()}.`);
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 (powerpackError) {
97
+ else if (nxKeyError) {
98
98
  bodyLines.push('');
99
- bodyLines.push(chalk.red('Nx Powerpack'));
99
+ bodyLines.push(chalk.red('Nx key'));
100
100
  bodyLines.push(LINE_SEPARATOR);
101
- bodyLines.push(powerpackError.message);
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 powerpackLicense = null;
169
- let powerpackError = null;
168
+ let nxKey = null;
169
+ let nxKeyError = null;
170
170
  try {
171
- powerpackLicense = await (0, powerpack_1.getPowerpackLicenseInformation)();
171
+ nxKey = await (0, nx_key_1.getNxKeyInformation)();
172
172
  }
173
173
  catch (e) {
174
- if (!(e instanceof powerpack_1.NxPowerpackNotInstalledError)) {
175
- powerpackError = e;
174
+ if (!(e instanceof nx_key_1.NxKeyNotInstalledError)) {
175
+ nxKeyError = e;
176
176
  }
177
177
  }
178
178
  return {
179
179
  pm,
180
- powerpackLicense,
181
- powerpackError,
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)();
@@ -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> = {