INNER CODE UNIT · TypeScript

getLastKnownGoodFromFileContent

nodejs/corepack · sources/Engine.ts:80

export function getLastKnownGoodFromFileContent(lastKnownGood: Record<string, string>, packageManager: string) {
  if (Object.hasOwn(lastKnownGood, packageManager))
    return lastKnownGood[packageManager];
  return undefined;
}

export async function activatePackageManager(lastKnownGood: Record<string, string>, locator: Locator) {
  if (lastKnownGood[locator.name] === locator.reference) {
    debugUtils.log(`${locator.name}@${locator.reference} is already Last Known Good version`);
    return;
  }

  lastKnownGood[locator.name] = locator.reference;

  debugUtils.log(`Setting ${locator.name}@${locator.reference} as Last Known Good version`);
  await createLastKnownGoodFile(lastKnownGood);
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…