nx 20.0.0-beta.1 → 20.0.0-beta.3
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 +11 -2
- package/bin/nx.js +10 -2
- package/package.json +14 -13
- package/schemas/nx-schema.json +26 -21
- 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 +10 -9
- package/src/command-line/init/implementation/add-nx-to-nest.js +5 -5
- 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/clean-up-files.js +7 -7
- package/src/command-line/init/implementation/react/index.js +36 -17
- package/src/command-line/init/implementation/react/rename-js-to-jsx.js +3 -3
- 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 +1 -0
- package/src/command-line/migrate/command-object.js +4 -0
- package/src/command-line/migrate/migrate.js +1 -1
- package/src/command-line/release/changelog.js +1 -2
- package/src/command-line/release/config/version-plans.js +9 -8
- package/src/command-line/release/plan.js +6 -5
- package/src/command-line/release/release.js +2 -2
- 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 +6 -3
- package/src/command-line/report/report.d.ts +3 -1
- package/src/command-line/report/report.js +17 -2
- package/src/command-line/reset/reset.js +4 -4
- 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/core/graph/main.js +1 -1
- package/src/core/graph/styles.css +1 -1
- package/src/core/graph/styles.js +1 -1
- package/src/daemon/cache.d.ts +1 -2
- package/src/daemon/cache.js +12 -21
- package/src/daemon/client/client.d.ts +4 -1
- package/src/daemon/client/client.js +9 -8
- 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/daemon/tmp-dir.js +6 -7
- package/src/executors/run-commands/run-commands.impl.js +1 -0
- package/src/executors/run-script/run-script.impl.js +1 -0
- package/src/generators/tree.d.ts +1 -1
- package/src/generators/tree.js +11 -11
- 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/plugins/js/index.js +1 -2
- package/src/project-graph/file-utils.js +1 -0
- package/src/project-graph/nx-deps-cache.js +5 -6
- package/src/tasks-runner/cache.d.ts +3 -1
- package/src/tasks-runner/cache.js +29 -29
- package/src/tasks-runner/default-tasks-runner.js +1 -1
- package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +5 -0
- package/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +7 -0
- package/src/tasks-runner/life-cycles/task-history-life-cycle.js +3 -0
- package/src/tasks-runner/remove-old-cache-records.js +2 -3
- 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/fileutils.d.ts +9 -1
- package/src/utils/fileutils.js +29 -12
- 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/ignore.js +2 -2
- package/src/utils/package-manager.js +2 -2
- package/src/utils/plugins/core-plugins.js +4 -0
- 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
@@ -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)({
|
@@ -32,6 +32,7 @@ function installPlugins(repoRoot, plugins, pmc, updatePackageScripts) {
|
|
32
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);
|
@@ -5,7 +5,6 @@ exports.createAPI = createAPI;
|
|
5
5
|
exports.shouldCreateGitHubRelease = shouldCreateGitHubRelease;
|
6
6
|
const chalk = require("chalk");
|
7
7
|
const enquirer_1 = require("enquirer");
|
8
|
-
const fs_extra_1 = require("fs-extra");
|
9
8
|
const node_fs_1 = require("node:fs");
|
10
9
|
const semver_1 = require("semver");
|
11
10
|
const tmp_1 = require("tmp");
|
@@ -620,7 +619,7 @@ async function applyChangesAndExit(args, nxReleaseConfig, tree, toSHA, postGitTa
|
|
620
619
|
if (group.resolvedVersionPlans) {
|
621
620
|
group.resolvedVersionPlans.forEach((plan) => {
|
622
621
|
if (!args.dryRun) {
|
623
|
-
(0,
|
622
|
+
(0, node_fs_1.rmSync)(plan.absolutePath, { recursive: true, force: true });
|
624
623
|
if (args.verbose) {
|
625
624
|
console.log(`Removing ${plan.relativePath}`);
|
626
625
|
}
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.readRawVersionPlans = readRawVersionPlans;
|
4
4
|
exports.setResolvedVersionPlansOnGroups = setResolvedVersionPlansOnGroups;
|
5
5
|
exports.getVersionPlansAbsolutePath = getVersionPlansAbsolutePath;
|
6
|
-
const fs_1 = require("fs");
|
7
|
-
const fs_extra_1 = require("fs-extra");
|
8
6
|
const node_child_process_1 = require("node:child_process");
|
7
|
+
const node_fs_1 = require("node:fs");
|
8
|
+
const promises_1 = require("node:fs/promises");
|
9
9
|
const path_1 = require("path");
|
10
10
|
const semver_1 = require("semver");
|
11
11
|
const workspace_root_1 = require("../../../utils/workspace-root");
|
@@ -14,16 +14,15 @@ const fm = require('front-matter');
|
|
14
14
|
const versionPlansDirectory = (0, path_1.join)('.nx', 'version-plans');
|
15
15
|
async function readRawVersionPlans() {
|
16
16
|
const versionPlansPath = getVersionPlansAbsolutePath();
|
17
|
-
|
18
|
-
if (!versionPlansPathExists) {
|
17
|
+
if (!(0, node_fs_1.existsSync)(versionPlansPath)) {
|
19
18
|
return [];
|
20
19
|
}
|
21
20
|
const versionPlans = [];
|
22
|
-
const versionPlanFiles = (0,
|
21
|
+
const versionPlanFiles = (0, node_fs_1.readdirSync)(versionPlansPath);
|
23
22
|
for (const versionPlanFile of versionPlanFiles) {
|
24
23
|
const filePath = (0, path_1.join)(versionPlansPath, versionPlanFile);
|
25
|
-
const versionPlanContent = (0,
|
26
|
-
const versionPlanStats = await (0,
|
24
|
+
const versionPlanContent = (0, node_fs_1.readFileSync)(filePath).toString();
|
25
|
+
const versionPlanStats = await (0, promises_1.stat)(filePath);
|
27
26
|
const parsedContent = fm(versionPlanContent);
|
28
27
|
versionPlans.push({
|
29
28
|
absolutePath: filePath,
|
@@ -191,7 +190,9 @@ function isReleaseType(value) {
|
|
191
190
|
}
|
192
191
|
async function getCommitForVersionPlanFile(rawVersionPlan, isVerbose) {
|
193
192
|
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}`,
|
193
|
+
(0, node_child_process_1.exec)(`git log --diff-filter=A --pretty=format:"%s|%h|%an|%ae|%b" -n 1 -- ${rawVersionPlan.absolutePath}`, {
|
194
|
+
windowsHide: true,
|
195
|
+
}, (error, stdout, stderr) => {
|
195
196
|
if (error) {
|
196
197
|
if (isVerbose) {
|
197
198
|
console.error(`Error executing git command for ${rawVersionPlan.relativePath}: ${error.message}`);
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.releasePlanCLIHandler = void 0;
|
4
4
|
exports.createAPI = createAPI;
|
5
5
|
const enquirer_1 = require("enquirer");
|
6
|
-
const
|
6
|
+
const node_fs_1 = require("node:fs");
|
7
|
+
const promises_1 = require("node:fs/promises");
|
7
8
|
const node_path_1 = require("node:path");
|
8
9
|
const semver_1 = require("semver");
|
9
10
|
const tmp_1 = require("tmp");
|
@@ -193,8 +194,8 @@ async function createVersionPlanFileForBumps(args, versionPlanBumps) {
|
|
193
194
|
output_1.output.logSingleLine(`Creating version plan file "${versionPlanFileName}"`);
|
194
195
|
(0, print_changes_1.printDiff)('', versionPlanFileContent, 1);
|
195
196
|
const versionPlansAbsolutePath = (0, version_plans_1.getVersionPlansAbsolutePath)();
|
196
|
-
await (0,
|
197
|
-
await (0,
|
197
|
+
await (0, promises_1.mkdir)(versionPlansAbsolutePath, { recursive: true });
|
198
|
+
await (0, promises_1.writeFile)((0, node_path_1.join)(versionPlansAbsolutePath, versionPlanFileName), versionPlanFileContent);
|
198
199
|
}
|
199
200
|
}
|
200
201
|
async function promptForVersion(message) {
|
@@ -236,9 +237,9 @@ async function _promptForMessage(versionPlanName) {
|
|
236
237
|
if (!message.length) {
|
237
238
|
const tmpDir = (0, tmp_1.dirSync)().name;
|
238
239
|
const messageFilePath = (0, node_path_1.join)(tmpDir, `DRAFT_MESSAGE__${versionPlanName}.md`);
|
239
|
-
(0,
|
240
|
+
(0, node_fs_1.writeFileSync)(messageFilePath, '');
|
240
241
|
await (0, launch_editor_1.launchEditor)(messageFilePath);
|
241
|
-
message = (0,
|
242
|
+
message = (0, node_fs_1.readFileSync)(messageFilePath, 'utf-8');
|
242
243
|
}
|
243
244
|
message = message.trim();
|
244
245
|
if (!message) {
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.releaseCLIHandler = void 0;
|
4
4
|
exports.createAPI = createAPI;
|
5
5
|
const enquirer_1 = require("enquirer");
|
6
|
-
const
|
6
|
+
const node_fs_1 = require("node:fs");
|
7
7
|
const nx_json_1 = require("../../config/nx-json");
|
8
8
|
const file_map_utils_1 = require("../../project-graph/file-map-utils");
|
9
9
|
const project_graph_1 = require("../../project-graph/project-graph");
|
@@ -106,7 +106,7 @@ function createAPI(overrideReleaseConfig) {
|
|
106
106
|
}
|
107
107
|
group.resolvedVersionPlans.forEach((plan) => {
|
108
108
|
if (!args.dryRun) {
|
109
|
-
(0,
|
109
|
+
(0, node_fs_1.rmSync)(plan.absolutePath, { recursive: true, force: true });
|
110
110
|
if (args.verbose) {
|
111
111
|
console.log(`Removing ${plan.relativePath}`);
|
112
112
|
}
|
@@ -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;
|
@@ -210,7 +210,7 @@ function createAPI(overrideReleaseConfig) {
|
|
210
210
|
runPreVersionCommand(releaseGroup.version.groupPreVersionCommand, {
|
211
211
|
dryRun: args.dryRun,
|
212
212
|
verbose: args.verbose,
|
213
|
-
});
|
213
|
+
}, releaseGroup);
|
214
214
|
const projectBatches = (0, batch_projects_by_generator_config_1.batchProjectsByGeneratorConfig)(projectGraph, releaseGroup,
|
215
215
|
// Batch based on all projects within the release group
|
216
216
|
releaseGroup.projects);
|
@@ -412,11 +412,13 @@ function resolveGeneratorData({ collectionName, generatorName, configGeneratorOp
|
|
412
412
|
throw err;
|
413
413
|
}
|
414
414
|
}
|
415
|
-
function runPreVersionCommand(preVersionCommand, { dryRun, verbose }) {
|
415
|
+
function runPreVersionCommand(preVersionCommand, { dryRun, verbose }, releaseGroup) {
|
416
416
|
if (!preVersionCommand) {
|
417
417
|
return;
|
418
418
|
}
|
419
|
-
output_1.output.logSingleLine(
|
419
|
+
output_1.output.logSingleLine(releaseGroup
|
420
|
+
? `Executing release group pre-version command for "${releaseGroup.name}"`
|
421
|
+
: `Executing pre-version command`);
|
420
422
|
if (verbose) {
|
421
423
|
console.log(`Executing the following pre-version command:`);
|
422
424
|
console.log(preVersionCommand);
|
@@ -434,6 +436,7 @@ function runPreVersionCommand(preVersionCommand, { dryRun, verbose }) {
|
|
434
436
|
maxBuffer: LARGE_BUFFER,
|
435
437
|
stdio,
|
436
438
|
env,
|
439
|
+
windowsHide: true,
|
437
440
|
});
|
438
441
|
}
|
439
442
|
catch (e) {
|
@@ -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,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.resetHandler = resetHandler;
|
4
|
-
const
|
4
|
+
const node_fs_1 = require("node:fs");
|
5
5
|
const client_1 = require("../../daemon/client/client");
|
6
6
|
const cache_directory_1 = require("../../utils/cache-directory");
|
7
7
|
const output_1 = require("../../utils/output");
|
@@ -92,17 +92,17 @@ async function resetCloudClient() {
|
|
92
92
|
}
|
93
93
|
function cleanupCacheEntries() {
|
94
94
|
return incrementalBackoff(INCREMENTAL_BACKOFF_FIRST_DELAY, INCREMENTAL_BACKOFF_MAX_DURATION, () => {
|
95
|
-
(0,
|
95
|
+
(0, node_fs_1.rmSync)(cache_directory_1.cacheDir, { recursive: true, force: true });
|
96
96
|
});
|
97
97
|
}
|
98
98
|
function cleanupNativeFileCache() {
|
99
99
|
return incrementalBackoff(INCREMENTAL_BACKOFF_FIRST_DELAY, INCREMENTAL_BACKOFF_MAX_DURATION, () => {
|
100
|
-
(0,
|
100
|
+
(0, node_fs_1.rmSync)((0, native_file_cache_location_1.getNativeFileCacheLocation)(), { recursive: true, force: true });
|
101
101
|
});
|
102
102
|
}
|
103
103
|
function cleanupWorkspaceData() {
|
104
104
|
return incrementalBackoff(INCREMENTAL_BACKOFF_FIRST_DELAY, INCREMENTAL_BACKOFF_MAX_DURATION, () => {
|
105
|
-
(0,
|
105
|
+
(0, node_fs_1.rmSync)(cache_directory_1.workspaceDataDirectory, { recursive: true, force: true });
|
106
106
|
});
|
107
107
|
}
|
108
108
|
async function incrementalBackoff(ms, maxDuration, callback) {
|
@@ -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> = {
|