nx 20.7.0-canary.20250327-1a235d7 → 20.7.0-canary.20250328-4a3a824
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 +11 -11
- package/src/command-line/add/add.js +1 -1
- package/src/command-line/generate/generator-utils.js +8 -3
- package/src/command-line/import/import.js +1 -1
- package/src/command-line/init/configure-plugins.d.ts +3 -3
- package/src/command-line/init/configure-plugins.js +29 -13
- package/src/command-line/init/implementation/utils.js +3 -2
- package/src/command-line/init/init-v2.js +11 -24
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/utils/child-process.d.ts +4 -0
- package/src/utils/child-process.js +23 -30
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "20.7.0-canary.
|
3
|
+
"version": "20.7.0-canary.20250328-4a3a824",
|
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.7.0-canary.
|
86
|
-
"@nx/nx-darwin-x64": "20.7.0-canary.
|
87
|
-
"@nx/nx-freebsd-x64": "20.7.0-canary.
|
88
|
-
"@nx/nx-linux-arm-gnueabihf": "20.7.0-canary.
|
89
|
-
"@nx/nx-linux-arm64-gnu": "20.7.0-canary.
|
90
|
-
"@nx/nx-linux-arm64-musl": "20.7.0-canary.
|
91
|
-
"@nx/nx-linux-x64-gnu": "20.7.0-canary.
|
92
|
-
"@nx/nx-linux-x64-musl": "20.7.0-canary.
|
93
|
-
"@nx/nx-win32-arm64-msvc": "20.7.0-canary.
|
94
|
-
"@nx/nx-win32-x64-msvc": "20.7.0-canary.
|
85
|
+
"@nx/nx-darwin-arm64": "20.7.0-canary.20250328-4a3a824",
|
86
|
+
"@nx/nx-darwin-x64": "20.7.0-canary.20250328-4a3a824",
|
87
|
+
"@nx/nx-freebsd-x64": "20.7.0-canary.20250328-4a3a824",
|
88
|
+
"@nx/nx-linux-arm-gnueabihf": "20.7.0-canary.20250328-4a3a824",
|
89
|
+
"@nx/nx-linux-arm64-gnu": "20.7.0-canary.20250328-4a3a824",
|
90
|
+
"@nx/nx-linux-arm64-musl": "20.7.0-canary.20250328-4a3a824",
|
91
|
+
"@nx/nx-linux-x64-gnu": "20.7.0-canary.20250328-4a3a824",
|
92
|
+
"@nx/nx-linux-x64-musl": "20.7.0-canary.20250328-4a3a824",
|
93
|
+
"@nx/nx-win32-arm64-msvc": "20.7.0-canary.20250328-4a3a824",
|
94
|
+
"@nx/nx-win32-x64-msvc": "20.7.0-canary.20250328-4a3a824"
|
95
95
|
},
|
96
96
|
"nx-migrations": {
|
97
97
|
"migrations": "./migrations.json",
|
@@ -89,7 +89,7 @@ async function initializePlugin(pkgName, options, nxJson) {
|
|
89
89
|
const spinner = ora(`Initializing ${pkgName}...`);
|
90
90
|
spinner.start();
|
91
91
|
try {
|
92
|
-
await (0, configure_plugins_1.
|
92
|
+
await (0, configure_plugins_1.runPluginInitGenerator)(pkgName, workspace_root_1.workspaceRoot, updatePackageScripts, options.verbose);
|
93
93
|
}
|
94
94
|
catch (e) {
|
95
95
|
spinner.fail();
|
@@ -6,6 +6,7 @@ const path_1 = require("path");
|
|
6
6
|
const schema_utils_1 = require("../../config/schema-utils");
|
7
7
|
const fileutils_1 = require("../../utils/fileutils");
|
8
8
|
const plugins_1 = require("../../project-graph/plugins");
|
9
|
+
const installation_directory_1 = require("../../utils/installation-directory");
|
9
10
|
function getGeneratorInformation(collectionName, generatorName, root, projects) {
|
10
11
|
try {
|
11
12
|
const { generatorsFilePath, generatorsJson, resolvedCollectionName, normalizedGeneratorName, } = readGeneratorsJson(collectionName, generatorName, root, projects);
|
@@ -37,18 +38,22 @@ function getGeneratorInformation(collectionName, generatorName, root, projects)
|
|
37
38
|
};
|
38
39
|
}
|
39
40
|
catch (e) {
|
40
|
-
throw new Error(`Unable to resolve ${collectionName}:${generatorName}.\n${e.message}`);
|
41
|
+
throw new Error(`Unable to resolve ${collectionName}:${generatorName}.\n${process.env.NX_VERBOSE_LOGGING === 'true' ? e.stack : e.message}`);
|
41
42
|
}
|
42
43
|
}
|
43
44
|
function readGeneratorsJson(collectionName, generator, root, projects) {
|
44
45
|
let generatorsFilePath;
|
45
46
|
if (collectionName.endsWith('.json')) {
|
46
47
|
generatorsFilePath = require.resolve(collectionName, {
|
47
|
-
paths: root
|
48
|
+
paths: root
|
49
|
+
? [...(0, installation_directory_1.getNxRequirePaths)(root), __dirname]
|
50
|
+
: [...(0, installation_directory_1.getNxRequirePaths)(), __dirname],
|
48
51
|
});
|
49
52
|
}
|
50
53
|
else {
|
51
|
-
const { json: packageJson, path: packageJsonPath } = (0, plugins_1.readPluginPackageJson)(collectionName, projects, root
|
54
|
+
const { json: packageJson, path: packageJsonPath } = (0, plugins_1.readPluginPackageJson)(collectionName, projects, root
|
55
|
+
? [...(0, installation_directory_1.getNxRequirePaths)(root), __dirname]
|
56
|
+
: [...(0, installation_directory_1.getNxRequirePaths)(), __dirname]);
|
52
57
|
const generatorsFile = packageJson.generators ?? packageJson.schematics;
|
53
58
|
if (!generatorsFile) {
|
54
59
|
throw new Error(`The "${collectionName}" package does not support Nx generators.`);
|
@@ -287,7 +287,7 @@ async function runPluginsInstall(plugins, pmc, destinationGitClient) {
|
|
287
287
|
let installed = true;
|
288
288
|
output_1.output.log({ title: 'Installing Plugins' });
|
289
289
|
try {
|
290
|
-
(0, configure_plugins_1.
|
290
|
+
(0, configure_plugins_1.installPluginPackages)(workspace_root_1.workspaceRoot, pmc, plugins);
|
291
291
|
await destinationGitClient.amendCommit();
|
292
292
|
}
|
293
293
|
catch (e) {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { PackageManagerCommands } from '../../utils/package-manager';
|
2
|
-
export declare function
|
2
|
+
export declare function installPluginPackages(repoRoot: string, pmc: PackageManagerCommands, plugins: string[]): void;
|
3
3
|
/**
|
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
|
@@ -9,13 +9,13 @@ export declare function runPackageManagerInstallPlugins(repoRoot: string, pmc: P
|
|
9
9
|
* @param verbose whether to run in verbose mode
|
10
10
|
* @returns void
|
11
11
|
*/
|
12
|
-
export declare function
|
12
|
+
export declare function runPluginInitGenerator(plugin: string, repoRoot?: string, updatePackageScripts?: boolean, verbose?: boolean, pmc?: PackageManagerCommands): Promise<void>;
|
13
13
|
/**
|
14
14
|
* Install plugins
|
15
15
|
* Get the implementation of the plugin's init generator and run it
|
16
16
|
* @returns a list of succeeded plugins and a map of failed plugins to errors
|
17
17
|
*/
|
18
|
-
export declare function
|
18
|
+
export declare function runPluginInitGenerators(plugins: string[], updatePackageScripts: boolean, pmc: PackageManagerCommands, repoRoot?: string, verbose?: boolean): Promise<{
|
19
19
|
succeededPlugins: string[];
|
20
20
|
failedPlugins: {
|
21
21
|
[plugin: string]: Error;
|
@@ -1,13 +1,12 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
4
|
-
exports.
|
5
|
-
exports.
|
3
|
+
exports.installPluginPackages = installPluginPackages;
|
4
|
+
exports.runPluginInitGenerator = runPluginInitGenerator;
|
5
|
+
exports.runPluginInitGenerators = runPluginInitGenerators;
|
6
6
|
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");
|
11
10
|
const package_manager_1 = require("../../utils/package-manager");
|
12
11
|
const output_1 = require("../../utils/output");
|
13
12
|
const workspace_root_1 = require("../../utils/workspace-root");
|
@@ -15,12 +14,28 @@ const utils_1 = require("./implementation/utils");
|
|
15
14
|
const angular_json_1 = require("../../adapter/angular-json");
|
16
15
|
const error_types_1 = require("../../project-graph/error-types");
|
17
16
|
const generator_utils_1 = require("../generate/generator-utils");
|
18
|
-
|
17
|
+
const path_1 = require("path");
|
18
|
+
const fs_1 = require("fs");
|
19
|
+
const configuration_1 = require("../../config/configuration");
|
20
|
+
const versions_1 = require("../../utils/versions");
|
21
|
+
const child_process_1 = require("../../utils/child-process");
|
22
|
+
function installPluginPackages(repoRoot, pmc = (0, package_manager_1.getPackageManagerCommand)(), plugins) {
|
19
23
|
if (plugins.length === 0) {
|
20
24
|
return;
|
21
25
|
}
|
22
|
-
(0,
|
23
|
-
|
26
|
+
if ((0, fs_1.existsSync)((0, path_1.join)(repoRoot, 'package.json'))) {
|
27
|
+
(0, utils_1.addDepsToPackageJson)(repoRoot, plugins);
|
28
|
+
(0, utils_1.runInstall)(repoRoot, pmc);
|
29
|
+
}
|
30
|
+
else {
|
31
|
+
const nxJson = (0, configuration_1.readNxJson)(repoRoot);
|
32
|
+
nxJson.installation.plugins ??= {};
|
33
|
+
for (const plugin of plugins) {
|
34
|
+
nxJson.installation.plugins[plugin] = versions_1.nxVersion;
|
35
|
+
}
|
36
|
+
// Invoking nx wrapper to install plugins.
|
37
|
+
(0, child_process_1.runNxSync)('--version', { stdio: 'ignore' });
|
38
|
+
}
|
24
39
|
}
|
25
40
|
/**
|
26
41
|
* Installs a plugin by running its init generator. It will change the file system tree passed in.
|
@@ -31,20 +46,21 @@ function runPackageManagerInstallPlugins(repoRoot, pmc = (0, package_manager_1.g
|
|
31
46
|
* @param verbose whether to run in verbose mode
|
32
47
|
* @returns void
|
33
48
|
*/
|
34
|
-
async function
|
49
|
+
async function runPluginInitGenerator(plugin, repoRoot = workspace_root_1.workspaceRoot, updatePackageScripts = false, verbose = false, pmc = (0, package_manager_1.getPackageManagerCommand)()) {
|
35
50
|
try {
|
36
51
|
const { schema } = (0, generator_utils_1.getGeneratorInformation)(plugin, 'init', workspace_root_1.workspaceRoot, {});
|
37
|
-
let command =
|
52
|
+
let command = `g ${plugin}:init ${verbose ? '--verbose' : ''}`;
|
38
53
|
if (!!schema.properties['keepExistingVersions']) {
|
39
54
|
command += ` --keepExistingVersions`;
|
40
55
|
}
|
41
56
|
if (updatePackageScripts && !!schema.properties['updatePackageScripts']) {
|
42
57
|
command += ` --updatePackageScripts`;
|
43
58
|
}
|
44
|
-
(0, child_process_1.
|
59
|
+
(0, child_process_1.runNxSync)(command, {
|
45
60
|
stdio: [0, 1, 2],
|
46
61
|
cwd: repoRoot,
|
47
62
|
windowsHide: false,
|
63
|
+
packageManagerCommand: pmc,
|
48
64
|
});
|
49
65
|
}
|
50
66
|
catch {
|
@@ -60,7 +76,7 @@ async function installPlugin(plugin, repoRoot = workspace_root_1.workspaceRoot,
|
|
60
76
|
* Get the implementation of the plugin's init generator and run it
|
61
77
|
* @returns a list of succeeded plugins and a map of failed plugins to errors
|
62
78
|
*/
|
63
|
-
async function
|
79
|
+
async function runPluginInitGenerators(plugins, updatePackageScripts, pmc, repoRoot = workspace_root_1.workspaceRoot, verbose = false) {
|
64
80
|
if (plugins.length === 0) {
|
65
81
|
return {
|
66
82
|
succeededPlugins: [],
|
@@ -73,7 +89,7 @@ async function installPlugins(plugins, updatePackageScripts, pmc, repoRoot = wor
|
|
73
89
|
for (const plugin of plugins) {
|
74
90
|
try {
|
75
91
|
spinner.start('Installing plugin ' + plugin);
|
76
|
-
await
|
92
|
+
await runPluginInitGenerator(plugin, repoRoot, updatePackageScripts, verbose, pmc);
|
77
93
|
succeededPlugins.push(plugin);
|
78
94
|
spinner.succeed('Installed plugin ' + plugin);
|
79
95
|
}
|
@@ -99,7 +115,7 @@ async function configurePlugins(plugins, updatePackageScripts, pmc, repoRoot = w
|
|
99
115
|
};
|
100
116
|
}
|
101
117
|
output_1.output.log({ title: '🔨 Configuring plugins' });
|
102
|
-
let { succeededPlugins, failedPlugins } = await
|
118
|
+
let { succeededPlugins, failedPlugins } = await runPluginInitGenerators(plugins, updatePackageScripts, pmc, repoRoot, verbose);
|
103
119
|
if (succeededPlugins.length > 0) {
|
104
120
|
output_1.output.success({
|
105
121
|
title: 'Installed Plugins',
|
@@ -24,6 +24,7 @@ const connect_to_nx_cloud_1 = require("../../../nx-cloud/generators/connect-to-n
|
|
24
24
|
const url_shorten_1 = require("../../../nx-cloud/utilities/url-shorten");
|
25
25
|
const connect_to_nx_cloud_2 = require("../../connect/connect-to-nx-cloud");
|
26
26
|
const deduce_default_base_1 = require("./deduce-default-base");
|
27
|
+
const child_process_2 = require("../../../utils/child-process");
|
27
28
|
function createNxJsonFile(repoRoot, topologicalTargets, cacheableOperations, scriptOutputs) {
|
28
29
|
const nxJsonPath = (0, path_2.joinPathFragments)(repoRoot, 'nx.json');
|
29
30
|
let nxJson = {};
|
@@ -252,8 +253,8 @@ function printFinalMessage({ learnMoreLink, }) {
|
|
252
253
|
output_1.output.success({
|
253
254
|
title: '🎉 Done!',
|
254
255
|
bodyLines: [
|
255
|
-
`- Run "${pmc
|
256
|
-
`- Run "${pmc
|
256
|
+
`- Run "${(0, child_process_2.getRunNxBaseCommand)(pmc)} run-many -t build" to run the build target for every project in the workspace. Run it again to replay the cached computation. https://nx.dev/features/cache-task-results`,
|
257
|
+
`- Run "${(0, child_process_2.getRunNxBaseCommand)(pmc)} graph" to see the graph of projects and tasks in your workspace. https://nx.dev/core-features/explore-graph`,
|
257
258
|
learnMoreLink ? `- Learn more at ${learnMoreLink}.` : undefined,
|
258
259
|
].filter(Boolean),
|
259
260
|
});
|
@@ -6,7 +6,6 @@ const fs_1 = require("fs");
|
|
6
6
|
const enquirer_1 = require("enquirer");
|
7
7
|
const semver_1 = require("semver");
|
8
8
|
const nx_json_1 = require("../../config/nx-json");
|
9
|
-
const child_process_1 = require("../../utils/child-process");
|
10
9
|
const fileutils_1 = require("../../utils/fileutils");
|
11
10
|
const get_package_name_from_import_path_1 = require("../../utils/get-package-name-from-import-path");
|
12
11
|
const output_1 = require("../../utils/output");
|
@@ -28,25 +27,6 @@ async function initHandler(options) {
|
|
28
27
|
if (process.env.NX_VERSION) {
|
29
28
|
output_1.output.log({ title: `Using version ${process.env.NX_VERSION}` });
|
30
29
|
}
|
31
|
-
if (!(0, fs_1.existsSync)('package.json') || options.useDotNxInstallation) {
|
32
|
-
if (process.platform !== 'win32') {
|
33
|
-
console.log('Setting Nx up installation in `.nx`. You can run Nx commands like: `./nx --help`');
|
34
|
-
}
|
35
|
-
else {
|
36
|
-
console.log('Setting Nx up installation in `.nx`. You can run Nx commands like: `./nx.bat --help`');
|
37
|
-
}
|
38
|
-
(0, add_nx_scripts_1.generateDotNxSetup)(version);
|
39
|
-
const nxJson = (0, nx_json_1.readNxJson)(process.cwd());
|
40
|
-
const { plugins } = await detectPlugins(nxJson, options.interactive);
|
41
|
-
plugins.forEach((plugin) => {
|
42
|
-
(0, child_process_1.runNxSync)(`add ${plugin}`, {
|
43
|
-
stdio: 'inherit',
|
44
|
-
});
|
45
|
-
});
|
46
|
-
// invokes the wrapper, thus invoking the initial installation process
|
47
|
-
(0, child_process_1.runNxSync)('--version', { stdio: 'ignore' });
|
48
|
-
return;
|
49
|
-
}
|
50
30
|
// TODO(jack): Remove this Angular logic once `@nx/angular` is compatible with inferred targets.
|
51
31
|
if ((0, fs_1.existsSync)('angular.json')) {
|
52
32
|
await (0, angular_1.addNxToAngularCliRepo)({
|
@@ -58,10 +38,13 @@ async function initHandler(options) {
|
|
58
38
|
});
|
59
39
|
return;
|
60
40
|
}
|
61
|
-
const
|
41
|
+
const _isNonJs = !(0, fs_1.existsSync)('package.json') || options.useDotNxInstallation;
|
42
|
+
const packageJson = _isNonJs
|
43
|
+
? null
|
44
|
+
: (0, fileutils_1.readJsonFile)('package.json');
|
62
45
|
const _isTurborepo = (0, fs_1.existsSync)('turbo.json');
|
63
|
-
const _isMonorepo = (0, utils_1.isMonorepo)(packageJson);
|
64
|
-
const _isCRA = (0, utils_1.isCRA)(packageJson);
|
46
|
+
const _isMonorepo = _isNonJs ? false : (0, utils_1.isMonorepo)(packageJson);
|
47
|
+
const _isCRA = _isNonJs ? false : (0, utils_1.isCRA)(packageJson);
|
65
48
|
const learnMoreLink = _isTurborepo
|
66
49
|
? 'https://nx.dev/recipes/adopting-nx/from-turborepo'
|
67
50
|
: _isMonorepo
|
@@ -99,6 +82,10 @@ async function initHandler(options) {
|
|
99
82
|
nxCloud: false,
|
100
83
|
});
|
101
84
|
}
|
85
|
+
else if (_isNonJs) {
|
86
|
+
(0, add_nx_scripts_1.generateDotNxSetup)(version);
|
87
|
+
console.log('');
|
88
|
+
}
|
102
89
|
else {
|
103
90
|
await (0, add_nx_to_npm_repo_1.addNxToNpmRepo)({
|
104
91
|
interactive: options.interactive,
|
@@ -124,7 +111,7 @@ async function initHandler(options) {
|
|
124
111
|
updatePackageScripts = _updatePackageScripts;
|
125
112
|
}
|
126
113
|
output_1.output.log({ title: '📦 Installing Nx' });
|
127
|
-
(0, configure_plugins_1.
|
114
|
+
(0, configure_plugins_1.installPluginPackages)(repoRoot, pmc, plugins);
|
128
115
|
await (0, configure_plugins_1.configurePlugins)(plugins, updatePackageScripts, pmc, repoRoot, options.verbose);
|
129
116
|
if (useNxCloud) {
|
130
117
|
output_1.output.log({ title: '🛠️ Setting up Nx Cloud' });
|
Binary file
|
@@ -1,11 +1,15 @@
|
|
1
1
|
import { type ExecOptions, type ExecSyncOptions } from 'child_process';
|
2
|
+
import { PackageManagerCommands } from './package-manager';
|
2
3
|
import { ChildProcess } from '../native';
|
4
|
+
export declare function getRunNxBaseCommand(packageManagerCommand?: PackageManagerCommands, cwd?: string): string;
|
3
5
|
export declare function runNxSync(cmd: string, options?: ExecSyncOptions & {
|
4
6
|
cwd?: string;
|
7
|
+
packageManagerCommand?: PackageManagerCommands;
|
5
8
|
}): void;
|
6
9
|
export declare function runNxAsync(cmd: string, options?: ExecOptions & {
|
7
10
|
cwd?: string;
|
8
11
|
silent?: boolean;
|
12
|
+
packageManagerCommand?: PackageManagerCommands;
|
9
13
|
}): Promise<void>;
|
10
14
|
export declare class PseudoTtyProcess {
|
11
15
|
private childProcess;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.PseudoTtyProcess = void 0;
|
4
|
+
exports.getRunNxBaseCommand = getRunNxBaseCommand;
|
4
5
|
exports.runNxSync = runNxSync;
|
5
6
|
exports.runNxAsync = runNxAsync;
|
6
7
|
const child_process_1 = require("child_process");
|
@@ -8,46 +9,38 @@ const fs_1 = require("fs");
|
|
8
9
|
const path_1 = require("path");
|
9
10
|
const package_manager_1 = require("./package-manager");
|
10
11
|
const workspace_root_1 = require("./workspace-root");
|
11
|
-
function
|
12
|
-
let baseCmd;
|
12
|
+
function getRunNxBaseCommand(packageManagerCommand, cwd = process.cwd()) {
|
13
13
|
if ((0, fs_1.existsSync)((0, path_1.join)(workspace_root_1.workspaceRoot, 'package.json'))) {
|
14
|
-
|
14
|
+
if (!packageManagerCommand) {
|
15
|
+
const pm = (0, package_manager_1.detectPackageManager)();
|
16
|
+
packageManagerCommand = (0, package_manager_1.getPackageManagerCommand)(pm);
|
17
|
+
}
|
18
|
+
return `${packageManagerCommand.exec} nx`;
|
15
19
|
}
|
16
20
|
else {
|
17
|
-
|
18
|
-
options.cwd ??= process.cwd();
|
19
|
-
options.windowsHide ??= true;
|
20
|
-
const offsetFromRoot = (0, path_1.relative)(options.cwd, (0, workspace_root_1.workspaceRootInner)(options.cwd, null));
|
21
|
+
const offsetFromRoot = (0, path_1.relative)(cwd, (0, workspace_root_1.workspaceRootInner)(cwd, null));
|
21
22
|
if (process.platform === 'win32') {
|
22
|
-
|
23
|
+
return '.\\' + (0, path_1.join)(`${offsetFromRoot}`, 'nx.bat');
|
23
24
|
}
|
24
25
|
else {
|
25
|
-
|
26
|
+
return './' + (0, path_1.join)(`${offsetFromRoot}`, 'nx');
|
26
27
|
}
|
27
28
|
}
|
28
|
-
|
29
|
+
}
|
30
|
+
function runNxSync(cmd, options) {
|
31
|
+
let { packageManagerCommand, ...execSyncOptions } = options ?? {};
|
32
|
+
execSyncOptions.cwd ??= process.cwd();
|
33
|
+
execSyncOptions.windowsHide ??= true;
|
34
|
+
const baseCmd = getRunNxBaseCommand(packageManagerCommand, execSyncOptions.cwd);
|
35
|
+
(0, child_process_1.execSync)(`${baseCmd} ${cmd}`, execSyncOptions);
|
29
36
|
}
|
30
37
|
async function runNxAsync(cmd, options) {
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
}
|
35
|
-
|
36
|
-
|
37
|
-
options.cwd ??= process.cwd();
|
38
|
-
options.windowsHide ??= true;
|
39
|
-
const offsetFromRoot = (0, path_1.relative)(options.cwd, (0, workspace_root_1.workspaceRootInner)(options.cwd, null));
|
40
|
-
if (process.platform === 'win32') {
|
41
|
-
baseCmd = '.\\' + (0, path_1.join)(`${offsetFromRoot}`, 'nx.bat');
|
42
|
-
}
|
43
|
-
else {
|
44
|
-
baseCmd = './' + (0, path_1.join)(`${offsetFromRoot}`, 'nx');
|
45
|
-
}
|
46
|
-
}
|
47
|
-
const silent = options?.silent ?? true;
|
48
|
-
if (options?.silent) {
|
49
|
-
delete options.silent;
|
50
|
-
}
|
38
|
+
options ??= {};
|
39
|
+
options.cwd ??= process.cwd();
|
40
|
+
options.windowsHide ??= true;
|
41
|
+
let { silent, packageManagerCommand, ...execSyncOptions } = options;
|
42
|
+
silent ??= true;
|
43
|
+
const baseCmd = getRunNxBaseCommand(packageManagerCommand, execSyncOptions.cwd);
|
51
44
|
return new Promise((resolve, reject) => {
|
52
45
|
const child = (0, child_process_1.exec)(`${baseCmd} ${cmd}`, options, (error, stdout, stderr) => {
|
53
46
|
if (error) {
|