Select Git revision
-
Rhys Arkins authored
There are times when an npm dependency has an update available yet the “npm/yarn/pnpm install” fails to find it, and the lock file can’t be generated. We check for this any time there’s a lock file error and abort the branch creation, hoping it fixes itself on the next run. Closes #1666
Rhys Arkins authoredThere are times when an npm dependency has an update available yet the “npm/yarn/pnpm install” fails to find it, and the lock file can’t be generated. We check for this any time there’s a lock file error and abort the branch creation, hoping it fixes itself on the next run. Closes #1666
npm.js 554 B
module.exports = {
getNpmLock,
};
async function getNpmLock(filePath) {
const lockRaw = await platform.getFile(filePath);
try {
const lockParsed = JSON.parse(lockRaw);
const lockFile = {};
for (const [entry, val] of Object.entries(lockParsed.dependencies)) {
logger.trace({ entry, version: val.version });
lockFile[entry] = val.version;
}
return lockFile;
} catch (err) {
logger.info(
{ filePath, err, message: err.message },
'Warning: Exception parsing npm lock file'
);
return {};
}
}