Use programmatic API from Electron-Builder.
It seems that the package-json based configuration is deprecated. See https://github.com/electron-userland/electron-builder/issues/3751
This commit is contained in:
parent
ef112cef3a
commit
b54b206b9a
72
build.js
Normal file
72
build.js
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
const builder = require('electron-builder')
|
||||||
|
const Platform = builder.Platform
|
||||||
|
|
||||||
|
function getCurrentPlatform(){
|
||||||
|
switch(process.platform){
|
||||||
|
case 'win32':
|
||||||
|
return Platform.WINDOWS
|
||||||
|
case 'darwin':
|
||||||
|
return Platform.MAC
|
||||||
|
case 'linux':
|
||||||
|
return Platform.linux
|
||||||
|
default:
|
||||||
|
console.error('Cannot resolve current platform!')
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
builder.build({
|
||||||
|
targets: (process.argv[2] != null && Platform[process.argv[2]] != null ? Platform[process.argv[2]] : getCurrentPlatform()).createTarget(),
|
||||||
|
config: {
|
||||||
|
appId: 'electronlauncher',
|
||||||
|
productName: 'Electron Launcher',
|
||||||
|
artifactName: '${productName}.${ext}',
|
||||||
|
copyright: 'Copyright © 2018-2019 Daniel Scalzi',
|
||||||
|
directories: {
|
||||||
|
buildResources: 'build',
|
||||||
|
output: 'dist'
|
||||||
|
},
|
||||||
|
win: {
|
||||||
|
target: [
|
||||||
|
{
|
||||||
|
target: 'nsis',
|
||||||
|
arch: 'x64'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
icon: 'build/icon.ico'
|
||||||
|
},
|
||||||
|
nsis: {
|
||||||
|
oneClick: false,
|
||||||
|
perMachine: true,
|
||||||
|
allowElevation: true,
|
||||||
|
installerIcon: 'build/icon.ico',
|
||||||
|
uninstallerIcon: 'build/icon.ico',
|
||||||
|
allowToChangeInstallationDirectory: true
|
||||||
|
},
|
||||||
|
mac: {
|
||||||
|
target: 'dmg',
|
||||||
|
category: 'public.app-category.games',
|
||||||
|
icon: 'build/icon.icns'
|
||||||
|
},
|
||||||
|
linux: {
|
||||||
|
target: 'AppImage',
|
||||||
|
maintainer: 'Daniel Scalzi',
|
||||||
|
vendor: 'Daniel Scalzi',
|
||||||
|
synopsis: 'Modded Minecraft Launcher',
|
||||||
|
description: 'Custom launcher which allows users to join modded servers. All mods, configurations, and updates are handled automatically.',
|
||||||
|
category: 'Game'
|
||||||
|
},
|
||||||
|
compression: 'maximum',
|
||||||
|
files: [
|
||||||
|
'!{dist,.gitignore,.vscode,docs,dev-app-update.yml,.travis.yml,.nvmrc,.eslintrc.json,build.js}'
|
||||||
|
],
|
||||||
|
extraResources: [
|
||||||
|
'libraries'
|
||||||
|
],
|
||||||
|
asar: true
|
||||||
|
}
|
||||||
|
}).then(() => {
|
||||||
|
console.log('Build complete!')
|
||||||
|
}).catch(err => {
|
||||||
|
console.error('Error during build!', err)
|
||||||
|
})
|
65
package.json
65
package.json
@ -13,12 +13,12 @@
|
|||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "electron .",
|
"start": "electron .",
|
||||||
"cilinux": "electron-builder --linux --win",
|
"cilinux": "node build.js WINDOWS && node build.js LINUX",
|
||||||
"cidarwin": "electron-builder --mac",
|
"cidarwin": "node build.js MAC",
|
||||||
"dist": "cross-env ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES=true electron-builder",
|
"dist": "cross-env ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES=true node build.js",
|
||||||
"dist:win": "npm run dist -- --win --x64",
|
"dist:win": "npm run dist -- WINDOWS",
|
||||||
"dist:mac": "npm run dist -- --mac",
|
"dist:mac": "npm run dist -- MAC",
|
||||||
"dist:linux": "npm run dist -- --linux --x64",
|
"dist:linux": "npm run dist -- LINUX",
|
||||||
"lint": "eslint --config .eslintrc.json ."
|
"lint": "eslint --config .eslintrc.json ."
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
@ -48,58 +48,5 @@
|
|||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/dscalzi/ElectronLauncher.git"
|
"url": "git+https://github.com/dscalzi/ElectronLauncher.git"
|
||||||
},
|
|
||||||
"build": {
|
|
||||||
"appId": "electronlauncher",
|
|
||||||
"productName": "Electron Launcher",
|
|
||||||
"artifactName": "${productName}.${ext}",
|
|
||||||
"copyright": "Copyright © 2018-2019 Daniel Scalzi",
|
|
||||||
"directories": {
|
|
||||||
"buildResources": "build",
|
|
||||||
"output": "dist"
|
|
||||||
},
|
|
||||||
"win": {
|
|
||||||
"target": [
|
|
||||||
{
|
|
||||||
"target": "nsis",
|
|
||||||
"arch": "x64"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"icon": "build/icon.ico"
|
|
||||||
},
|
|
||||||
"nsis": {
|
|
||||||
"oneClick": false,
|
|
||||||
"perMachine": true,
|
|
||||||
"allowElevation": true,
|
|
||||||
"installerIcon": "build/icon.ico",
|
|
||||||
"uninstallerIcon": "build/icon.ico",
|
|
||||||
"allowToChangeInstallationDirectory": true
|
|
||||||
},
|
|
||||||
"mac": {
|
|
||||||
"target": "dmg",
|
|
||||||
"category": "public.app-category.games",
|
|
||||||
"icon": "build/icon.icns"
|
|
||||||
},
|
|
||||||
"linux": {
|
|
||||||
"target": "AppImage",
|
|
||||||
"maintainer": "Daniel Scalzi",
|
|
||||||
"vendor": "Daniel Scalzi",
|
|
||||||
"synopsis": "Modded Minecraft Launcher",
|
|
||||||
"description": "Custom launcher which allows users to join modded servers. All mods, configurations, and updates are handled automatically.",
|
|
||||||
"category": "Game"
|
|
||||||
},
|
|
||||||
"deb": {
|
|
||||||
"compression": "xz",
|
|
||||||
"packageCategory": "Games",
|
|
||||||
"priority": "optional"
|
|
||||||
},
|
|
||||||
"compression": "maximum",
|
|
||||||
"files": [
|
|
||||||
"!{dist,.gitignore,.vscode,docs,dev-app-update.yml,.travis.yml,.nvmrc,.eslintrc.json}"
|
|
||||||
],
|
|
||||||
"extraResources": [
|
|
||||||
"libraries"
|
|
||||||
],
|
|
||||||
"asar": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user