0
0
Fork 0
mirror of https://github.com/renovatebot/renovate.git synced 2025-03-15 00:32:54 +00:00

fix: don’t reuse lock files in branch if any updates are lock file maintenance

This commit is contained in:
Rhys Arkins 2018-07-05 12:02:53 +02:00
parent 517de6f545
commit 5ea6955aac
2 changed files with 6 additions and 7 deletions
lib
manager/npm/post-update
workers/repository/updates

View file

@ -184,7 +184,7 @@ async function writeExistingFiles(config, packageFiles) {
const npmLockPath = upath.join(config.tmpDir.path, npmLock);
if (
process.env.RENOVATE_REUSE_PACKAGE_LOCK === 'false' ||
config.updateType === 'lockFileMaintenance'
config.reuseLockFiles === false
) {
logger.debug(`Ensuring ${npmLock} is removed`);
await fs.remove(npmLockPath);
@ -197,7 +197,7 @@ async function writeExistingFiles(config, packageFiles) {
const { yarnLock } = packageFile;
if (yarnLock) {
const yarnLockPath = upath.join(config.tmpDir.path, yarnLock);
if (config.updateType === 'lockFileMaintenance') {
if (config.reuseLockFiles === false) {
logger.debug(`Ensuring ${yarnLock} is removed`);
await fs.remove(yarnLockPath);
} else {
@ -209,11 +209,7 @@ async function writeExistingFiles(config, packageFiles) {
// TODO: Update the below with this once https://github.com/pnpm/pnpm/issues/992 is fixed
const pnpmBug992 = true;
// istanbul ignore next
if (
packageFile.pnpmShrinkwrap &&
config.updateType !== 'lockFileMaintenance' &&
!pnpmBug992
) {
if (packageFile.pnpmShrinkwrap && config.reuseLockFiles && !pnpmBug992) {
logger.debug(`Writing shrinkwrap.yaml to ${basedir}`);
const shrinkwrap = await platform.getFile(packageFile.pnpmShrinkwrap);
await fs.outputFile(upath.join(basedir, 'shrinkwrap.yaml'), shrinkwrap);

View file

@ -140,6 +140,9 @@ function generateBranchConfig(branchUpgrades) {
config.canBeUnpublished = config.upgrades.some(
upgrade => upgrade.canBeUnpublished
);
config.reuseLockFiles = config.upgrades.every(
upgrade => upgrade.updateType !== 'lockFileMaintenance'
);
config.automerge = config.upgrades.every(upgrade => upgrade.automerge);
return config;
}