feat(nuget): add support for centralized PackageVersion (#7622)
This commit is contained in:
Родитель
c2ebd71732
Коммит
cdaf3e9097
|
@ -20,7 +20,7 @@ To convert your .NET Framework `.csproj`/`.fsproj`/`.vbproj` into an SDK-style p
|
|||
## How It Works
|
||||
|
||||
1. Renovate will search each repository for any files with a `.csproj`, `.fsproj`, or `.vbproj` extension.
|
||||
2. Existing dependencies will be extracted from `<PackageReference>` tags
|
||||
2. Existing dependencies will be extracted from `<PackageReference>` and `<PackageVersion>` tags
|
||||
3. Renovate will look up the latest version on [nuget.org](https://nuget.org) (or on [alternate feeds](#Alternate%20feeds)) to determine if any upgrades are available
|
||||
4. If the source package includes a GitHub URL as its source, and has either a "changelog" file or uses GitHub releases, then Release Notes for each version will be embedded in the generated PR.
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<Project>
|
||||
<ItemGroup>
|
||||
<PackageVersion Include="Autofac" Version="4.5.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -183,6 +183,17 @@ Array [
|
|||
]
|
||||
`;
|
||||
|
||||
exports[`lib/manager/nuget/extract extractPackageFile() extracts package version dependency 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
"currentValue": "4.5.0",
|
||||
"datasource": "nuget",
|
||||
"depName": "Autofac",
|
||||
"depType": "nuget",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`lib/manager/nuget/extract extractPackageFile() extracts registry URLs independently 1`] = `
|
||||
Object {
|
||||
"deps": Array [
|
||||
|
|
|
@ -16,6 +16,16 @@ describe('lib/manager/nuget/extract', () => {
|
|||
await extractPackageFile('nothing here', 'bogus', config)
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
it('extracts package version dependency', async () => {
|
||||
const packageFile =
|
||||
'with-centralized-package-versions/Directory.Packages.props';
|
||||
const sample = readFileSync(
|
||||
path.join(config.localDir, packageFile),
|
||||
'utf8'
|
||||
);
|
||||
const res = await extractPackageFile(sample, packageFile, config);
|
||||
expect(res.deps).toMatchSnapshot();
|
||||
});
|
||||
it('extracts all dependencies', async () => {
|
||||
const packageFile = 'sample.csproj';
|
||||
const sample = readFileSync(
|
||||
|
|
|
@ -27,6 +27,7 @@ function extractDepsFromXml(xmlNode: XmlDocument): PackageDependency[] {
|
|||
for (const itemGroup of itemGroups) {
|
||||
const relevantChildren = [
|
||||
...itemGroup.childrenNamed('PackageReference'),
|
||||
...itemGroup.childrenNamed('PackageVersion'),
|
||||
...itemGroup.childrenNamed('DotNetCliToolReference'),
|
||||
...itemGroup.childrenNamed('GlobalPackageReference'),
|
||||
];
|
||||
|
|
Загрузка…
Ссылка в новой задаче