mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 15:06:27 +00:00
fix: use existing lock files when rebasing
Check if a lock file already exists in the current *branch* and if so then use it as the base for generating the new lock file and not the master one. Ensures that simple rebases result in same result. Closes #1481
This commit is contained in:
parent
84fe4f2dff
commit
4c6e3f7932
1 changed files with 11 additions and 2 deletions
|
@ -232,7 +232,12 @@ async function writeExistingFiles(config) {
|
||||||
}
|
}
|
||||||
if (packageFile.packageLock && config.type !== 'lockFileMaintenance') {
|
if (packageFile.packageLock && config.type !== 'lockFileMaintenance') {
|
||||||
logger.debug(`Writing package-lock.json to ${basedir}`);
|
logger.debug(`Writing package-lock.json to ${basedir}`);
|
||||||
const packageLock = await platform.getFile(packageFile.packageLock);
|
const existingPackageLock =
|
||||||
|
(await platform.branchExists(config.branchName)) &&
|
||||||
|
(await platform.getFile(packageFile.packageLock, config.branchName));
|
||||||
|
const packageLock =
|
||||||
|
existingPackageLock ||
|
||||||
|
(await platform.getFile(packageFile.packageLock));
|
||||||
await fs.outputFile(
|
await fs.outputFile(
|
||||||
upath.join(basedir, 'package-lock.json'),
|
upath.join(basedir, 'package-lock.json'),
|
||||||
packageLock
|
packageLock
|
||||||
|
@ -242,7 +247,11 @@ async function writeExistingFiles(config) {
|
||||||
}
|
}
|
||||||
if (packageFile.yarnLock && config.type !== 'lockFileMaintenance') {
|
if (packageFile.yarnLock && config.type !== 'lockFileMaintenance') {
|
||||||
logger.debug(`Writing yarn.lock to ${basedir}`);
|
logger.debug(`Writing yarn.lock to ${basedir}`);
|
||||||
const yarnLock = await platform.getFile(packageFile.yarnLock);
|
const existingYarnLock =
|
||||||
|
(await platform.branchExists(config.branchName)) &&
|
||||||
|
(await platform.getFile(packageFile.yarnLock, config.branchName));
|
||||||
|
const yarnLock =
|
||||||
|
existingYarnLock || (await platform.getFile(packageFile.yarnLock));
|
||||||
await fs.outputFile(upath.join(basedir, 'yarn.lock'), yarnLock);
|
await fs.outputFile(upath.join(basedir, 'yarn.lock'), yarnLock);
|
||||||
} else {
|
} else {
|
||||||
await fs.remove(upath.join(basedir, 'yarn.lock'));
|
await fs.remove(upath.join(basedir, 'yarn.lock'));
|
||||||
|
|
Loading…
Reference in a new issue