nx 20.0.0-beta.0 → 20.0.0-beta.2
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 +2 -1
- package/bin/nx.js +10 -2
- package/package.json +12 -12
- package/src/adapter/compat.d.ts +1 -1
- package/src/adapter/compat.js +1 -0
- package/src/command-line/activate-powerpack/activate-powerpack.js +3 -1
- package/src/command-line/add/add.js +4 -2
- package/src/command-line/connect/view-logs.js +1 -0
- package/src/command-line/exec/exec.js +6 -1
- package/src/command-line/format/format.js +3 -1
- package/src/command-line/graph/graph.js +1 -0
- package/src/command-line/init/implementation/angular/integrated-workspace.js +4 -1
- package/src/command-line/init/implementation/angular/legacy-angular-versions.js +5 -2
- package/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +3 -1
- package/src/command-line/init/implementation/dot-nx/nxw.js +1 -0
- package/src/command-line/init/implementation/react/check-for-uncommitted-changes.js +3 -1
- package/src/command-line/init/implementation/react/index.js +17 -5
- package/src/command-line/init/implementation/utils.js +5 -1
- package/src/command-line/init/init-v1.js +1 -0
- package/src/command-line/init/init-v2.js +2 -1
- package/src/command-line/migrate/command-object.js +4 -0
- package/src/command-line/migrate/migrate.js +1 -1
- package/src/command-line/release/config/version-plans.js +3 -1
- package/src/command-line/release/utils/exec-command.js +1 -0
- package/src/command-line/release/utils/github.js +1 -0
- package/src/command-line/release/utils/launch-editor.js +6 -1
- package/src/command-line/release/version.js +1 -0
- package/src/command-line/report/report.d.ts +3 -1
- package/src/command-line/report/report.js +17 -2
- package/src/command-line/run/run.js +1 -0
- package/src/command-line/sync/sync.js +5 -4
- package/src/command-line/watch/watch.js +1 -0
- package/src/config/nx-json.d.ts +4 -0
- package/src/daemon/client/client.d.ts +4 -1
- package/src/daemon/client/generate-help-output.js +1 -0
- package/src/daemon/server/sync-generators.d.ts +4 -1
- package/src/daemon/server/sync-generators.js +33 -15
- package/src/executors/run-commands/run-commands.impl.js +1 -0
- package/src/executors/run-script/run-script.impl.js +1 -0
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +1 -1
- package/src/project-graph/file-utils.js +1 -0
- package/src/tasks-runner/cache.d.ts +3 -1
- package/src/tasks-runner/cache.js +12 -13
- package/src/tasks-runner/default-tasks-runner.js +1 -1
- package/src/tasks-runner/life-cycles/formatting-utils.d.ts +1 -1
- package/src/tasks-runner/life-cycles/formatting-utils.js +27 -15
- package/src/tasks-runner/life-cycles/task-history-life-cycle.js +3 -0
- package/src/tasks-runner/task-orchestrator.d.ts +3 -1
- package/src/tasks-runner/task-orchestrator.js +3 -2
- package/src/tasks-runner/tasks-schedule.js +1 -1
- package/src/utils/ab-testing.js +4 -1
- package/src/utils/child-process.js +5 -3
- package/src/utils/command-line-utils.js +7 -1
- package/src/utils/default-base.js +5 -2
- package/src/utils/git-utils.index-filter.js +2 -1
- package/src/utils/git-utils.js +4 -0
- package/src/utils/git-utils.tree-filter.js +3 -1
- package/src/utils/powerpack.d.ts +1 -1
- package/src/utils/powerpack.js +3 -8
- package/src/utils/sync-generators.d.ts +13 -3
- package/src/utils/sync-generators.js +99 -25
- package/src/utils/task-history.d.ts +2 -2
- package/src/utils/task-history.js +4 -1
package/.eslintrc.json
CHANGED
package/bin/nx.js
CHANGED
@@ -200,11 +200,19 @@ function getLocalNxVersion(workspace) {
|
|
200
200
|
}
|
201
201
|
function _getLatestVersionOfNx() {
|
202
202
|
try {
|
203
|
-
return (0, child_process_1.execSync)('npm view nx@latest version'
|
203
|
+
return (0, child_process_1.execSync)('npm view nx@latest version', {
|
204
|
+
windowsHide: true,
|
205
|
+
})
|
206
|
+
.toString()
|
207
|
+
.trim();
|
204
208
|
}
|
205
209
|
catch {
|
206
210
|
try {
|
207
|
-
return (0, child_process_1.execSync)('pnpm view nx@latest version'
|
211
|
+
return (0, child_process_1.execSync)('pnpm view nx@latest version', {
|
212
|
+
windowsHide: true,
|
213
|
+
})
|
214
|
+
.toString()
|
215
|
+
.trim();
|
208
216
|
}
|
209
217
|
catch {
|
210
218
|
return null;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "20.0.0-beta.
|
3
|
+
"version": "20.0.0-beta.2",
|
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": {
|
@@ -68,7 +68,7 @@
|
|
68
68
|
"yargs-parser": "21.1.1",
|
69
69
|
"node-machine-id": "1.1.12",
|
70
70
|
"ora": "5.3.0",
|
71
|
-
"@nrwl/tao": "20.0.0-beta.
|
71
|
+
"@nrwl/tao": "20.0.0-beta.2"
|
72
72
|
},
|
73
73
|
"peerDependencies": {
|
74
74
|
"@swc-node/register": "^1.8.0",
|
@@ -83,16 +83,16 @@
|
|
83
83
|
}
|
84
84
|
},
|
85
85
|
"optionalDependencies": {
|
86
|
-
"@nx/nx-darwin-x64": "20.0.0-beta.
|
87
|
-
"@nx/nx-darwin-arm64": "20.0.0-beta.
|
88
|
-
"@nx/nx-linux-x64-gnu": "20.0.0-beta.
|
89
|
-
"@nx/nx-linux-x64-musl": "20.0.0-beta.
|
90
|
-
"@nx/nx-win32-x64-msvc": "20.0.0-beta.
|
91
|
-
"@nx/nx-linux-arm64-gnu": "20.0.0-beta.
|
92
|
-
"@nx/nx-linux-arm64-musl": "20.0.0-beta.
|
93
|
-
"@nx/nx-linux-arm-gnueabihf": "20.0.0-beta.
|
94
|
-
"@nx/nx-win32-arm64-msvc": "20.0.0-beta.
|
95
|
-
"@nx/nx-freebsd-x64": "20.0.0-beta.
|
86
|
+
"@nx/nx-darwin-x64": "20.0.0-beta.2",
|
87
|
+
"@nx/nx-darwin-arm64": "20.0.0-beta.2",
|
88
|
+
"@nx/nx-linux-x64-gnu": "20.0.0-beta.2",
|
89
|
+
"@nx/nx-linux-x64-musl": "20.0.0-beta.2",
|
90
|
+
"@nx/nx-win32-x64-msvc": "20.0.0-beta.2",
|
91
|
+
"@nx/nx-linux-arm64-gnu": "20.0.0-beta.2",
|
92
|
+
"@nx/nx-linux-arm64-musl": "20.0.0-beta.2",
|
93
|
+
"@nx/nx-linux-arm-gnueabihf": "20.0.0-beta.2",
|
94
|
+
"@nx/nx-win32-arm64-msvc": "20.0.0-beta.2",
|
95
|
+
"@nx/nx-freebsd-x64": "20.0.0-beta.2"
|
96
96
|
},
|
97
97
|
"nx-migrations": {
|
98
98
|
"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 ["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"];
|
2
|
+
export declare const allowedWorkspaceExtensions: readonly ["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", "enableDbCache"];
|
package/src/adapter/compat.js
CHANGED
@@ -20,7 +20,9 @@ async function requirePowerpack() {
|
|
20
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/powerpack-license@latest
|
23
|
+
(0, child_process_1.execSync)(`${(0, package_manager_1.getPackageManagerCommand)().addDev} @nx/powerpack-license@latest`, {
|
24
|
+
windowsHide: true,
|
25
|
+
});
|
24
26
|
// @ts-ignore
|
25
27
|
return await Promise.resolve().then(() => require('@nx/powerpack-license'));
|
26
28
|
}
|
@@ -34,7 +34,9 @@ async function installPackage(pkgName, version, nxJson) {
|
|
34
34
|
spinner.start();
|
35
35
|
if ((0, fs_1.existsSync)('package.json')) {
|
36
36
|
const pmc = (0, package_manager_1.getPackageManagerCommand)();
|
37
|
-
await new Promise((resolve) => (0, child_process_1.exec)(`${pmc.addDev} ${pkgName}@${version}`,
|
37
|
+
await new Promise((resolve) => (0, child_process_1.exec)(`${pmc.addDev} ${pkgName}@${version}`, {
|
38
|
+
windowsHide: true,
|
39
|
+
}, (error, stdout) => {
|
38
40
|
if (error) {
|
39
41
|
spinner.fail();
|
40
42
|
output_1.output.addNewline();
|
@@ -108,7 +110,7 @@ async function initializePlugin(pkgName, options, nxJson) {
|
|
108
110
|
catch (e) {
|
109
111
|
spinner.fail();
|
110
112
|
output_1.output.addNewline();
|
111
|
-
logger_1.logger.error(e
|
113
|
+
logger_1.logger.error(e);
|
112
114
|
output_1.output.error({
|
113
115
|
title: `Failed to initialize ${pkgName}. Please check the error above for more details.`,
|
114
116
|
});
|
@@ -43,6 +43,7 @@ async function viewLogs() {
|
|
43
43
|
const pmc = (0, package_manager_1.getPackageManagerCommand)();
|
44
44
|
(0, child_process_1.execSync)(`${pmc.exec} nx-cloud upload-and-show-run-details`, {
|
45
45
|
stdio: [0, 1, 2],
|
46
|
+
windowsHide: true,
|
46
47
|
});
|
47
48
|
if (!cloudUsed) {
|
48
49
|
output_1.output.note({
|
@@ -34,6 +34,7 @@ async function nxExecCommand(args) {
|
|
34
34
|
NX_PROJECT_NAME: process.env.NX_TASK_TARGET_PROJECT,
|
35
35
|
NX_PROJECT_ROOT_PATH: projectGraph.nodes?.[process.env.NX_TASK_TARGET_PROJECT]?.data?.root,
|
36
36
|
},
|
37
|
+
windowsHide: true,
|
37
38
|
});
|
38
39
|
}
|
39
40
|
else {
|
@@ -66,6 +67,7 @@ async function runScriptAsNxTarget(projectGraph, argv, nxArgs) {
|
|
66
67
|
cwd: projectGraph.nodes?.[projectName]?.data?.root
|
67
68
|
? (0, path_2.joinPathFragments)(workspace_root_1.workspaceRoot, projectGraph.nodes?.[projectName]?.data?.root)
|
68
69
|
: workspace_root_1.workspaceRoot,
|
70
|
+
windowsHide: true,
|
69
71
|
});
|
70
72
|
});
|
71
73
|
}
|
@@ -77,7 +79,10 @@ function runTargetOnProject(scriptDefinition, targetName, project, projectName,
|
|
77
79
|
const pm = (0, package_manager_1.getPackageManagerCommand)();
|
78
80
|
// `targetName` might be an npm script with `:` like: `start:dev`, `start:debug`.
|
79
81
|
const command = `${pm.exec} nx run ${projectName}:\\\"${targetName}\\\" ${extraArgs.join(' ')}`;
|
80
|
-
(0, child_process_1.execSync)(command, {
|
82
|
+
(0, child_process_1.execSync)(command, {
|
83
|
+
stdio: 'inherit',
|
84
|
+
windowsHide: true,
|
85
|
+
});
|
81
86
|
}
|
82
87
|
function readScriptArgV(overrides) {
|
83
88
|
const scriptSeparatorIdx = process.argv.findIndex((el) => el === '--');
|
@@ -144,10 +144,12 @@ function write(patterns) {
|
|
144
144
|
const prettierPath = getPrettierPath();
|
145
145
|
(0, node_child_process_1.execSync)(`node "${prettierPath}" --write --list-different ${regularPatterns.join(' ')}`, {
|
146
146
|
stdio: [0, 1, 2],
|
147
|
+
windowsHide: true,
|
147
148
|
});
|
148
149
|
if (swcrcPatterns.length > 0) {
|
149
150
|
(0, node_child_process_1.execSync)(`node "${prettierPath}" --write --list-different ${swcrcPatterns.join(' ')} --parser json`, {
|
150
151
|
stdio: [0, 1, 2],
|
152
|
+
windowsHide: true,
|
151
153
|
});
|
152
154
|
}
|
153
155
|
}
|
@@ -158,7 +160,7 @@ async function check(patterns) {
|
|
158
160
|
}
|
159
161
|
const prettierPath = getPrettierPath();
|
160
162
|
return new Promise((resolve) => {
|
161
|
-
(0, node_child_process_1.exec)(`node "${prettierPath}" --list-different ${patterns.join(' ')}`, { encoding: 'utf-8' }, (error, stdout) => {
|
163
|
+
(0, node_child_process_1.exec)(`node "${prettierPath}" --list-different ${patterns.join(' ')}`, { encoding: 'utf-8', windowsHide: true }, (error, stdout) => {
|
162
164
|
if (error) {
|
163
165
|
// The command failed so there are files with different formatting. Prettier writes them to stdout, newline separated.
|
164
166
|
resolve(stdout.trim().split('\n'));
|
@@ -801,5 +801,6 @@ function getHelpTextFromTarget(projectName, targetName) {
|
|
801
801
|
throw new Error(`No help command found for ${projectName}:${targetName}`);
|
802
802
|
return (0, node_child_process_1.execSync)(command, {
|
803
803
|
cwd: target.options?.cwd ?? workspace_root_1.workspaceRoot,
|
804
|
+
windowsHide: true,
|
804
805
|
}).toString();
|
805
806
|
}
|
@@ -5,5 +5,8 @@ const child_process_1 = require("child_process");
|
|
5
5
|
const package_manager_1 = require("../../../../utils/package-manager");
|
6
6
|
function setupIntegratedWorkspace() {
|
7
7
|
const pmc = (0, package_manager_1.getPackageManagerCommand)();
|
8
|
-
(0, child_process_1.execSync)(`${pmc.exec} nx g @nx/angular:ng-add`, {
|
8
|
+
(0, child_process_1.execSync)(`${pmc.exec} nx g @nx/angular:ng-add`, {
|
9
|
+
stdio: [0, 1, 2],
|
10
|
+
windowsHide: true,
|
11
|
+
});
|
9
12
|
}
|
@@ -82,7 +82,10 @@ async function getLegacyMigrationFunctionIfApplicable(repoRoot, options) {
|
|
82
82
|
unscopedPkgName,
|
83
83
|
}, pmc);
|
84
84
|
output_1.output.log({ title: '📝 Setting up workspace' });
|
85
|
-
(0, child_process_1.execSync)(`${pmc.exec} ${legacyMigrationCommand}`, {
|
85
|
+
(0, child_process_1.execSync)(`${pmc.exec} ${legacyMigrationCommand}`, {
|
86
|
+
stdio: [0, 1, 2],
|
87
|
+
windowsHide: true,
|
88
|
+
});
|
86
89
|
if (useNxCloud) {
|
87
90
|
output_1.output.log({ title: '🛠️ Setting up Nx Cloud' });
|
88
91
|
await (0, utils_1.initCloud)('nx-init-angular');
|
@@ -107,7 +110,7 @@ async function installDependencies(repoRoot, pkgInfo, pmc) {
|
|
107
110
|
json.dependencies = (0, object_sort_1.sortObjectByKeys)(json.dependencies);
|
108
111
|
}
|
109
112
|
(0, fileutils_1.writeJsonFile)(`package.json`, json);
|
110
|
-
(0, child_process_1.execSync)(pmc.install, { stdio: [0, 1, 2] });
|
113
|
+
(0, child_process_1.execSync)(pmc.install, { stdio: [0, 1, 2], windowsHide: true });
|
111
114
|
}
|
112
115
|
async function resolvePackageVersion(packageName, version) {
|
113
116
|
try {
|
@@ -62,7 +62,9 @@ function generateDotNxSetup(version) {
|
|
62
62
|
}
|
63
63
|
function normalizeVersionForNxJson(pkg, version) {
|
64
64
|
if (!(0, semver_1.valid)(version)) {
|
65
|
-
version = (0, child_process_1.execSync)(`npm view ${pkg}@${version} version
|
65
|
+
version = (0, child_process_1.execSync)(`npm view ${pkg}@${version} version`, {
|
66
|
+
windowsHide: true,
|
67
|
+
}).toString();
|
66
68
|
}
|
67
69
|
return version.trimEnd();
|
68
70
|
}
|
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.checkForUncommittedChanges = checkForUncommittedChanges;
|
4
4
|
const child_process_1 = require("child_process");
|
5
5
|
function checkForUncommittedChanges() {
|
6
|
-
const gitResult = (0, child_process_1.execSync)('git status --porcelain'
|
6
|
+
const gitResult = (0, child_process_1.execSync)('git status --porcelain', {
|
7
|
+
windowsHide: true,
|
8
|
+
}).toString();
|
7
9
|
const filteredResults = gitResult
|
8
10
|
.split('\n')
|
9
11
|
.filter((line) => !line.includes('.nx') && line.trim().length > 0);
|
@@ -41,6 +41,7 @@ function installDependencies(options) {
|
|
41
41
|
}
|
42
42
|
(0, child_process_1.execSync)(`${options.pmc.addDev} ${dependencies.join(' ')}`, {
|
43
43
|
stdio: [0, 1, 2],
|
44
|
+
windowsHide: true,
|
44
45
|
});
|
45
46
|
}
|
46
47
|
async function normalizeOptions(options) {
|
@@ -54,7 +55,9 @@ async function normalizeOptions(options) {
|
|
54
55
|
...packageJson.devDependencies,
|
55
56
|
};
|
56
57
|
const isCRA5 = /^[^~]?5/.test(deps['react-scripts']);
|
57
|
-
const npmVersion = (0, child_process_1.execSync)('npm -v'
|
58
|
+
const npmVersion = (0, child_process_1.execSync)('npm -v', {
|
59
|
+
windowsHide: true,
|
60
|
+
}).toString();
|
58
61
|
// Should remove this check 04/2023 once Node 14 & npm 6 reach EOL
|
59
62
|
const npxYesFlagNeeded = !npmVersion.startsWith('6'); // npm 7 added -y flag to npx
|
60
63
|
const isVite = options.vite;
|
@@ -86,8 +89,14 @@ async function reorgnizeWorkspaceStructure(options) {
|
|
86
89
|
moveFilesToTempWorkspace(options);
|
87
90
|
await addBundler(options);
|
88
91
|
output_1.output.log({ title: '🧶 Updating .gitignore file' });
|
89
|
-
(0, child_process_1.execSync)(`echo "node_modules" >> .gitignore`, {
|
90
|
-
|
92
|
+
(0, child_process_1.execSync)(`echo "node_modules" >> .gitignore`, {
|
93
|
+
stdio: [0, 1, 2],
|
94
|
+
windowsHide: true,
|
95
|
+
});
|
96
|
+
(0, child_process_1.execSync)(`echo "dist" >> .gitignore`, {
|
97
|
+
stdio: [0, 1, 2],
|
98
|
+
windowsHide: true,
|
99
|
+
});
|
91
100
|
process.chdir('..');
|
92
101
|
copyFromTempWorkspaceToRoot();
|
93
102
|
cleanUpUnusedFilesAndAddConfigFiles(options);
|
@@ -108,7 +117,7 @@ async function reorgnizeWorkspaceStructure(options) {
|
|
108
117
|
}
|
109
118
|
function createTempWorkspace(options) {
|
110
119
|
(0, fs_extra_1.removeSync)('temp-workspace');
|
111
|
-
(0, child_process_1.execSync)(`npx ${options.npxYesFlagNeeded ? '-y' : ''} create-nx-workspace@latest temp-workspace --appName=${options.reactAppName} --preset=react-monorepo --style=css --bundler=${options.isVite ? 'vite' : 'webpack'} --packageManager=${options.packageManager} ${options.nxCloud ? '--nxCloud=yes' : '--nxCloud=skip'} ${options.addE2e ? '--e2eTestRunner=playwright' : '--e2eTestRunner=none'}`, { stdio: [0, 1, 2] });
|
120
|
+
(0, child_process_1.execSync)(`npx ${options.npxYesFlagNeeded ? '-y' : ''} create-nx-workspace@latest temp-workspace --appName=${options.reactAppName} --preset=react-monorepo --style=css --bundler=${options.isVite ? 'vite' : 'webpack'} --packageManager=${options.packageManager} ${options.nxCloud ? '--nxCloud=yes' : '--nxCloud=skip'} ${options.addE2e ? '--e2eTestRunner=playwright' : '--e2eTestRunner=none'}`, { stdio: [0, 1, 2], windowsHide: true });
|
112
121
|
output_1.output.log({ title: '👋 Welcome to Nx!' });
|
113
122
|
output_1.output.log({ title: '🧹 Clearing unused files' });
|
114
123
|
(0, fs_extra_1.copySync)((0, path_1.join)('temp-workspace', 'apps', options.reactAppName, 'project.json'), 'project.json');
|
@@ -191,7 +200,10 @@ async function addBundler(options) {
|
|
191
200
|
output_1.output.log({
|
192
201
|
title: '🛬 Skip CRA preflight check since Nx manages the monorepo',
|
193
202
|
});
|
194
|
-
(0, child_process_1.execSync)(`echo "SKIP_PREFLIGHT_CHECK=true" > .env`, {
|
203
|
+
(0, child_process_1.execSync)(`echo "SKIP_PREFLIGHT_CHECK=true" > .env`, {
|
204
|
+
stdio: [0, 1, 2],
|
205
|
+
windowsHide: true,
|
206
|
+
});
|
195
207
|
}
|
196
208
|
}
|
197
209
|
function copyFromTempWorkspaceToRoot() {
|
@@ -59,6 +59,7 @@ function deduceDefaultBase() {
|
|
59
59
|
try {
|
60
60
|
(0, child_process_1.execSync)(`git rev-parse --verify main`, {
|
61
61
|
stdio: ['ignore', 'ignore', 'ignore'],
|
62
|
+
windowsHide: true,
|
62
63
|
});
|
63
64
|
return 'main';
|
64
65
|
}
|
@@ -66,6 +67,7 @@ function deduceDefaultBase() {
|
|
66
67
|
try {
|
67
68
|
(0, child_process_1.execSync)(`git rev-parse --verify dev`, {
|
68
69
|
stdio: ['ignore', 'ignore', 'ignore'],
|
70
|
+
windowsHide: true,
|
69
71
|
});
|
70
72
|
return 'dev';
|
71
73
|
}
|
@@ -73,6 +75,7 @@ function deduceDefaultBase() {
|
|
73
75
|
try {
|
74
76
|
(0, child_process_1.execSync)(`git rev-parse --verify develop`, {
|
75
77
|
stdio: ['ignore', 'ignore', 'ignore'],
|
78
|
+
windowsHide: true,
|
76
79
|
});
|
77
80
|
return 'develop';
|
78
81
|
}
|
@@ -80,6 +83,7 @@ function deduceDefaultBase() {
|
|
80
83
|
try {
|
81
84
|
(0, child_process_1.execSync)(`git rev-parse --verify next`, {
|
82
85
|
stdio: ['ignore', 'ignore', 'ignore'],
|
86
|
+
windowsHide: true,
|
83
87
|
});
|
84
88
|
return 'next';
|
85
89
|
}
|
@@ -128,7 +132,7 @@ function updateGitIgnore(root) {
|
|
128
132
|
catch { }
|
129
133
|
}
|
130
134
|
function runInstall(repoRoot, pmc = (0, package_manager_1.getPackageManagerCommand)()) {
|
131
|
-
(0, child_process_1.execSync)(pmc.install, { stdio: [0, 1, 2], cwd: repoRoot });
|
135
|
+
(0, child_process_1.execSync)(pmc.install, { stdio: [0, 1, 2], cwd: repoRoot, windowsHide: true });
|
132
136
|
}
|
133
137
|
async function initCloud(installationSource) {
|
134
138
|
const token = await (0, connect_to_nx_cloud_2.connectWorkspaceToCloud)({
|
@@ -29,9 +29,10 @@ function installPlugins(repoRoot, plugins, pmc, updatePackageScripts) {
|
|
29
29
|
(0, utils_1.runInstall)(repoRoot, pmc);
|
30
30
|
output_1.output.log({ title: '🔨 Configuring plugins' });
|
31
31
|
for (const plugin of plugins) {
|
32
|
-
(0, child_process_2.execSync)(`${pmc.exec} nx g ${plugin}:init --keepExistingVersions ${updatePackageScripts ? '--updatePackageScripts' : ''}
|
32
|
+
(0, child_process_2.execSync)(`${pmc.exec} nx g ${plugin}:init --keepExistingVersions ${updatePackageScripts ? '--updatePackageScripts' : ''}`, {
|
33
33
|
stdio: [0, 1, 2],
|
34
34
|
cwd: repoRoot,
|
35
|
+
windowsHide: true,
|
35
36
|
});
|
36
37
|
}
|
37
38
|
}
|
@@ -101,6 +101,7 @@ function runMigration() {
|
|
101
101
|
}
|
102
102
|
(0, child_process_2.execSync)(`${p} _migrate ${process.argv.slice(3).join(' ')}`, {
|
103
103
|
stdio: ['inherit', 'inherit', 'inherit'],
|
104
|
+
windowsHide: true,
|
104
105
|
});
|
105
106
|
}
|
106
107
|
}
|
@@ -127,18 +128,21 @@ function nxCliPath() {
|
|
127
128
|
(0, child_process_2.execSync)(pmc.preInstall, {
|
128
129
|
cwd: tmpDir,
|
129
130
|
stdio: ['ignore', 'ignore', 'ignore'],
|
131
|
+
windowsHide: true,
|
130
132
|
});
|
131
133
|
// if it's berry ensure we set the node_linker to node-modules
|
132
134
|
if (packageManager === 'yarn' && pmc.ciInstall.includes('immutable')) {
|
133
135
|
(0, child_process_2.execSync)('yarn config set nodeLinker node-modules', {
|
134
136
|
cwd: tmpDir,
|
135
137
|
stdio: ['ignore', 'ignore', 'ignore'],
|
138
|
+
windowsHide: true,
|
136
139
|
});
|
137
140
|
}
|
138
141
|
}
|
139
142
|
(0, child_process_2.execSync)(pmc.install, {
|
140
143
|
cwd: tmpDir,
|
141
144
|
stdio: ['ignore', 'ignore', 'ignore'],
|
145
|
+
windowsHide: true,
|
142
146
|
});
|
143
147
|
// Set NODE_PATH so that these modules can be used for module resolution
|
144
148
|
addToNodePath(path.join(tmpDir, 'node_modules'));
|
@@ -886,7 +886,7 @@ function runInstall() {
|
|
886
886
|
output_1.output.log({
|
887
887
|
title: `Running '${pmCommands.install}' to make sure necessary packages are installed`,
|
888
888
|
});
|
889
|
-
(0, child_process_1.execSync)(pmCommands.install, { stdio: [0, 1, 2] });
|
889
|
+
(0, child_process_1.execSync)(pmCommands.install, { stdio: [0, 1, 2], windowsHide: true });
|
890
890
|
}
|
891
891
|
async function executeMigrations(root, migrations, isVerbose, shouldCreateCommits, commitPrefix) {
|
892
892
|
let initialDeps = getStringifiedPackageJsonDeps(root);
|
@@ -191,7 +191,9 @@ function isReleaseType(value) {
|
|
191
191
|
}
|
192
192
|
async function getCommitForVersionPlanFile(rawVersionPlan, isVerbose) {
|
193
193
|
return new Promise((resolve) => {
|
194
|
-
(0, node_child_process_1.exec)(`git log --diff-filter=A --pretty=format:"%s|%h|%an|%ae|%b" -n 1 -- ${rawVersionPlan.absolutePath}`,
|
194
|
+
(0, node_child_process_1.exec)(`git log --diff-filter=A --pretty=format:"%s|%h|%an|%ae|%b" -n 1 -- ${rawVersionPlan.absolutePath}`, {
|
195
|
+
windowsHide: true,
|
196
|
+
}, (error, stdout, stderr) => {
|
195
197
|
if (error) {
|
196
198
|
if (isVerbose) {
|
197
199
|
console.error(`Error executing git command for ${rawVersionPlan.relativePath}: ${error.message}`);
|
@@ -13,6 +13,7 @@ async function launchEditor(filePath) {
|
|
13
13
|
return new Promise((resolve, reject) => {
|
14
14
|
const editorProcess = (0, node_child_process_1.spawn)(cmd, [...args, filePath], {
|
15
15
|
stdio: 'inherit', // This will ensure the editor uses the current terminal
|
16
|
+
windowsHide: true,
|
16
17
|
});
|
17
18
|
editorProcess.on('exit', (code) => {
|
18
19
|
if (code === 0) {
|
@@ -26,7 +27,11 @@ async function launchEditor(filePath) {
|
|
26
27
|
}
|
27
28
|
function getGitConfig(key) {
|
28
29
|
try {
|
29
|
-
return (0, node_child_process_1.execSync)(`git config --get ${key}
|
30
|
+
return (0, node_child_process_1.execSync)(`git config --get ${key}`, {
|
31
|
+
windowsHide: true,
|
32
|
+
})
|
33
|
+
.toString()
|
34
|
+
.trim();
|
30
35
|
}
|
31
36
|
catch {
|
32
37
|
return null;
|
@@ -1,6 +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
5
|
export declare const packagesWeCareAbout: string[];
|
5
6
|
export declare const patternsWeIgnoreInCommunityReport: Array<string | RegExp>;
|
6
7
|
/**
|
@@ -15,7 +16,8 @@ export declare function reportHandler(): Promise<void>;
|
|
15
16
|
export interface ReportData {
|
16
17
|
pm: PackageManager;
|
17
18
|
pmVersion: string;
|
18
|
-
powerpackLicense:
|
19
|
+
powerpackLicense: PowerpackLicense | null;
|
20
|
+
powerpackError: Error | null;
|
19
21
|
powerpackPlugins: PackageJson[];
|
20
22
|
localPlugins: string[];
|
21
23
|
communityPlugins: PackageJson[];
|
@@ -46,7 +46,7 @@ const LINE_SEPARATOR = '---------------------------------------';
|
|
46
46
|
*
|
47
47
|
*/
|
48
48
|
async function reportHandler() {
|
49
|
-
const { pm, pmVersion, powerpackLicense, 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}`],
|
@@ -62,6 +62,7 @@ async function reportHandler() {
|
|
62
62
|
bodyLines.push(`${chalk.green(p.package.padEnd(padding))} : ${chalk.bold(p.version)}`);
|
63
63
|
});
|
64
64
|
if (powerpackLicense) {
|
65
|
+
bodyLines.push('');
|
65
66
|
bodyLines.push(LINE_SEPARATOR);
|
66
67
|
bodyLines.push(chalk.green('Nx Powerpack'));
|
67
68
|
bodyLines.push(`Licensed to ${powerpackLicense.organizationName} for ${powerpackLicense.seatCount} user${powerpackLicense.seatCount > 1 ? 's' : ''} in ${powerpackLicense.workspaceCount} workspace${powerpackLicense.workspaceCount > 1 ? 's' : ''} until ${new Date(powerpackLicense.expiresAt * 1000).toLocaleDateString()}`);
|
@@ -71,6 +72,14 @@ async function reportHandler() {
|
|
71
72
|
for (const powerpackPlugin of powerpackPlugins) {
|
72
73
|
bodyLines.push(`${chalk.green(powerpackPlugin.name.padEnd(padding))} : ${chalk.bold(powerpackPlugin.version)}`);
|
73
74
|
}
|
75
|
+
bodyLines.push('');
|
76
|
+
}
|
77
|
+
else if (powerpackError) {
|
78
|
+
bodyLines.push('');
|
79
|
+
bodyLines.push(chalk.red('Nx Powerpack'));
|
80
|
+
bodyLines.push(LINE_SEPARATOR);
|
81
|
+
bodyLines.push(powerpackError.message);
|
82
|
+
bodyLines.push('');
|
74
83
|
}
|
75
84
|
if (registeredPlugins.length) {
|
76
85
|
bodyLines.push(LINE_SEPARATOR);
|
@@ -137,13 +146,19 @@ async function getReportData() {
|
|
137
146
|
const outOfSyncPackageGroup = findMisalignedPackagesForPackage(nxPackageJson);
|
138
147
|
const native = isNativeAvailable();
|
139
148
|
let powerpackLicense = null;
|
149
|
+
let powerpackError = null;
|
140
150
|
try {
|
141
151
|
powerpackLicense = await (0, powerpack_1.getPowerpackLicenseInformation)();
|
142
152
|
}
|
143
|
-
catch {
|
153
|
+
catch (e) {
|
154
|
+
if (!(e instanceof powerpack_1.NxPowerpackNotInstalledError)) {
|
155
|
+
powerpackError = e;
|
156
|
+
}
|
157
|
+
}
|
144
158
|
return {
|
145
159
|
pm,
|
146
160
|
powerpackLicense,
|
161
|
+
powerpackError,
|
147
162
|
powerpackPlugins,
|
148
163
|
pmVersion,
|
149
164
|
localPlugins,
|
@@ -12,8 +12,8 @@ function syncHandler(options) {
|
|
12
12
|
return (0, handle_errors_1.handleErrors)(options.verbose, async () => {
|
13
13
|
const projectGraph = await (0, project_graph_1.createProjectGraphAsync)();
|
14
14
|
const nxJson = (0, nx_json_1.readNxJson)();
|
15
|
-
const
|
16
|
-
if (!
|
15
|
+
const { globalGenerators, taskGenerators } = await (0, sync_generators_1.collectAllRegisteredSyncGenerators)(projectGraph, nxJson);
|
16
|
+
if (!globalGenerators.length && !taskGenerators.length) {
|
17
17
|
output_1.output.success({
|
18
18
|
title: options.check
|
19
19
|
? 'The workspace is up to date'
|
@@ -22,6 +22,7 @@ function syncHandler(options) {
|
|
22
22
|
});
|
23
23
|
return 0;
|
24
24
|
}
|
25
|
+
const syncGenerators = Array.from(new Set([...globalGenerators, ...taskGenerators]));
|
25
26
|
const results = await (0, sync_generators_1.getSyncGeneratorChanges)(syncGenerators);
|
26
27
|
if (!results.length) {
|
27
28
|
output_1.output.success({
|
@@ -33,7 +34,7 @@ function syncHandler(options) {
|
|
33
34
|
return 0;
|
34
35
|
}
|
35
36
|
const { failedGeneratorsCount, areAllResultsFailures, anySyncGeneratorsFailed, } = (0, sync_generators_1.processSyncGeneratorResultErrors)(results);
|
36
|
-
const failedSyncGeneratorsFixMessageLines = (0, sync_generators_1.getFailedSyncGeneratorsFixMessageLines)(results, options.verbose);
|
37
|
+
const failedSyncGeneratorsFixMessageLines = (0, sync_generators_1.getFailedSyncGeneratorsFixMessageLines)(results, options.verbose, new Set(globalGenerators));
|
37
38
|
if (areAllResultsFailures) {
|
38
39
|
output_1.output.error({
|
39
40
|
title: `The workspace is probably out of sync because ${failedGeneratorsCount === 1
|
@@ -71,7 +72,7 @@ function syncHandler(options) {
|
|
71
72
|
spinner.fail();
|
72
73
|
output_1.output.error({
|
73
74
|
title: 'Failed to sync the workspace',
|
74
|
-
bodyLines: (0, sync_generators_1.getFlushFailureMessageLines)(flushResult, options.verbose),
|
75
|
+
bodyLines: (0, sync_generators_1.getFlushFailureMessageLines)(flushResult, options.verbose, new Set(globalGenerators)),
|
75
76
|
});
|
76
77
|
return 1;
|
77
78
|
}
|
package/src/config/nx-json.d.ts
CHANGED
@@ -462,6 +462,10 @@ export interface NxJsonConfiguration<T = '*' | string[]> {
|
|
462
462
|
* Configuration for the `nx sync` command.
|
463
463
|
*/
|
464
464
|
sync?: NxSyncConfiguration;
|
465
|
+
/**
|
466
|
+
* Enable the new experimental db based cache
|
467
|
+
*/
|
468
|
+
enableDbCache?: boolean;
|
465
469
|
}
|
466
470
|
export type PluginConfiguration = string | ExpandedPluginConfiguration;
|
467
471
|
export type ExpandedPluginConfiguration<T = unknown> = {
|
@@ -55,7 +55,10 @@ export declare class DaemonClient {
|
|
55
55
|
recordTaskRuns(taskRuns: TaskRun[]): Promise<void>;
|
56
56
|
getSyncGeneratorChanges(generators: string[]): Promise<SyncGeneratorRunResult[]>;
|
57
57
|
flushSyncGeneratorChangesToDisk(generators: string[]): Promise<FlushSyncGeneratorChangesResult>;
|
58
|
-
getRegisteredSyncGenerators(): Promise<
|
58
|
+
getRegisteredSyncGenerators(): Promise<{
|
59
|
+
globalGenerators: string[];
|
60
|
+
taskGenerators: string[];
|
61
|
+
}>;
|
59
62
|
updateWorkspaceContext(createdFiles: string[], updatedFiles: string[], deletedFiles: string[]): Promise<void>;
|
60
63
|
isServerAvailable(): Promise<boolean>;
|
61
64
|
private sendToDaemonViaQueue;
|