Skip to content
Snippets Groups Projects
Commit 80c6ca1e authored by Rhys Arkins's avatar Rhys Arkins
Browse files

fix: don’t discard updateTypes rules before they’re applied

parent 2d4aa131
No related branches found
No related tags found
No related merge requests found
const is = require('@sindresorhus/is');
const {
getManagerConfig,
mergeChildConfig,
......@@ -10,6 +11,11 @@ module.exports = {
flattenUpdates,
};
// Return only rules that contain an updateType
function getUpdateTypeRules(packageRules) {
return packageRules.filter(rule => !is.empty(rule.updateTypes));
}
function flattenUpdates(config, packageFiles) {
const updates = [];
for (const [manager, files] of Object.entries(packageFiles)) {
......@@ -24,8 +30,10 @@ function flattenUpdates(config, packageFiles) {
let updateConfig = mergeChildConfig(depConfig, update);
delete updateConfig.updates;
updateConfig = applyPackageRules(updateConfig);
// Now we're finished with these packageRules
updateConfig.packageRules = [];
// Keep only rules that haven't been applied yet (with updateTypes)
updateConfig.packageRules = getUpdateTypeRules(
updateConfig.packageRules
);
// apply major/minor/patch/pin/digest
updateConfig = mergeChildConfig(
updateConfig,
......
......@@ -14,6 +14,12 @@ describe('workers/repository/updates/flatten', () => {
describe('flattenUpdates()', () => {
it('flattens', async () => {
config.lockFileMaintenance.enabled = true;
config.packageRules = [
{
updateTypes: ['minor'],
automerge: true,
},
];
const packageFiles = {
npm: [
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment