Updates
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
/**
|
||||
* Canonical PearData binary host list (64-bit only — no ia32 / armv7).
|
||||
* Used by make scripts, predownload-electron, and release tooling.
|
||||
*/
|
||||
'use strict'
|
||||
|
||||
/** @type {readonly string[]} */
|
||||
const SERVER_LINUX = Object.freeze(['linux-x64', 'linux-arm64'])
|
||||
|
||||
/** @type {readonly string[]} */
|
||||
const ALL_64 = Object.freeze([
|
||||
'linux-x64',
|
||||
'linux-arm64',
|
||||
'darwin-x64',
|
||||
'darwin-arm64',
|
||||
'win32-x64',
|
||||
'win32-arm64',
|
||||
])
|
||||
|
||||
/**
|
||||
* @param {string|undefined} envVal comma-separated override
|
||||
* @param {readonly string[]} fallback
|
||||
*/
|
||||
function parseHostList(envVal, fallback = ALL_64) {
|
||||
if (!envVal || !String(envVal).trim()) return [...fallback]
|
||||
return String(envVal)
|
||||
.split(',')
|
||||
.map((s) => s.trim())
|
||||
.filter(Boolean)
|
||||
}
|
||||
|
||||
/**
|
||||
* electron-forge platform/arch for a host triple
|
||||
* @param {string} host
|
||||
* @returns {{ platform: string, arch: string }}
|
||||
*/
|
||||
function hostToElectron(host) {
|
||||
const [platform, arch] = host.split('-')
|
||||
if (!platform || !arch) throw new Error(`Invalid host: ${host}`)
|
||||
return { platform, arch }
|
||||
}
|
||||
|
||||
/**
|
||||
* npm script name for client package, or null
|
||||
* @param {string} host
|
||||
*/
|
||||
function clientNpmScript(host) {
|
||||
const map = {
|
||||
'linux-x64': 'make:client:linux-x64',
|
||||
'linux-arm64': 'make:client:linux-arm64',
|
||||
'darwin-arm64': 'make:client:darwin-arm64',
|
||||
'darwin-x64': 'make:client:darwin-x64',
|
||||
'win32-x64': 'make:client:win32-x64',
|
||||
'win32-arm64': 'make:client:win32-arm64',
|
||||
}
|
||||
return map[host] || null
|
||||
}
|
||||
|
||||
/**
|
||||
* npm script name for server package, or null
|
||||
* @param {string} host
|
||||
*/
|
||||
function serverNpmScript(host) {
|
||||
// Server is Linux-only
|
||||
const map = {
|
||||
'linux-x64': 'make:server:linux-x64',
|
||||
'linux-arm64': 'make:server:linux-arm64',
|
||||
}
|
||||
return map[host] || null
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
SERVER_LINUX,
|
||||
ALL_64,
|
||||
CLIENT_HOSTS: ALL_64,
|
||||
parseHostList,
|
||||
hostToElectron,
|
||||
clientNpmScript,
|
||||
serverNpmScript,
|
||||
}
|
||||
Reference in New Issue
Block a user