fix(js): properly throw error when processing lockfile during postins… (#18968)

This commit is contained in:
Jason Jean 2023-09-01 13:10:21 -04:00 committed by GitHub
parent 8f1429da97
commit a5a522e92c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -38,7 +38,7 @@ export const createNodes: CreateNodes = [
combineGlobPatterns(LOCKFILES), combineGlobPatterns(LOCKFILES),
(lockFile, context) => { (lockFile, context) => {
const pluginConfig = jsPluginConfig(context.nxJsonConfiguration); const pluginConfig = jsPluginConfig(context.nxJsonConfiguration);
if (!pluginConfig.analyzePackageJson) { if (!pluginConfig.analyzeLockfile) {
return {}; return {};
} }
@ -83,7 +83,7 @@ export const createDependencies: CreateDependencies = (
let lockfileDependencies: ProjectGraphDependencyWithFile[] = []; let lockfileDependencies: ProjectGraphDependencyWithFile[] = [];
// lockfile may not exist yet // lockfile may not exist yet
if ( if (
pluginConfig.analyzePackageJson && pluginConfig.analyzeLockfile &&
lockFileExists(packageManager) && lockFileExists(packageManager) &&
parsedLockFile parsedLockFile
) { ) {

View File

@ -76,7 +76,7 @@ export function getLockFileNodes(
bodyLines: errorBodyLines(e), bodyLines: errorBodyLines(e),
}); });
} }
return; throw e;
} }
throw new Error(`Unknown package manager: ${packageManager}`); throw new Error(`Unknown package manager: ${packageManager}`);
} }
@ -107,7 +107,7 @@ export function getLockFileDependencies(
bodyLines: errorBodyLines(e), bodyLines: errorBodyLines(e),
}); });
} }
return; throw e;
} }
throw new Error(`Unknown package manager: ${packageManager}`); throw new Error(`Unknown package manager: ${packageManager}`);
} }