nx 20.4.3 → 20.4.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "20.4.3",
3
+ "version": "20.4.5",
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.4.3",
86
- "@nx/nx-darwin-x64": "20.4.3",
87
- "@nx/nx-freebsd-x64": "20.4.3",
88
- "@nx/nx-linux-arm-gnueabihf": "20.4.3",
89
- "@nx/nx-linux-arm64-gnu": "20.4.3",
90
- "@nx/nx-linux-arm64-musl": "20.4.3",
91
- "@nx/nx-linux-x64-gnu": "20.4.3",
92
- "@nx/nx-linux-x64-musl": "20.4.3",
93
- "@nx/nx-win32-arm64-msvc": "20.4.3",
94
- "@nx/nx-win32-x64-msvc": "20.4.3"
85
+ "@nx/nx-darwin-arm64": "20.4.5",
86
+ "@nx/nx-darwin-x64": "20.4.5",
87
+ "@nx/nx-freebsd-x64": "20.4.5",
88
+ "@nx/nx-linux-arm-gnueabihf": "20.4.5",
89
+ "@nx/nx-linux-arm64-gnu": "20.4.5",
90
+ "@nx/nx-linux-arm64-musl": "20.4.5",
91
+ "@nx/nx-linux-x64-gnu": "20.4.5",
92
+ "@nx/nx-linux-x64-musl": "20.4.5",
93
+ "@nx/nx-win32-arm64-msvc": "20.4.5",
94
+ "@nx/nx-win32-x64-msvc": "20.4.5"
95
95
  },
96
96
  "nx-migrations": {
97
97
  "migrations": "./migrations.json",
@@ -21,6 +21,10 @@
21
21
  "additionalProperties": false,
22
22
  "deprecated": "Use `defaultBase` instead. Support for setting `defaultBase` in `affected` will be removed in Nx 20."
23
23
  },
