forked from renovatebot/renovate
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(config): rename stabilityDays to minimumReleaseAge (renovatebot#…
…21376) Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
- Loading branch information
Showing
17 changed files
with
194 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
lib/config/migrations/custom/stability-days-migration.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { StabilityDaysMigration } from './stability-days-migration'; | ||
|
||
describe('config/migrations/custom/stability-days-migration', () => { | ||
it('migrates', () => { | ||
expect(StabilityDaysMigration).toMigrate( | ||
{ | ||
stabilityDays: 0, | ||
}, | ||
{ | ||
minimumReleaseAge: null, | ||
} | ||
); | ||
expect(StabilityDaysMigration).toMigrate( | ||
{ | ||
stabilityDays: 2, | ||
}, | ||
{ | ||
minimumReleaseAge: '2 days', | ||
} | ||
); | ||
expect(StabilityDaysMigration).toMigrate( | ||
{ | ||
stabilityDays: 1, | ||
}, | ||
{ | ||
minimumReleaseAge: '1 day', | ||
} | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import is from '@sindresorhus/is'; | ||
import { AbstractMigration } from '../base/abstract-migration'; | ||
|
||
export class StabilityDaysMigration extends AbstractMigration { | ||
override readonly deprecated = true; | ||
override readonly propertyName = 'stabilityDays'; | ||
|
||
override run(value: unknown): void { | ||
if (is.integer(value)) { | ||
let newValue: null | string; | ||
switch (value) { | ||
case 0: | ||
newValue = null; | ||
break; | ||
case 1: | ||
newValue = '1 day'; | ||
break; | ||
default: | ||
newValue = `${value} days`; | ||
break; | ||
} | ||
this.setSafely('minimumReleaseAge', newValue); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.