Skip to content

Commit

Permalink
fix(cli): Warn if core version doesn't match platform version (#2736)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored Apr 10, 2020
1 parent 3baf81b commit 29a9acf
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions cli/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -405,13 +405,12 @@ export async function getPlatformVersion(config: Config, platform: string): Prom
}

export async function checkPlatformVersions(config: Config, platform: string) {
const cliVersion = await getCLIVersion(config);
const coreVersion = await getCoreVersion(config);
const platformVersion = await getPlatformVersion(config, platform);

if (semver.gt(cliVersion, platformVersion)) {
if (semver.diff(coreVersion, platformVersion) === 'minor' || semver.diff(coreVersion, platformVersion) === 'major') {
log('\n');
logInfo(`Your @capacitor/cli version is greater than @capacitor/${platform} version`);
log(`Consider updating to matching version ${chalk`{bold npm install @capacitor/${platform}@${cliVersion}}`}`);
logWarn(`Your @capacitor/core version doesn't match your @capacitor/${platform} version`);
log(`Consider updating to matching version ${chalk`{bold npm install @capacitor/core@${platformVersion}}`}`);
}
}

Expand Down

0 comments on commit 29a9acf

Please sign in to comment.