Skip to content

Commit

Permalink
Checks the engines before running upgrade-interactive
Browse files Browse the repository at this point in the history
  • Loading branch information
orta committed Oct 12, 2018
1 parent e30cf1e commit d4ba20e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,10 @@ 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)
Expand Down
7 changes: 6 additions & 1 deletion src/cli/commands/install.js
Expand Up @@ -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();
});
}

Expand Down Expand Up @@ -743,6 +743,11 @@ export class Install {
return flattenedTopLevelPatterns;
}

async checkCompatibility(): Promise<void> {
const {manifest} = await this.fetchRequestFromCwd();
await compatibility.checkOne({_reference: {}, ...manifest}, this.config, this.flags.ignoreEngines);
}

async persistChanges(): Promise<void> {
// get all the different registry manifests in this folder
const manifests = await this.config.getRootManifests();
Expand Down
4 changes: 4 additions & 0 deletions src/cli/commands/upgrade-interactive.js
Expand Up @@ -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 = {
Expand Down

0 comments on commit d4ba20e

Please sign in to comment.