mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-11 21:59:05 +00:00
feat(manager/poetry): add support for bumpVersion
option (#26377)
This commit is contained in:
parent
dc614d0b3a
commit
d2536a7cc2
5 changed files with 21 additions and 2 deletions
docs/usage
lib/modules/manager/poetry
|
@ -411,6 +411,7 @@ This is an advance field and it's recommend you seek a config review before appl
|
|||
## bumpVersion
|
||||
|
||||
Currently this setting supports `helmv3`, `npm`, `nuget`, `maven`, `pep621` and `sbt` only, so raise a feature request if you have a use for it with other package managers.
|
||||
Currently this setting supports `helmv3`, `npm`, `nuget`, `maven`, `pep621`, `poetry` and `sbt` only, so raise a feature request if you have a use for it with other package managers.
|
||||
Its purpose is if you want Renovate to update the `version` field within your package file any time it updates dependencies within.
|
||||
Usually this is for automatic release purposes, so that you don't need to add another step after Renovate before you can release a new version.
|
||||
|
||||
|
|
|
@ -345,6 +345,7 @@ exports[`modules/manager/poetry/extract extractPackageFile() extracts mixed vers
|
|||
},
|
||||
],
|
||||
"extractedConstraints": {},
|
||||
"packageFileVersion": "0.1.0",
|
||||
}
|
||||
`;
|
||||
|
||||
|
@ -427,6 +428,7 @@ exports[`modules/manager/poetry/extract extractPackageFile() extracts multiple d
|
|||
},
|
||||
],
|
||||
"extractedConstraints": {},
|
||||
"packageFileVersion": "0.1.0",
|
||||
}
|
||||
`;
|
||||
|
||||
|
@ -555,6 +557,7 @@ exports[`modules/manager/poetry/extract extractPackageFile() handles multiple co
|
|||
},
|
||||
],
|
||||
"extractedConstraints": {},
|
||||
"packageFileVersion": "0.1.0",
|
||||
}
|
||||
`;
|
||||
|
||||
|
@ -589,5 +592,6 @@ exports[`modules/manager/poetry/extract extractPackageFile() resolves lockedVers
|
|||
"extractedConstraints": {
|
||||
"python": "^3.9",
|
||||
},
|
||||
"packageFileVersion": undefined,
|
||||
}
|
||||
`;
|
||||
|
|
|
@ -3,6 +3,7 @@ import { GithubReleasesDatasource } from '../../datasource/github-releases';
|
|||
import { GithubTagsDatasource } from '../../datasource/github-tags';
|
||||
import { PypiDatasource } from '../../datasource/pypi';
|
||||
|
||||
export { bumpPackageVersion } from '../pep621/update';
|
||||
export { extractPackageFile } from './extract';
|
||||
export { updateArtifacts } from './artifacts';
|
||||
export { updateLockedDependency } from './update-locked';
|
||||
|
|
|
@ -1,6 +1,17 @@
|
|||
import { PoetrySources } from './schema';
|
||||
import { PoetrySectionSchema, PoetrySources } from './schema';
|
||||
|
||||
describe('modules/manager/poetry/schema', () => {
|
||||
it('parses project version', () => {
|
||||
expect(
|
||||
PoetrySectionSchema.parse({ version: '1.2.3' }).packageFileVersion,
|
||||
).toBe('1.2.3');
|
||||
|
||||
expect(
|
||||
PoetrySectionSchema.parse({ version: { some: 'value' } })
|
||||
.packageFileVersion,
|
||||
).toBeUndefined();
|
||||
});
|
||||
|
||||
describe('PoetrySources', () => {
|
||||
it('parses default values', () => {
|
||||
expect(PoetrySources.parse([])).toBeEmptyArray();
|
||||
|
|
|
@ -245,6 +245,7 @@ export const PoetrySources = LooseArray(PoetrySource, {
|
|||
|
||||
export const PoetrySectionSchema = z
|
||||
.object({
|
||||
version: z.string().optional().catch(undefined),
|
||||
dependencies: withDepType(PoetryDependencies, 'dependencies').optional(),
|
||||
'dev-dependencies': withDepType(
|
||||
PoetryDependencies,
|
||||
|
@ -256,6 +257,7 @@ export const PoetrySectionSchema = z
|
|||
})
|
||||
.transform(
|
||||
({
|
||||
version,
|
||||
dependencies = [],
|
||||
'dev-dependencies': devDependencies = [],
|
||||
extras: extraDependencies = [],
|
||||
|
@ -269,7 +271,7 @@ export const PoetrySectionSchema = z
|
|||
...groupDependencies,
|
||||
];
|
||||
|
||||
const res: PackageFileContent = { deps };
|
||||
const res: PackageFileContent = { deps, packageFileVersion: version };
|
||||
|
||||
if (sourceUrls.length) {
|
||||
for (const dep of res.deps) {
|
||||
|
|
Loading…
Reference in a new issue