Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check package engines before running upgrade-interactive #6536

Merged
merged 1 commit into from Oct 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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`

[#6536](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