24
+ "extends": {
25
+ "type": "string",
26
+ "description": "Specifies the base config to extend."
27
+ },
24
28
  "defaultBase": {
25
29
  "type": "string",
26
30
  "description": "Default --base used by affected logic."
@@ -5,7 +5,6 @@ exports.addHandler = addHandler;
5
5
  const child_process_1 = require("child_process");
6
6
  const fs_1 = require("fs");
7
7
  const ora = require("ora");
8
- const yargsParser = require("yargs-parser");
9
8
  const nx_json_1 = require("../../config/nx-json");
10
9
  const child_process_2 = require("../../utils/child-process");
11
10
  const fileutils_1 = require("../../utils/fileutils");
@@ -79,27 +78,18 @@ async function installPackage(pkgName, version, nxJson) {
79
78
  spinner.succeed();
80
79
  }
81
80
  async function initializePlugin(pkgName, options, nxJson) {
82
- const parsedCommandArgs = yargsParser(options.__overrides_unparsed__, {
83
- configuration: {
84
- 'parse-numbers': false,
85
- 'parse-positional-numbers': false,
86
- 'dot-notation': false,
87
- 'camel-case-expansion': false,
88
- },
89
- });
90
- if (exports.coreNxPluginVersions.has(pkgName)) {
91
- parsedCommandArgs.keepExistingVersions = true;
92
- if (options.updatePackageScripts ||
81
+ let updatePackageScripts = false;
82
+ if (exports.coreNxPluginVersions.has(pkgName) &&
83
+ (options.updatePackageScripts ||
93
84
  (options.updatePackageScripts === undefined &&
94
85
  nxJson.useInferencePlugins !== false &&
95
- process.env.NX_ADD_PLUGINS !== 'false')) {
96
- parsedCommandArgs.updatePackageScripts = true;
97
- }
86
+ process.env.NX_ADD_PLUGINS !== 'false'))) {
87
+ updatePackageScripts = true;
98
88
  }
99
89
  const spinner = ora(`Initializing ${pkgName}...`);
100
90
  spinner.start();
101
91
  try {
102
- await (0, configure_plugins_1.installPlugin)(pkgName, workspace_root_1.workspaceRoot, options.verbose, parsedCommandArgs);
92
+ await (0, configure_plugins_1.installPlugin)(pkgName, workspace_root_1.workspaceRoot, updatePackageScripts, options.verbose);
103
93
  }
104
94
  catch (e) {
105
95
  spinner.fail();
@@ -4,19 +4,18 @@ export declare function runPackageManagerInstallPlugins(repoRoot: string, pmc: P
4
4
  * Installs a plugin by running its init generator. It will change the file system tree passed in.
5
5
  * @param plugin The name of the plugin to install
6
6
  * @param repoRoot repo root
7
- * @param verbose verbose
8
- * @param options options passed to init generator
7
+ * @param pmc package manager commands
8
+ * @param updatePackageScripts whether to update package scripts
9
+ * @param verbose whether to run in verbose mode
9
10
  * @returns void
10
11
  */
11
- export declare function installPlugin(plugin: string, repoRoot: string, verbose: boolean, options: {
12
- [k: string]: any;
13
- }): Promise<void>;
12
+ export declare function installPlugin(plugin: string, repoRoot?: string, updatePackageScripts?: boolean, verbose?: boolean, pmc?: PackageManagerCommands): Promise<void>;
14
13
  /**
15
14
  * Install plugins
16
15
  * Get the implementation of the plugin's init generator and run it
17
16
  * @returns a list of succeeded plugins and a map of failed plugins to errors
18
17
  */
19
- export declare function installPlugins(plugins: string[], updatePackageScripts: boolean, repoRoot?: string, verbose?: boolean): Promise<{
18
+ export declare function installPlugins(plugins: string[], updatePackageScripts: boolean, pmc: PackageManagerCommands, repoRoot?: string, verbose?: boolean): Promise<{
20
19
  succeededPlugins: string[];
21
20
  failedPlugins: {
22
21
  [plugin: string]: Error;
@@ -7,10 +7,9 @@ exports.configurePlugins = configurePlugins;
7
7
  exports.getFailedToInstallPluginErrorMessages = getFailedToInstallPluginErrorMessages;
8
8
  const createSpinner = require("ora");
9
9
  const chalk_1 = require("chalk");
10
+ const child_process_1 = require("child_process");
10
11
  const package_manager_1 = require("../../utils/package-manager");
11
12
  const output_1 = require("../../utils/output");
12
- const tree_1 = require("../../generators/tree");
13
- const generator_utils_1 = require("../generate/generator-utils");
14
13
  const workspace_root_1 = require("../../utils/workspace-root");
15
14
  const utils_1 = require("./implementation/utils");
16
15
  const plugins_1 = require("../../utils/plugins");
@@ -27,12 +26,12 @@ function runPackageManagerInstallPlugins(repoRoot, pmc = (0, package_manager_1.g
27
26
  * Installs a plugin by running its init generator. It will change the file system tree passed in.
28
27
  * @param plugin The name of the plugin to install
29
28
  * @param repoRoot repo root
30
- * @param verbose verbose
31
- * @param options options passed to init generator
29
+ * @param pmc package manager commands
30
+ * @param updatePackageScripts whether to update package scripts
31
+ * @param verbose whether to run in verbose mode
32
32
  * @returns void
33
33
  */
34
- async function installPlugin(plugin, repoRoot = workspace_root_1.workspaceRoot, verbose = false, options) {
35
- const host = new tree_1.FsTree(repoRoot, verbose, `install ${plugin}`);
34
+ async function installPlugin(plugin, repoRoot = workspace_root_1.workspaceRoot, updatePackageScripts = false, verbose = false, pmc = (0, package_manager_1.getPackageManagerCommand)()) {
36
35
  const capabilities = await (0, plugins_1.getPluginCapabilities)(repoRoot, plugin, {});
37
36
  const generators = capabilities?.generators;
38
37
  if (!generators) {
@@ -45,20 +44,18 @@ async function installPlugin(plugin, repoRoot = workspace_root_1.workspaceRoot,
45
44
  });
46
45
  return;
47
46
  }
48
- const { implementationFactory } = (0, generator_utils_1.getGeneratorInformation)(plugin, initGenerator, repoRoot, {});
49
- const implementation = implementationFactory();
50
- const task = await implementation(host, options);
51
- (0, tree_1.flushChanges)(repoRoot, host.listChanges());
52
- if (task) {
53
- await task();
54
- }
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
+ });
55
52
  }
56
53
  /**
57
54
  * Install plugins
58
55
  * Get the implementation of the plugin's init generator and run it
59
56
  * @returns a list of succeeded plugins and a map of failed plugins to errors
60
57
  */
61
- async function installPlugins(plugins, updatePackageScripts, repoRoot = workspace_root_1.workspaceRoot, verbose = false) {
58
+ async function installPlugins(plugins, updatePackageScripts, pmc, repoRoot = workspace_root_1.workspaceRoot, verbose = false) {
62
59
  if (plugins.length === 0) {
63
60
  return {
64
61
  succeededPlugins: [],
@@ -71,13 +68,7 @@ async function installPlugins(plugins, updatePackageScripts, repoRoot = workspac
71
68
  for (const plugin of plugins) {
72
69
  try {
73
70
  spinner.start('Installing plugin ' + plugin);
74
- await installPlugin(plugin, repoRoot, verbose, {
75
- keepExistingVersions: true,
76
- updatePackageScripts,
77
- addPlugin: true,
78
- skipFormat: false,
79
- skipPackageJson: false,
80
- });
71
+ await installPlugin(plugin, repoRoot, updatePackageScripts, verbose, pmc);
81
72
  succeededPlugins.push(plugin);
82
73
  spinner.succeed('Installed plugin ' + plugin);
83
74
  }
@@ -103,7 +94,7 @@ async function configurePlugins(plugins, updatePackageScripts, pmc, repoRoot = w
103
94
  };
104
95
  }
105
96
  output_1.output.log({ title: '🔨 Configuring plugins' });
106
- let { succeededPlugins, failedPlugins } = await installPlugins(plugins, updatePackageScripts, repoRoot, verbose);
97
+ let { succeededPlugins, failedPlugins } = await installPlugins(plugins, updatePackageScripts, pmc, repoRoot, verbose);
107
98
  if (succeededPlugins.length > 0) {
108
99
  output_1.output.success({
109
100
  title: 'Installed Plugins',
@@ -58,6 +58,7 @@ export type PlanCheckOptions = BaseNxReleaseArgs & {
58
58
  export type ReleaseOptions = NxReleaseArgs & FirstReleaseArgs & {
59
59
  specifier?: string;
60
60
  yes?: boolean;
61
+ preid?: VersionOptions['preid'];
61
62
  skipPublish?: boolean;
62
63
  };
63
64
  export type VersionPlanArgs = {
@@ -75,6 +75,11 @@ const releaseCommand = {
75
75
  .positional('specifier', {
76
76
  type: 'string',
77
77
  describe: 'Exact version or semver keyword to apply to the selected release group.',
78
+ })
79
+ .option('preid', {
80
+ type: 'string',
81
+ describe: 'The optional prerelease identifier to apply to the version. This will only be applied in the case that the specifier argument has been set to `prerelease` OR when conventional commits are enabled, in which case it will modify the resolved specifier from conventional commits to be its prerelease equivalent. E.g. minor -> preminor.',
82
+ default: '',
78
83
  })
79
84
  .option('yes', {
80
85
  type: 'boolean',
@@ -172,7 +172,7 @@ export declare export function getFilesForOutputs(directory: string, entries: Ar
172
172
 
173
173
  export declare export function getTransformableOutputs(outputs: Array<string>): Array<string>
174
174
 
175
- export declare export function hashArray(input: Array<string>): string
175
+ export declare export function hashArray(input: Array<string | undefined | null>): string
176
176
 
177
177
  export interface HashDetails {
178
178
  value: string
@@ -88,13 +88,13 @@ function __napi_rs_initialize_modules(__napiInstance) {
88
88
  __napiInstance.exports['__napi_register__FileLock_struct_39']?.()
89
89
  __napiInstance.exports['__napi_register__FileLock_impl_41']?.()
90
90
  __napiInstance.exports['__napi_register__WorkspaceContext_struct_42']?.()
91
- __napiInstance.exports['__napi_register__WorkspaceContext_impl_51']?.()
92
- __napiInstance.exports['__napi_register__WorkspaceErrors_52']?.()
93
- __napiInstance.exports['__napi_register__NxWorkspaceFiles_struct_53']?.()
94
- __napiInstance.exports['__napi_register__NxWorkspaceFilesExternals_struct_54']?.()
95
- __napiInstance.exports['__napi_register__UpdatedWorkspaceFiles_struct_55']?.()
96
- __napiInstance.exports['__napi_register__FileMap_struct_56']?.()
97
- __napiInstance.exports['__napi_register____test_only_transfer_file_map_57']?.()
91
+ __napiInstance.exports['__napi_register__WorkspaceContext_impl_52']?.()
92
+ __napiInstance.exports['__napi_register__WorkspaceErrors_53']?.()
93
+ __napiInstance.exports['__napi_register__NxWorkspaceFiles_struct_54']?.()
94
+ __napiInstance.exports['__napi_register__NxWorkspaceFilesExternals_struct_55']?.()
95
+ __napiInstance.exports['__napi_register__UpdatedWorkspaceFiles_struct_56']?.()
96
+ __napiInstance.exports['__napi_register__FileMap_struct_57']?.()
97
+ __napiInstance.exports['__napi_register____test_only_transfer_file_map_58']?.()
98
98
  }
99
99
  export const FileLock = __napiModule.exports.FileLock
100
100
  export const HashPlanner = __napiModule.exports.HashPlanner
Binary file
@@ -23,11 +23,11 @@ function readTsConfigOptions(tsConfigPath) {
23
23
  tsModule = require('typescript');
24
24
  }
25
25
  const readResult = tsModule.readConfigFile(tsConfigPath, tsModule.sys.readFile);
26
- // we don't need to scan the files, we only care about options
26
+ // We only care about options, so we don't need to scan source files, and thus
27
+ // `readDirectory` is stubbed for performance.
27
28
  const host = {
29
+ ...tsModule.sys,
28
30
  readDirectory: () => [],
29
- readFile: () => '',
30
- fileExists: tsModule.sys.fileExists,
31
31
  };
32
32
  return tsModule.parseJsonConfigFileContent(readResult.config, host, (0, path_1.dirname)(tsConfigPath)).options;
33
33
  }
@@ -182,12 +182,14 @@ const server = (0, net_1.createServer)((socket) => {
182
182
  });
183
183
  });
184
184
  server.listen(socketPath);
185
- setTimeout(() => {
186
- if (!connected) {
187
- console.error('The plugin worker is exiting as it was not connected to within 5 seconds.');
188
- process.exit(1);
189
- }
190
- }, 5000).unref();
185
+ if (process.env.NX_PLUGIN_NO_TIMEOUTS !== 'true') {
186
+ setTimeout(() => {
187
+ if (!connected) {
188
+ console.error('The plugin worker is exiting as it was not connected to within 5 seconds.');
189
+ process.exit(1);
190
+ }
191
+ }, 5000).unref();
192
+ }
191
193
  const exitHandler = (exitCode) => () => {
192
194
  server.close();
193
195
  try {