-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: platform & plugin prelease package support
- Loading branch information
Showing
3 changed files
with
21 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,22 +99,12 @@ function possiblyFetch (id, plugins_dir, options) { | |
|
||
function checkEngines (engines) { | ||
for (let i = 0; i < engines.length; i++) { | ||
const engine = engines[i]; | ||
|
||
// This is a hack to allow plugins with <engine> tag to be installed with | ||
// engine with '-dev' or '-nightly' suffixes. It is required due to new semver range logic, | ||
// introduced in [email protected]. For more details see https://github.com/npm/node-semver#prerelease-tags. | ||
// | ||
// This may lead to false-positive checks, when engine version with dropped | ||
// suffix is equal to one of range bounds, for example: 5.1.0-dev >= 5.1.0. | ||
// However this shouldn't be a problem, because this only should happen in dev workflow. | ||
engine.currentVersion = engine.currentVersion && engine.currentVersion.replace(/-dev|-nightly.*$/, ''); | ||
if (semver.satisfies(engine.currentVersion, engine.minVersion, /* loose= */true) || engine.currentVersion === null) { | ||
const { currentVersion, minVersion, name } = engines[i]; | ||
|
||
if (semver.satisfies(currentVersion, minVersion, { loose: true, includePrerelease: true }) || currentVersion === null) { | ||
continue; // engine ok! | ||
} else { | ||
const msg = 'Plugin doesn\'t support this project\'s ' + engine.name + ' version. ' + | ||
engine.name + ': ' + engine.currentVersion + | ||
', failed version requirement: ' + engine.minVersion; | ||
const msg = `Plugin doesn't support this project's ${name} version. ${name}: ${currentVersion}, failed version requirement: ${minVersion}`; | ||
events.emit('warn', msg); | ||
return Promise.reject(Object.assign(new Error(), { skip: true })); | ||
} | ||
|