nx 20.5.0-rc.3 → 20.5.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,7 +131,6 @@
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
135
  "@nx/powerpack-conformance"
137
136
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "20.5.0-rc.3",
3
+ "version": "20.5.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.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"
85
+ "@nx/nx-darwin-arm64": "20.5.0",
86
+ "@nx/nx-darwin-x64": "20.5.0",
87
+ "@nx/nx-freebsd-x64": "20.5.0",
88
+ "@nx/nx-linux-arm-gnueabihf": "20.5.0",
89
+ "@nx/nx-linux-arm64-gnu": "20.5.0",
90
+ "@nx/nx-linux-arm64-musl": "20.5.0",
91
+ "@nx/nx-linux-x64-gnu": "20.5.0",
92
+ "@nx/nx-linux-x64-musl": "20.5.0",
93
+ "@nx/nx-win32-arm64-msvc": "20.5.0",
94
+ "@nx/nx-win32-x64-msvc": "20.5.0"
95
95
  },
96
96
  "nx-migrations": {
97
97
  "migrations": "./migrations.json",
@@ -0,0 +1,2 @@
1
+ import { ActivatePowerpackOptions } from './command-object';
2
+ export declare function handleActivatePowerpack(options: ActivatePowerpackOptions): Promise<void>;
@@ -1,33 +1,33 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.handleActivateKey = handleActivateKey;
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 handleActivateKey(options) {
9
- const key = options.key ??
8
+ async function handleActivatePowerpack(options) {
9
+ const license = options.license ??
10
10
  (await (0, enquirer_1.prompt)({
11
11
  type: 'input',
12
- name: 'key',
13
- message: 'Enter your key',
12
+ name: 'license',
13
+ message: 'Enter your License Key',
14
14
  }));
15
- const { activateNxKey } = await requireNxKey();
16
- activateNxKey(workspace_root_1.workspaceRoot, key);
15
+ const { activatePowerpack } = await requirePowerpack();
16
+ activatePowerpack(workspace_root_1.workspaceRoot, license);
17
17
  }
18
- async function requireNxKey() {
18
+ async function requirePowerpack() {
19
19
  // @ts-ignore
20
- return Promise.resolve().then(() => require('@nx/key')).catch(async (e) => {
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/key@latest`, {
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/key'));
27
+ return await Promise.resolve().then(() => require('@nx/powerpack-license'));
28
28
  }
29
29
  catch (e) {
30
- throw new Error('Failed to install @nx/key. Please install @nx/key and try again.');
30
+ throw new Error('Failed to install @nx/powerpack-license. Please install @nx/powerpack-license and try again.');
31
31
  }
32
32
  }
33
33
  });
@@ -0,0 +1,6 @@
1
+ import { CommandModule } from 'yargs';
2
+ export interface ActivatePowerpackOptions {
3
+ license: string;
4
+ verbose: boolean;
5
+ }
6
+ export declare const yargsActivatePowerpackCommand: CommandModule<{}, ActivatePowerpackOptions>;
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.yargsActivateKeyCommand = void 0;
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.yargsActivateKeyCommand = {
7
- command: 'activate-key <key>',
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('key', {
15
+ .positional('license', {
17
16
  type: 'string',
18
- description: 'This is a key for Nx.',
17
+ description: 'This is a License Key for Nx Powerpack.',
19
18
  })
20
- .example('$0 activate-key <key>', 'Activate a Nx key'),
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-key'))).handleActivateKey(args);
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
- const capabilities = await (0, plugins_1.getPluginCapabilities)(repoRoot, plugin, {});
36
- const generators = capabilities?.generators;
37
- if (!generators) {
38
- throw new Error(`No generators found in ${plugin}.`);
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
- const initGenerator = findInitGenerator(generators);
41
- if (!initGenerator) {
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-key/command-object");
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.yargsActivateKeyCommand)
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 Nx key and the \`@nx/conformance\` plugin installed.`,
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 { type NxKey } from '@nx/key';
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
- nxKey: NxKey | null;
20
- nxKeyError: Error | null;
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 nx_key_1 = require("../../utils/nx-key");
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, nxKey, nxKeyError, localPlugins, powerpackPlugins, communityPlugins, registeredPlugins, packageVersionsWeCareAbout, outOfSyncPackageGroup, projectGraphError, nativeTarget, } = await getReportData();
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 (nxKey) {
64
+ if (powerpackLicense) {
65
65
  bodyLines.push('');
66
66
  bodyLines.push(LINE_SEPARATOR);
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
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
- : 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
- }
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
- 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
- }
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 (nxKeyError) {
97
+ else if (powerpackError) {
100
98
  bodyLines.push('');
101
- bodyLines.push(chalk.red('Nx key'));
99
+ bodyLines.push(chalk.red('Nx Powerpack'));
102
100
  bodyLines.push(LINE_SEPARATOR);
103
- bodyLines.push(nxKeyError.message);
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 nxKey = null;
171
- let nxKeyError = null;
168
+ let powerpackLicense = null;
169
+ let powerpackError = null;
172
170
  try {
173
- nxKey = await (0, nx_key_1.getNxKeyInformation)();
171
+ powerpackLicense = await (0, powerpack_1.getPowerpackLicenseInformation)();
174
172
  }
175
173
  catch (e) {
176
- if (!(e instanceof nx_key_1.NxKeyNotInstalledError)) {
177
- nxKeyError = e;
174
+ if (!(e instanceof powerpack_1.NxPowerpackNotInstalledError)) {
175
+ powerpackError = e;
178
176
  }
179
177
  }
180
178
  return {
181
179
  pm,
182
- nxKey,
183
- nxKeyError,
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*|@nx/(.+)-cache|@nx/(conformance|owners|enterprise*)').test(dep.name));
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)();