mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 06:56:24 +00:00
feat: use versionScheme for changelog
This commit is contained in:
parent
dc6959c939
commit
549b12529f
4 changed files with 19 additions and 11 deletions
|
@ -1,14 +1,15 @@
|
|||
const npmRegistry = require('../../../datasource/npm');
|
||||
const { sortVersions } = require('../../../versioning/semver');
|
||||
const versioning = require('../../../versioning');
|
||||
|
||||
module.exports = {
|
||||
getPackage,
|
||||
};
|
||||
|
||||
async function getPackage({ depName, depType }) {
|
||||
async function getPackage({ versionScheme, depName, depType }) {
|
||||
if (depType === 'engines') {
|
||||
return null;
|
||||
}
|
||||
const { sortVersions } = versioning(versionScheme);
|
||||
const dep = await npmRegistry.getDependency(depName);
|
||||
if (!dep) {
|
||||
return null;
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
const got = require('got');
|
||||
const { sortVersions, isPinnedVersion } = require('../../../versioning/semver');
|
||||
const versioning = require('../../../versioning');
|
||||
|
||||
module.exports = {
|
||||
getPackage,
|
||||
};
|
||||
|
||||
async function getPackage({ depName }) {
|
||||
async function getPackage({ versionScheme, depName }) {
|
||||
try {
|
||||
const { sortVersions, isPinnedVersion } = versioning(versionScheme);
|
||||
logger.debug({ depName }, 'fetching pip package versions');
|
||||
const rep = await got(`https://pypi.org/pypi/${depName}/json`, {
|
||||
json: true,
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
const { matches, isPinnedVersion } = require('../../../versioning/semver');
|
||||
const versioning = require('../../../versioning');
|
||||
const ghGot = require('../../../platform/github/gh-got-wrapper');
|
||||
|
||||
module.exports = {
|
||||
getChangeLogJSON,
|
||||
};
|
||||
|
||||
async function getTags(repository) {
|
||||
async function getTags(versionScheme, repository) {
|
||||
const { isPinnedVersion } = versioning(versionScheme);
|
||||
try {
|
||||
const versions = {};
|
||||
|
||||
|
@ -56,15 +57,18 @@ async function getRepositoryHead(repository, version) {
|
|||
}
|
||||
|
||||
async function getChangeLogJSON({
|
||||
versionScheme,
|
||||
githubBaseURL,
|
||||
repositoryUrl,
|
||||
fromVersion,
|
||||
newVersion,
|
||||
versions,
|
||||
}) {
|
||||
const { equals, isGreaterThan } = versioning(versionScheme);
|
||||
logger.debug('Checking for github source URL manually');
|
||||
const semverString = `>${fromVersion} <=${newVersion}`;
|
||||
logger.trace(`semverString: ${semverString}`);
|
||||
const include = version =>
|
||||
isGreaterThan(version, fromVersion) && !isGreaterThan(version, newVersion);
|
||||
|
||||
if (!(repositoryUrl && repositoryUrl.startsWith(githubBaseURL))) {
|
||||
logger.debug('No repo found manually');
|
||||
return null;
|
||||
|
@ -78,12 +82,13 @@ async function getChangeLogJSON({
|
|||
return null;
|
||||
}
|
||||
|
||||
const tags = await getTags(repository);
|
||||
const tags = await getTags(versionScheme, repository);
|
||||
|
||||
function getHead(version) {
|
||||
const tagName = Object.keys(tags).find(key => equals(key, version.version));
|
||||
return getRepositoryHead(repository, {
|
||||
...version,
|
||||
...tags[version.version],
|
||||
...tags[tagName],
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -93,7 +98,7 @@ async function getChangeLogJSON({
|
|||
for (let i = 1; i < versions.length; i += 1) {
|
||||
const prev = versions[i - 1];
|
||||
const next = versions[i];
|
||||
if (matches(next.version, semverString)) {
|
||||
if (include(next.version)) {
|
||||
const release = {
|
||||
version: next.version,
|
||||
date: next.date,
|
||||
|
|
|
@ -115,6 +115,7 @@ async function ensurePr(prConfig) {
|
|||
|
||||
const logJSON = await changelogHelper.getChangeLogJSON({
|
||||
manager: upgrade.manager,
|
||||
versionScheme: upgrade.versionScheme,
|
||||
depType: upgrade.depType,
|
||||
depName: upgrade.depName,
|
||||
fromVersion: upgrade.fromVersion,
|
||||
|
|
Loading…
Reference in a new issue