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

CB-12088 Fix misleading warning when adding platform without Api.js #506

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions cordova-lib/src/platforms/platforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,14 @@ function getPlatformApi(platform, platformRootDir) {
PlatformApi = require(platformApiModule);
} catch (err) {
// Check if platform already compatible w/ PlatformApi and show deprecation warning
if (err && err.code === 'MODULE_NOT_FOUND' && platforms[platform].apiCompatibleSince) {
events.emit('warn', ' Using this version of Cordova with older version of cordova-' + platform +
' is being deprecated. Consider upgrading to cordova-' + platform + '@' +
platforms[platform].apiCompatibleSince + ' or newer.');
if (err && err.code === 'MODULE_NOT_FOUND') {
if (platforms[platform].apiCompatibleSince) {
events.emit('warn', ' Using this version of Cordova with older version of cordova-' + platform +
' is being deprecated. Consider upgrading to cordova-' + platform + '@' +
platforms[platform].apiCompatibleSince + ' or newer.');
}
// else nothing - there is no Api.js and no deprecation information hence
// the platform just does not expose Api and we will use polyfill as usual
} else {
events.emit('warn', 'Error loading cordova-'+platform);
}
Expand Down