Skip to content

Commit d72ca49

Browse files
committed
Checks the engines before running upgrade-interactive
1 parent e30cf1e commit d72ca49

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ Please add one entry in this file for each change in Yarn's behavior. Use the sa
44

55
## Master
66

7+
- Run the engines check before showing the UI for `upgrade-interactive`
8+
9+
[#6536](https://github.com/yarnpkg/yarn/pull/6536) - [**Orta Therox**](https://github.com/orta)
10+
711
- Restore Node v4 support by downgrading `cli-table3`
812

913
[#6535](https://github.com/yarnpkg/yarn/pull/6535) - [**Mark Stacey**](https://github.com/Gudahtt)

src/cli/commands/install.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ export class Install {
575575
if (!this.flags.ignoreEngines && typeof manifest.engines === 'object') {
576576
steps.push(async (curr: number, total: number) => {
577577
this.reporter.step(curr, total, this.reporter.lang('checkingManifest'), emoji.get('mag'));
578-
await compatibility.checkOne({_reference: {}, ...manifest}, this.config, this.flags.ignoreEngines);
578+
await this.checkCompatibility();
579579
});
580580
}
581581

@@ -743,6 +743,11 @@ export class Install {
743743
return flattenedTopLevelPatterns;
744744
}
745745

746+
async checkCompatibility(): Promise<void> {
747+
const {manifest} = await this.fetchRequestFromCwd();
748+
await compatibility.checkOne({_reference: {}, ...manifest}, this.config, this.flags.ignoreEngines);
749+
}
750+
746751
async persistChanges(): Promise<void> {
747752
// get all the different registry manifests in this folder
748753
const manifests = await this.config.getRootManifests();

src/cli/commands/upgrade-interactive.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ export async function run(config: Config, reporter: Reporter, flags: Object, arg
4646
return;
4747
}
4848

49+
// Fail early with runtime compatibility checks so that it doesn't fail after you've made your selections
50+
const install = new Install(flags, config, reporter, lockfile);
51+
await install.checkCompatibility();
52+
4953
const usesWorkspaces = !!config.workspaceRootFolder;
5054

5155
const maxLengthArr = {

0 commit comments

Comments
 (0)