Skip to content

Commit

Permalink
fix(backup): Don't show warnng on current major
Browse files Browse the repository at this point in the history
refs: TryGhost/Toolbox#334
refs: #468

- Only show the warning about upgrading if there's a major upgrade to do
  • Loading branch information
ErisDS committed May 19, 2022
1 parent c9b2500 commit fbc7fdd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/commands/backup.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ class BackupCommand extends Command {
}

// Get the latest version in our current major
const {latestMajor} = await loadVersions();
const {latestMajor, latest} = await loadVersions();
const activeMajor = semver.major(instance.version);
const latestMinor = latestMajor[`v${activeMajor}`];

if (instance.version !== latestMinor && !argv.force) {
const isBehindByMajor = semver.diff(instance.version, latest) === 'major';

if (instance.version !== latestMinor && isBehindByMajor && !argv.force) {
const currentMajor = semver.major(instance.version);

throw new CliError({
Expand Down

0 comments on commit fbc7fdd

Please sign in to comment.