From 18c016bb06155d16e053c49df77d8b270adc6442 Mon Sep 17 00:00:00 2001 From: Craigory Coppola Date: Tue, 4 Apr 2023 17:36:58 -0400 Subject: [PATCH] fix(core): don't error if lock file not present when precomputing js dependencies (#16094) --- packages/nx/src/plugins/js/index.ts | 2 +- packages/nx/src/utils/nx-plugin.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/nx/src/plugins/js/index.ts b/packages/nx/src/plugins/js/index.ts index d0cf0d102b264..56dbfe4eefd3d 100644 --- a/packages/nx/src/plugins/js/index.ts +++ b/packages/nx/src/plugins/js/index.ts @@ -24,9 +24,9 @@ export const processProjectGraph: ProjectGraphProcessor = async ( ) => { const builder = new ProjectGraphBuilder(graph); - const lockHash = lockFileHash() ?? 'n/a'; // during the create-nx-workspace lock file might not exists yet if (lockFileExists()) { + const lockHash = lockFileHash() ?? 'n/a'; if (lockFileNeedsReprocessing(lockHash)) { removeNpmNodes(graph, builder); parseLockFile(builder); diff --git a/packages/nx/src/utils/nx-plugin.ts b/packages/nx/src/utils/nx-plugin.ts index bb933097aa320..92fa396d59620 100644 --- a/packages/nx/src/utils/nx-plugin.ts +++ b/packages/nx/src/utils/nx-plugin.ts @@ -132,7 +132,7 @@ export function loadNxPluginsSync( // Temporarily load js as if it were a plugin which is built into nx // In the future, this will be optional and need to be specified in nx.json const jsPlugin: any = require('../plugins/js'); - jsPlugin.name = 'index'; + jsPlugin.name = 'nx-js-graph-plugin'; result.push(jsPlugin as NxPlugin); plugins ??= []; @@ -163,7 +163,7 @@ export async function loadNxPlugins( // Temporarily load js as if it were a plugin which is built into nx // In the future, this will be optional and need to be specified in nx.json const jsPlugin: any = await import('../plugins/js'); - jsPlugin.name = 'index'; + jsPlugin.name = 'nx-js-graph-plugin'; result.push(jsPlugin as NxPlugin); plugins ??= [];