mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-25 20:26:38 +00:00
fix: safer electron version parsing for electron-builder command (#2673)
This commit is contained in:
parent
9b15695c60
commit
4b0982ccb3
@ -6,8 +6,14 @@ const { isNightly, isRelease } = require('./utils');
|
|||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
/** @type {string} */
|
/** @type {string} */
|
||||||
const electronVersion =
|
const rawElectronVersion =
|
||||||
require('../package.json').devDependencies['electron'];
|
require('../package.json').devDependencies['electron'];
|
||||||
|
const electronVersion = semver.clean(rawElectronVersion.replace(/^\^/, ''));
|
||||||
|
if (!electronVersion) {
|
||||||
|
throw new Error(
|
||||||
|
`Electron semver validation failed for version: '${rawElectronVersion}'.`
|
||||||
|
);
|
||||||
|
}
|
||||||
const platform = electronPlatform();
|
const platform = electronPlatform();
|
||||||
const version = await getVersion();
|
const version = await getVersion();
|
||||||
/** @type {string|unknown} */
|
/** @type {string|unknown} */
|
||||||
@ -18,7 +24,7 @@ async function run() {
|
|||||||
'--publish',
|
'--publish',
|
||||||
'never',
|
'never',
|
||||||
'-c.electronVersion',
|
'-c.electronVersion',
|
||||||
semver.clean(electronVersion.replace(/^\^/, '')),
|
electronVersion,
|
||||||
'-c.extraMetadata.version',
|
'-c.extraMetadata.version',
|
||||||
version,
|
version,
|
||||||
// overrides the `name` in the `package.json` to keep the `localStorage` location. (https://github.com/arduino/arduino-ide/pull/2144#pullrequestreview-1554005028)
|
// overrides the `name` in the `package.json` to keep the `localStorage` location. (https://github.com/arduino/arduino-ide/pull/2144#pullrequestreview-1554005028)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user