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