Convert the electron-builder scripts to ESM (#7471)
This commit is contained in:
parent
c58a0152d1
commit
4f5b932e8f
@ -1,14 +1,11 @@
|
|||||||
const os = require('os')
|
import { Arch, build, Platform } from 'electron-builder'
|
||||||
const builder = require('electron-builder')
|
import config from './ebuilder.config.mjs'
|
||||||
const config = require('./ebuilder.config.js')
|
|
||||||
|
|
||||||
const Platform = builder.Platform
|
|
||||||
const Arch = builder.Arch
|
|
||||||
const args = process.argv
|
const args = process.argv
|
||||||
|
|
||||||
/** @type {Map<import('electron-builder').Platform, Map<import('electron-builder').Arch, Array<string>>>} */
|
/** @type {Map<import('electron-builder').Platform, Map<import('electron-builder').Arch, Array<string>>>} */
|
||||||
let targets
|
let targets
|
||||||
const platform = os.platform()
|
const platform = process.platform
|
||||||
|
|
||||||
if (platform === 'darwin') {
|
if (platform === 'darwin') {
|
||||||
let arch = Arch.x64
|
let arch = Arch.x64
|
||||||
@ -40,15 +37,9 @@ if (platform === 'darwin') {
|
|||||||
targets = Platform.LINUX.createTarget(['deb', 'zip', '7z', 'rpm', 'AppImage', 'pacman'], arch)
|
targets = Platform.LINUX.createTarget(['deb', 'zip', '7z', 'rpm', 'AppImage', 'pacman'], arch)
|
||||||
}
|
}
|
||||||
|
|
||||||
builder
|
try {
|
||||||
.build({
|
const output = await build({ targets, config, publish: 'never' })
|
||||||
targets,
|
console.log(output)
|
||||||
config,
|
} catch (error) {
|
||||||
publish: 'never'
|
console.error(error)
|
||||||
})
|
}
|
||||||
.then(m => {
|
|
||||||
console.log(m)
|
|
||||||
})
|
|
||||||
.catch(e => {
|
|
||||||
console.error(e)
|
|
||||||
})
|
|
@ -1,12 +1,12 @@
|
|||||||
const { name, productName } = require('../package.json')
|
import packageDetails from '../package.json' with { type: 'json' }
|
||||||
|
|
||||||
/** @type {import('electron-builder').Configuration} */
|
/** @type {import('electron-builder').Configuration} */
|
||||||
const config = {
|
export default {
|
||||||
appId: `io.freetubeapp.${name}`,
|
appId: `io.freetubeapp.${packageDetails.name}`,
|
||||||
copyright: 'Copyleft © 2020-2025 freetubeapp@protonmail.com',
|
copyright: 'Copyleft © 2020-2025 freetubeapp@protonmail.com',
|
||||||
// asar: false,
|
// asar: false,
|
||||||
// compression: 'store',
|
// compression: 'store',
|
||||||
productName,
|
productName: packageDetails.productName,
|
||||||
directories: {
|
directories: {
|
||||||
output: './build/',
|
output: './build/',
|
||||||
},
|
},
|
||||||
@ -96,5 +96,3 @@ const config = {
|
|||||||
oneClick: false,
|
oneClick: false,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = config
|
|
@ -22,9 +22,9 @@
|
|||||||
"build": "run-s patch-shaka pack build-release",
|
"build": "run-s patch-shaka pack build-release",
|
||||||
"build:arm64": "run-s patch-shaka pack build-release:arm64",
|
"build:arm64": "run-s patch-shaka pack build-release:arm64",
|
||||||
"build:arm32": "run-s patch-shaka pack build-release:arm32",
|
"build:arm32": "run-s patch-shaka pack build-release:arm32",
|
||||||
"build-release": "node _scripts/build.js",
|
"build-release": "node _scripts/build.mjs",
|
||||||
"build-release:arm64": "node _scripts/build.js arm64",
|
"build-release:arm64": "node _scripts/build.mjs arm64",
|
||||||
"build-release:arm32": "node _scripts/build.js arm32",
|
"build-release:arm32": "node _scripts/build.mjs arm32",
|
||||||
"clean": "node _scripts/clean.mjs",
|
"clean": "node _scripts/clean.mjs",
|
||||||
"debug": "run-s patch-shaka debug-runner",
|
"debug": "run-s patch-shaka debug-runner",
|
||||||
"debug-runner": "node _scripts/dev-runner.js --remote-debug",
|
"debug-runner": "node _scripts/dev-runner.js --remote-debug",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user