FreeTube/_scripts/build.js

87 lines
1.7 KiB
JavaScript
Raw Normal View History

2020-02-16 19:30:00 +01:00
const os = require('os')
const builder = require('electron-builder')
const Platform = builder.Platform
2020-07-21 23:43:52 +02:00
const Arch = builder.Arch
2020-02-16 19:30:00 +01:00
const { name, productName } = require('../package.json')
2020-07-21 23:43:52 +02:00
const args = process.argv
2020-02-16 19:30:00 +01:00
let targets
var platform = os.platform()
if (platform == 'darwin') {
targets = Platform.MAC.createTarget()
} else if (platform == 'win32') {
targets = Platform.WINDOWS.createTarget()
} else if (platform == 'linux') {
2020-07-21 23:43:52 +02:00
let arch = Arch.x64
2020-07-22 00:11:51 +02:00
if (args[2] === 'arm') {
2020-07-21 23:43:52 +02:00
arch = Arch.arm64
}
targets = Platform.LINUX.createTarget(['deb', 'zip', 'apk', 'rpm', 'AppImage'], arch)
2020-02-16 19:30:00 +01:00
}
const config = {
appId: `io.freetubeapp.${name}`,
copyright: 'Copyleft © 2020 freetubeapp@protonmail.com',
2020-02-16 19:30:00 +01:00
// asar: false,
// compression: 'store',
productName,
2020-02-16 19:30:00 +01:00
directories: {
output: './build/',
},
files: ['_icons/iconColor.*', './dist/**/*', '!./dist/web/**/*'],
2020-02-16 19:30:00 +01:00
dmg: {
contents: [
{
path: '/Applications',
type: 'link',
x: 410,
y: 230,
},
{
type: 'file',
x: 130,
y: 230,
},
],
window: {
height: 380,
width: 540,
},
},
linux: {
2020-03-25 09:05:40 +01:00
category: 'Network',
icon: '_icons/icon.png',
target: ['deb', 'zip', 'apk', 'rpm', 'AppImage'],
2020-02-16 19:30:00 +01:00
},
mac: {
category: 'public.app-category.utilities',
2020-05-28 01:01:44 +02:00
icon: '_icons/iconColor.icns',
2020-02-16 19:30:00 +01:00
target: ['dmg', 'zip'],
type: 'distribution',
},
win: {
2020-05-28 01:01:44 +02:00
icon: '_icons/iconColor.ico',
2020-05-27 23:18:04 +02:00
target: ['nsis', 'zip', 'portable', 'squirrel'],
2020-02-16 19:30:00 +01:00
},
nsis: {
allowToChangeInstallationDirectory: true,
oneClick: false,
},
}
builder
.build({
targets,
config,
})
.then(m => {
console.log(m)
})
.catch(e => {
console.error(e)
})