Rename hak target to runtime version

The hak environment's `target` is more like a runtime version, so this renames
to call it that, especially since we're about to add more traditional target
strings. `npm_config_target` remains, since that's what `npm` expects.
This commit is contained in:
J. Ryan Stinnett 2021-06-18 16:40:00 +01:00
parent c1ca909c7c
commit 115f25165a

View File

@ -33,7 +33,7 @@ function getRuntime(packageJson) {
return electronVersion ? 'electron' : 'node-webkit'; return electronVersion ? 'electron' : 'node-webkit';
} }
function getTarget(packageJson) { function getRuntimeVersion(packageJson) {
const electronVersion = getElectronVersion(packageJson); const electronVersion = getElectronVersion(packageJson);
if (electronVersion) { if (electronVersion) {
return electronVersion; return electronVersion;
@ -63,7 +63,7 @@ module.exports = class HakEnv {
Object.assign(this, { Object.assign(this, {
// what we're targeting // what we're targeting
runtime: getRuntime(packageJson), runtime: getRuntime(packageJson),
target: getTarget(packageJson), runtimeVersion: getRuntimeVersion(packageJson),
platform: process.platform, platform: process.platform,
arch: detectArch(), arch: detectArch(),
@ -76,7 +76,7 @@ module.exports = class HakEnv {
getRuntimeAbi() { getRuntimeAbi() {
return nodePreGypVersioning.get_runtime_abi( return nodePreGypVersioning.get_runtime_abi(
this.runtime, this.runtime,
this.target, this.runtimeVersion,
); );
} }
@ -99,11 +99,11 @@ module.exports = class HakEnv {
makeGypEnv() { makeGypEnv() {
return Object.assign({}, process.env, { return Object.assign({}, process.env, {
npm_config_target: this.target,
npm_config_arch: this.arch, npm_config_arch: this.arch,
npm_config_target_arch: this.arch, npm_config_target_arch: this.arch,
npm_config_disturl: 'https://atom.io/download/electron', npm_config_disturl: 'https://atom.io/download/electron',
npm_config_runtime: this.runtime, npm_config_runtime: this.runtime,
npm_config_target: this.runtimeVersion,
npm_config_build_from_source: true, npm_config_build_from_source: true,
npm_config_devdir: path.join(os.homedir(), ".electron-gyp"), npm_config_devdir: path.join(os.homedir(), ".electron-gyp"),
}); });