nx 19.6.0-canary.20240813-c72ba9b → 19.6.0-canary.20240815-5410794
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/bin/post-install.js +1 -0
- package/package.json +14 -13
- package/src/command-line/release/command-object.d.ts +1 -0
- package/src/command-line/release/release.js +10 -1
- package/src/command-line/release/version.js +9 -2
- package/src/command-line/sync/sync.js +18 -0
- package/src/core/graph/main.js +1 -1
- package/src/daemon/server/project-graph-incremental-recomputation.js +1 -1
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/project-graph/project-graph.js +1 -1
- package/src/tasks-runner/run-command.js +23 -21
- package/src/utils/sync-generators.js +1 -2
- package/src/utils/workspace-context.d.ts +2 -2
- package/src/utils/workspace-context.js +4 -3
@@ -146,7 +146,7 @@ async function processFilesAndCreateAndSerializeProjectGraph(plugins) {
|
|
146
146
|
perf_hooks_1.performance.mark('hash-watched-changes-start');
|
147
147
|
const updatedFiles = [...collectedUpdatedFiles.values()];
|
148
148
|
const deletedFiles = [...collectedDeletedFiles.values()];
|
149
|
-
let updatedFileHashes = (0, workspace_context_1.updateFilesInContext)(updatedFiles, deletedFiles);
|
149
|
+
let updatedFileHashes = (0, workspace_context_1.updateFilesInContext)(workspace_root_1.workspaceRoot, updatedFiles, deletedFiles);
|
150
150
|
perf_hooks_1.performance.mark('hash-watched-changes-end');
|
151
151
|
perf_hooks_1.performance.measure('hash changed files from watcher', 'hash-watched-changes-start', 'hash-watched-changes-end');
|
152
152
|
logger_1.serverLogger.requestLog(`Updated workspace context based on watched changes, recomputing project graph...`);
|
Binary file
|
@@ -225,7 +225,7 @@ async function createProjectGraphAndSourceMapsAsync(opts = {
|
|
225
225
|
return projectGraphAndSourceMaps;
|
226
226
|
}
|
227
227
|
catch (e) {
|
228
|
-
if (e.message.indexOf('inotify_add_watch') > -1) {
|
228
|
+
if (e.message && e.message.indexOf('inotify_add_watch') > -1) {
|
229
229
|
// common errors with the daemon due to OS settings (cannot watch all the files available)
|
230
230
|
output_1.output.note({
|
231
231
|
title: `Unable to start Nx Daemon due to the limited amount of inotify watches, continuing without the daemon.`,
|
@@ -118,9 +118,6 @@ async function runCommand(projectsToRun, currentProjectGraph, { nxJson }, nxArgs
|
|
118
118
|
}
|
119
119
|
async function ensureWorkspaceIsInSyncAndGetGraphs(projectGraph, nxJson, projectNames, nxArgs, overrides, extraTargetDependencies, extraOptions) {
|
120
120
|
let taskGraph = createTaskGraphAndRunValidations(projectGraph, extraTargetDependencies ?? {}, projectNames, nxArgs, overrides, extraOptions);
|
121
|
-
if (process.env.NX_ENABLE_SYNC_GENERATORS !== 'true') {
|
122
|
-
return { projectGraph, taskGraph };
|
123
|
-
}
|
124
121
|
// collect unique syncGenerators from the tasks
|
125
122
|
const uniqueSyncGenerators = new Set();
|
126
123
|
for (const { target } of Object.values(taskGraph.tasks)) {
|
@@ -143,7 +140,7 @@ async function ensureWorkspaceIsInSyncAndGetGraphs(projectGraph, nxJson, project
|
|
143
140
|
return { projectGraph, taskGraph };
|
144
141
|
}
|
145
142
|
const outOfSyncTitle = 'The workspace is out of sync';
|
146
|
-
const resultBodyLines = (0, sync_generators_1.syncGeneratorResultsToMessageLines)(results);
|
143
|
+
const resultBodyLines = [...(0, sync_generators_1.syncGeneratorResultsToMessageLines)(results), ''];
|
147
144
|
const fixMessage = 'You can manually run `nx sync` to update your workspace or you can set `sync.applyChanges` to `true` in your `nx.json` to apply the changes automatically when running tasks.';
|
148
145
|
const willErrorOnCiMessage = 'Please note that this will be an error on CI.';
|
149
146
|
if ((0, is_ci_1.isCI)() || !process.stdout.isTTY) {
|
@@ -211,23 +208,28 @@ Please make sure to commit the changes to your repository.`);
|
|
211
208
|
return { projectGraph, taskGraph };
|
212
209
|
}
|
213
210
|
async function promptForApplyingSyncGeneratorChanges() {
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
211
|
+
try {
|
212
|
+
const promptConfig = {
|
213
|
+
name: 'applyChanges',
|
214
|
+
type: 'select',
|
215
|
+
message: 'Would you like to sync the changes to get your worskpace up to date?',
|
216
|
+
choices: [
|
217
|
+
{
|
218
|
+
name: 'yes',
|
219
|
+
message: 'Yes, sync the changes and run the tasks',
|
220
|
+
},
|
221
|
+
{
|
222
|
+
name: 'no',
|
223
|
+
message: 'No, run the tasks without syncing the changes',
|
224
|
+
},
|
225
|
+
],
|
226
|
+
footer: () => chalk.dim('\nYou can skip this prompt by setting the `sync.applyChanges` option in your `nx.json`.'),
|
227
|
+
};
|
228
|
+
return await (0, enquirer_1.prompt)([promptConfig]).then(({ applyChanges }) => applyChanges === 'yes');
|
229
|
+
}
|
230
|
+
catch {
|
231
|
+
process.exit(1);
|
232
|
+
}
|
231
233
|
}
|
232
234
|
function setEnvVarsBasedOnArgs(nxArgs, loadDotEnvFiles) {
|
233
235
|
if (nxArgs.outputStyle == 'stream' ||
|
@@ -103,7 +103,6 @@ function syncGeneratorResultsToMessageLines(results) {
|
|
103
103
|
if (result.outOfSyncMessage) {
|
104
104
|
messageLines.push(result.outOfSyncMessage);
|
105
105
|
}
|
106
|
-
messageLines.push('');
|
107
106
|
}
|
108
107
|
return messageLines;
|
109
108
|
}
|
@@ -130,7 +129,7 @@ async function flushSyncGeneratorChangesToDisk(results) {
|
|
130
129
|
}
|
131
130
|
}
|
132
131
|
// Update the context files
|
133
|
-
await (0, workspace_context_1.updateContextWithChangedFiles)(createdFiles, updatedFiles, deletedFiles);
|
132
|
+
await (0, workspace_context_1.updateContextWithChangedFiles)(workspace_root_1.workspaceRoot, createdFiles, updatedFiles, deletedFiles);
|
134
133
|
perf_hooks_1.performance.mark('flush-sync-generator-changes-to-disk:end');
|
135
134
|
perf_hooks_1.performance.measure('flush sync generator changes to disk', 'flush-sync-generator-changes-to-disk:start', 'flush-sync-generator-changes-to-disk:end');
|
136
135
|
}
|
@@ -11,8 +11,8 @@ export declare function getNxWorkspaceFilesFromContext(workspaceRoot: string, pr
|
|
11
11
|
export declare function globWithWorkspaceContextSync(workspaceRoot: string, globs: string[], exclude?: string[]): string[];
|
12
12
|
export declare function globWithWorkspaceContext(workspaceRoot: string, globs: string[], exclude?: string[]): Promise<string[]>;
|
13
13
|
export declare function hashWithWorkspaceContext(workspaceRoot: string, globs: string[], exclude?: string[]): Promise<string>;
|
14
|
-
export declare function updateContextWithChangedFiles(createdFiles: string[], updatedFiles: string[], deletedFiles: string[]): Promise<void>;
|
15
|
-
export declare function updateFilesInContext(updatedFiles: string[], deletedFiles: string[]): Record<string, string>;
|
14
|
+
export declare function updateContextWithChangedFiles(workspaceRoot: string, createdFiles: string[], updatedFiles: string[], deletedFiles: string[]): Promise<void>;
|
15
|
+
export declare function updateFilesInContext(workspaceRoot: string, updatedFiles: string[], deletedFiles: string[]): Record<string, string>;
|
16
16
|
export declare function getAllFileDataInContext(workspaceRoot: string): Promise<import("../native").FileData[]>;
|
17
17
|
export declare function getFilesInDirectoryUsingContext(workspaceRoot: string, dir: string): Promise<string[]>;
|
18
18
|
export declare function updateProjectFiles(projectRootMappings: Record<string, string>, rustReferences: NxWorkspaceFilesExternals, updatedFiles: Record<string, string>, deletedFiles: string[]): import("../native").UpdatedWorkspaceFiles;
|
@@ -57,9 +57,9 @@ async function hashWithWorkspaceContext(workspaceRoot, globs, exclude) {
|
|
57
57
|
}
|
58
58
|
return client_1.daemonClient.hashGlob(globs, exclude);
|
59
59
|
}
|
60
|
-
async function updateContextWithChangedFiles(createdFiles, updatedFiles, deletedFiles) {
|
60
|
+
async function updateContextWithChangedFiles(workspaceRoot, createdFiles, updatedFiles, deletedFiles) {
|
61
61
|
if (!client_1.daemonClient.enabled()) {
|
62
|
-
updateFilesInContext([...createdFiles, ...updatedFiles], deletedFiles);
|
62
|
+
updateFilesInContext(workspaceRoot, [...createdFiles, ...updatedFiles], deletedFiles);
|
63
63
|
}
|
64
64
|
else if ((0, is_on_daemon_1.isOnDaemon)()) {
|
65
65
|
// make sure to only import this when running on the daemon
|
@@ -72,7 +72,8 @@ async function updateContextWithChangedFiles(createdFiles, updatedFiles, deleted
|
|
72
72
|
await client_1.daemonClient.updateWorkspaceContext(createdFiles, updatedFiles, deletedFiles);
|
73
73
|
}
|
74
74
|
}
|
75
|
-
function updateFilesInContext(updatedFiles, deletedFiles) {
|
75
|
+
function updateFilesInContext(workspaceRoot, updatedFiles, deletedFiles) {
|
76
|
+
ensureContextAvailable(workspaceRoot);
|
76
77
|
return workspaceContext?.incrementalUpdate(updatedFiles, deletedFiles);
|
77
78
|
}
|
78
79
|
async function getAllFileDataInContext(workspaceRoot) {
|