Compare commits

...

3 Commits

Author SHA1 Message Date
FrozenPandaz 8b39941251 chore(repo): debug 2025-02-05 12:31:21 -05:00
FrozenPandaz 24bb541841 fix(core): do not write filemap cache when there are errors 2025-02-05 12:28:56 -05:00
FrozenPandaz 716ac9083d chore(core): handle project graph errors which do not have a message 2025-02-04 17:01:00 -05:00
3 changed files with 20 additions and 5 deletions
@@ -223,11 +223,16 @@ export function writeCache(
});
renameSync(tmpProjectGraphPath, nxProjectGraph);
writeJsonFile(tmpFileMapPath, cache);
renameSync(tmpFileMapPath, nxFileMap);
writeJsonFile(tmpSourceMapPath, sourceMaps);
renameSync(tmpSourceMapPath, nxSourceMaps);
// only write the file map if there are no errors
// if there were errors, the errors make the filemap invalid
// TODO: We should be able to keep the valid part of the filemap if the errors being thrown told us which parts of the filemap were invalid
if (errors.length === 0) {
writeJsonFile(tmpFileMapPath, cache);
renameSync(tmpFileMapPath, nxFileMap);
}
done = true;
} catch (err: any) {
if (err instanceof Error) {
@@ -14,11 +14,18 @@ global.NX_GRAPH_CREATION = true;
global.NX_PLUGIN_WORKER = true;
let connected = false;
let plugin: LoadedNxPlugin;
let start: number;
const socketPath = process.argv[2];
const server = createServer((socket) => {
connected = true;
const startupTime = Date.now() - start;
if (startupTime > 5000) {
console.warn(`Plugin Worker took ${startupTime}ms to start up.`);
}
// This handles cases where the host process was killed
// after the worker connected but before the worker was
// instructed to load the plugin.
@@ -206,12 +213,13 @@ const server = createServer((socket) => {
server.listen(socketPath);
start = Date.now();
setTimeout(() => {
if (!connected) {
console.error(
'The plugin worker is exiting as it was not connected to within 5 seconds.'
);
process.exit(1);
// process.exit(1);
}
}, 5000).unref();
@@ -198,7 +198,7 @@ export function handleProjectGraphError(opts: { exitOnError: boolean }, e) {
title,
bodyLines: bodyLines,
});
} else {
} else if (typeof e.message === 'string') {
const lines = e.message.split('\n');
output.error({
title: lines[0],
@@ -207,6 +207,8 @@ export function handleProjectGraphError(opts: { exitOnError: boolean }, e) {
if (isVerbose) {
console.error(e);
}
} else {
console.error(e);
}
process.exit(1);
} else {