From 1cfdb2888623673979c7eef1d2407ac3cf374a70 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Wed, 19 Jun 2019 12:02:03 -0700 Subject: [PATCH] lib: reintroduce support for iojs file naming for releases >= 1 && < 4 For Electron 3 PR-URL: https://github.com/nodejs/node-gyp/pull/1777 Reviewed-By: Richard Lau Reviewed-By: Rod Vagg --- lib/process-release.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/process-release.js b/lib/process-release.js index 8b3fda81c6..f0c640b2d7 100644 --- a/lib/process-release.js +++ b/lib/process-release.js @@ -17,6 +17,7 @@ function processRelease (argv, gyp, defaultVersion, defaultRelease) { , versionSemver = semver.parse(version) , overrideDistUrl = gyp.opts['dist-url'] || gyp.opts.disturl , isDefaultVersion + , isNamedForLegacyIojs , name , distBaseUrl , baseUrl @@ -41,11 +42,17 @@ function processRelease (argv, gyp, defaultVersion, defaultRelease) { if (defaultRelease) { // v3 onward, has process.release - name = defaultRelease.name + name = defaultRelease.name.replace(/io\.js/, 'iojs') // remove the '.' for directory naming purposes } else { // old node or alternative --target= // semver.satisfies() doesn't like prerelease tags so test major directly - name = 'node' + isNamedForLegacyIojs = versionSemver.major >= 1 && versionSemver.major < 4 + // isNamedForLegacyIojs is required to support Electron < 4 (in particular Electron 3) + // as previously this logic was used to ensure "iojs" was used to download iojs releases + // and "node" for node releases. Unfortunately the logic was broad enough that electron@3 + // published release assets as "iojs" so that the node-gyp logic worked. Once Electron@3 has + // been EOL for a while (late 2019) we should remove this hack. + name = isNamedForLegacyIojs ? 'iojs' : 'node' } // check for the nvm.sh standard mirror env variables