mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-23 11:16:42 +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() {
|
||||
/** @type {string} */
|
||||
const electronVersion =
|
||||
const rawElectronVersion =
|
||||
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 version = await getVersion();
|
||||
/** @type {string|unknown} */
|
||||
@ -18,7 +24,7 @@ async function run() {
|
||||
'--publish',
|
||||
'never',
|
||||
'-c.electronVersion',
|
||||
semver.clean(electronVersion.replace(/^\^/, '')),
|
||||
electronVersion,
|
||||
'-c.extraMetadata.version',
|
||||
version,
|
||||
// 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