mirror of
https://github.com/strapi/strapi.git
synced 2025-09-21 22:40:24 +00:00
Merge branch 'features/upgrade-tool' of github.com:strapi/strapi into upgrade-tool/chores
This commit is contained in:
commit
c56802ae6f
@ -32,17 +32,15 @@ addReleaseUpgradeCommand(
|
||||
'Upgrade to the next available major version of Strapi'
|
||||
);
|
||||
|
||||
// TODO: Add back the command when adding the support for minor upgrades
|
||||
// addReleaseUpgradeCommand(
|
||||
// Version.ReleaseType.Minor,
|
||||
// 'Upgrade to the latest minor/patch version of Strapi for the current major'
|
||||
// );
|
||||
addReleaseUpgradeCommand(
|
||||
Version.ReleaseType.Minor,
|
||||
'Upgrade to the latest minor and patch version of Strapi for the current major'
|
||||
);
|
||||
|
||||
// TODO: Add back the command when adding the support for patch upgrades
|
||||
// addReleaseUpgradeCommand(
|
||||
// Version.ReleaseType.Patch,
|
||||
// 'Upgrade to latest patch version of Strapi for the current major and minor'
|
||||
// );
|
||||
addReleaseUpgradeCommand(
|
||||
Version.ReleaseType.Patch,
|
||||
'Upgrade to latest patch version of Strapi for the current major and minor'
|
||||
);
|
||||
|
||||
program
|
||||
.usage('<command> [options]')
|
||||
|
@ -8,16 +8,24 @@ export const rangeFactory = (range: string): Version.Range => {
|
||||
};
|
||||
|
||||
export const rangeFromReleaseType = (current: Version.SemVer, identifier: Version.ReleaseType) => {
|
||||
const fromCurrentTo = (version: Version.LiteralVersion) => {
|
||||
return rangeFactory(`>${current.raw} <=${version}`);
|
||||
};
|
||||
|
||||
switch (identifier) {
|
||||
case Version.ReleaseType.Major: {
|
||||
// semver.inc(_, 'major') will target <major + 1>.0.0 which is what we want
|
||||
// e.g. for 4.15.4, it'll return 5.0.0
|
||||
const nextMajor = semver.inc(current, 'major') as Version.LiteralSemVer;
|
||||
return fromCurrentTo(nextMajor);
|
||||
return rangeFactory(`>${current.raw} <=${nextMajor}`);
|
||||
}
|
||||
case Version.ReleaseType.Patch: {
|
||||
// This will return the minor for the next minor
|
||||
// e.g. for 4.15.4, it'll return 4.16.0
|
||||
const minor = semver.inc(current, 'minor') as Version.LiteralSemVer;
|
||||
return rangeFactory(`>${current.raw} <${minor}`);
|
||||
}
|
||||
case Version.ReleaseType.Minor: {
|
||||
// This will return the major for the next major
|
||||
// e.g. for 4.15.4, it'll return 5.0.0
|
||||
const major = semver.inc(current, 'major') as Version.LiteralSemVer;
|
||||
return rangeFactory(`>${current.raw} <${major}`);
|
||||
}
|
||||
default: {
|
||||
throw new Error('Not implemented');
|
||||
|
Loading…
x
Reference in New Issue
Block a user