diff --git a/CHANGELOG.md b/CHANGELOG.md index 07ac322401..99930fd3ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ Please add one entry in this file for each change in Yarn's behavior. Use the sa ## Master +- Run the engines check before showing the UI for `upgrade-interactive` + + [#6535](https://github.com/yarnpkg/yarn/pull/6536) - [**Orta Therox**](https://github.com/orta) + + - Restore Node v4 support by downgrading `cli-table3` [#6535](https://github.com/yarnpkg/yarn/pull/6535) - [**Mark Stacey**](https://github.com/Gudahtt) diff --git a/src/cli/commands/install.js b/src/cli/commands/install.js index c7387470ef..85c8648fb7 100644 --- a/src/cli/commands/install.js +++ b/src/cli/commands/install.js @@ -575,7 +575,7 @@ export class Install { if (!this.flags.ignoreEngines && typeof manifest.engines === 'object') { steps.push(async (curr: number, total: number) => { this.reporter.step(curr, total, this.reporter.lang('checkingManifest'), emoji.get('mag')); - await compatibility.checkOne({_reference: {}, ...manifest}, this.config, this.flags.ignoreEngines); + await this.checkCompatibility(); }); } @@ -743,6 +743,11 @@ export class Install { return flattenedTopLevelPatterns; } + async checkCompatibility(): Promise { + const {manifest} = await this.fetchRequestFromCwd(); + await compatibility.checkOne({_reference: {}, ...manifest}, this.config, this.flags.ignoreEngines); + } + async persistChanges(): Promise { // get all the different registry manifests in this folder const manifests = await this.config.getRootManifests(); diff --git a/src/cli/commands/upgrade-interactive.js b/src/cli/commands/upgrade-interactive.js index 090341f53a..e5e1d77803 100644 --- a/src/cli/commands/upgrade-interactive.js +++ b/src/cli/commands/upgrade-interactive.js @@ -46,6 +46,10 @@ export async function run(config: Config, reporter: Reporter, flags: Object, arg return; } + // Fail early with runtime compatibility checks so that it doesn't fail after you've made your selections + const install = new Install(flags, config, reporter, lockfile); + await install.checkCompatibility(); + const usesWorkspaces = !!config.workspaceRootFolder; const maxLengthArr = {