Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(datasource): rename dotnet to
dotnet-version
(#20244)
- Loading branch information
1 parent
b48a3d3
commit 93c3fd5
Showing
18 changed files
with
94 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { DatasourceMigration } from './datasource-migration'; | ||
|
||
describe('config/migrations/custom/datasource-migration', () => { | ||
it('should migrate properly', () => { | ||
expect(DatasourceMigration).toMigrate( | ||
{ | ||
datasource: 'dotnet', | ||
}, | ||
{ | ||
datasource: 'dotnet-version', | ||
} | ||
); | ||
}); | ||
}); |
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,14 @@ | ||
import is from '@sindresorhus/is'; | ||
import { AbstractMigration } from '../base/abstract-migration'; | ||
|
||
export class DatasourceMigration extends AbstractMigration { | ||
override readonly propertyName = 'datasource'; | ||
|
||
override run(value: unknown): void { | ||
if (is.string(value)) { | ||
const newValue = value === 'dotnet' ? 'dotnet-version' : value; | ||
|
||
this.rewrite(newValue); | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
lib/config/migrations/custom/match-datasources-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,14 @@ | ||
import { MatchDatasourcesMigration } from './match-datasources-migration'; | ||
|
||
describe('config/migrations/custom/match-datasources-migration', () => { | ||
it('should migrate properly', () => { | ||
expect(MatchDatasourcesMigration).toMigrate( | ||
{ | ||
matchDatasources: ['dotnet'], | ||
}, | ||
{ | ||
matchDatasources: ['dotnet-version'], | ||
} | ||
); | ||
}); | ||
}); |
18 changes: 18 additions & 0 deletions
18
lib/config/migrations/custom/match-datasources-migration.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,18 @@ | ||
import is from '@sindresorhus/is'; | ||
import { AbstractMigration } from '../base/abstract-migration'; | ||
|
||
export class MatchDatasourcesMigration extends AbstractMigration { | ||
override readonly propertyName = 'matchDatasources'; | ||
|
||
override run(value: unknown): void { | ||
if (Array.isArray(value)) { | ||
const newValue = value | ||
.filter(is.nonEmptyString) | ||
.map((datasource) => | ||
datasource === 'dotnet' ? 'dotnet-version' : datasource | ||
); | ||
|
||
this.rewrite(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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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