2020-02-16 18:30:00 +00:00
|
|
|
const os = require('os')
|
|
|
|
const builder = require('electron-builder')
|
|
|
|
|
|
|
|
const Platform = builder.Platform
|
2020-07-21 21:43:52 +00:00
|
|
|
const Arch = builder.Arch
|
2020-02-16 18:30:00 +00:00
|
|
|
const { name, productName } = require('../package.json')
|
2020-07-21 21:43:52 +00:00
|
|
|
const args = process.argv
|
2020-02-16 18:30:00 +00:00
|
|
|
|
|
|
|
let targets
|
2022-05-14 16:53:08 +00:00
|
|
|
const platform = os.platform()
|
|
|
|
const cpus = os.cpus()
|
2020-02-16 18:30:00 +00:00
|
|
|
|
2022-05-14 16:53:08 +00:00
|
|
|
if (platform === 'darwin') {
|
|
|
|
let arch = Arch.x64
|
|
|
|
|
|
|
|
// Macbook Air 2020 with M1 = 'Apple M1'
|
|
|
|
// Macbook Pro 2021 with M1 Pro = 'Apple M1 Pro'
|
|
|
|
if (cpus[0].model.startsWith('Apple')) {
|
|
|
|
arch = Arch.arm64
|
|
|
|
}
|
|
|
|
|
|
|
|
targets = Platform.MAC.createTarget(['dmg'], arch)
|
|
|
|
} else if (platform === 'win32') {
|
2020-02-16 18:30:00 +00:00
|
|
|
targets = Platform.WINDOWS.createTarget()
|
2022-05-14 16:53:08 +00:00
|
|
|
} else if (platform === 'linux') {
|
2020-07-21 21:43:52 +00:00
|
|
|
let arch = Arch.x64
|
|
|
|
|
2021-03-06 16:19:54 +00:00
|
|
|
if (args[2] === 'arm64') {
|
2020-07-21 21:43:52 +00:00
|
|
|
arch = Arch.arm64
|
|
|
|
}
|
|
|
|
|
2021-04-21 22:11:52 +00:00
|
|
|
if (args[2] === 'arm32') {
|
2021-03-06 16:19:54 +00:00
|
|
|
arch = Arch.armv7l
|
|
|
|
}
|
|
|
|
|
2020-10-05 14:46:09 +00:00
|
|
|
targets = Platform.LINUX.createTarget(['deb', 'zip', 'apk', 'rpm', 'AppImage', 'pacman'], arch)
|
2020-02-16 18:30:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const config = {
|
|
|
|
appId: `io.freetubeapp.${name}`,
|
2021-07-02 16:54:59 +00:00
|
|
|
copyright: 'Copyleft © 2020-2021 freetubeapp@protonmail.com',
|
2020-02-16 18:30:00 +00:00
|
|
|
// asar: false,
|
|
|
|
// compression: 'store',
|
2020-03-24 13:22:29 +00:00
|
|
|
productName,
|
2020-02-16 18:30:00 +00:00
|
|
|
directories: {
|
|
|
|
output: './build/',
|
|
|
|
},
|
2020-10-04 20:31:07 +00:00
|
|
|
protocols: [
|
|
|
|
{
|
|
|
|
name: "FreeTube",
|
|
|
|
schemes: [
|
|
|
|
"freetube"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
2022-07-14 14:43:07 +00:00
|
|
|
files: [
|
|
|
|
'_icons/iconColor.*',
|
|
|
|
'icon.svg',
|
|
|
|
'./dist/**/*',
|
|
|
|
'!dist/web/*',
|
|
|
|
'!**/node_modules/**/.*',
|
|
|
|
'!**/{.github,Jenkinsfile}',
|
|
|
|
'!**/{CHANGES.md,CODE_OF_CONDUCT.md,CONTRIBUTING.md,CONTRIBUTION.md,DEVELOPMENT.md,docs,docs.md,docs.mli,examples,History.md,HISTORY.md,index.html,README.md,TODO.md,UPGRADE_GUIDE.md,UPGRADING.md}',
|
|
|
|
'!**/{commitlint.config.js,.editorconfig,.eslintignore,.eslintrc.{js,yml},.gitmodules,.huskyrc,.lintstagedrc,.nvmrc,.nycrc{,.json},.prettierrc{,.yaml},tslint.json}',
|
|
|
|
'!**/{.babelrc,bower.json,Gruntfile.js,Makefile,.npmrc.proregistry,rollup.config.js,.tm_properties,.tool-versions,tsconfig.json,webpack.config.js}',
|
|
|
|
'!**/*.{{,c,m}js,min,ts}.map',
|
|
|
|
'!**/*.d.ts',
|
|
|
|
|
|
|
|
// only exclude the src directory for specific packages
|
|
|
|
// as some of them have their dist code in there and we don't want to exclude those
|
|
|
|
'!**/node_modules/{@fortawesome/vue-fontawesome,agent-base,jquery,localforage,m3u8-parser,marked,mpd-parser,performance-now,video.js,vue,vue-i18n,vue-router}/src/*',
|
|
|
|
'!**/node_modules/**/{bin,man,scripts}/*',
|
|
|
|
'!**/node_modules/jquery/dist/jquery.slim*.js',
|
|
|
|
'!**/node_modules/video.js/dist/{alt/*,video.js}',
|
|
|
|
'!**/node_modules/@videojs/*/src'
|
|
|
|
],
|
2020-02-16 18:30:00 +00:00
|
|
|
dmg: {
|
|
|
|
contents: [
|
|
|
|
{
|
|
|
|
path: '/Applications',
|
|
|
|
type: 'link',
|
|
|
|
x: 410,
|
|
|
|
y: 230,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'file',
|
|
|
|
x: 130,
|
|
|
|
y: 230,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
window: {
|
|
|
|
height: 380,
|
|
|
|
width: 540,
|
2020-10-10 01:05:03 +00:00
|
|
|
}
|
2020-02-16 18:30:00 +00:00
|
|
|
},
|
|
|
|
linux: {
|
2020-03-25 08:05:40 +00:00
|
|
|
category: 'Network',
|
2021-03-06 22:17:06 +00:00
|
|
|
icon: '_icons/icon.svg',
|
2020-10-05 14:46:09 +00:00
|
|
|
target: ['deb', 'zip', 'apk', 'rpm', 'AppImage', 'pacman'],
|
2020-02-16 18:30:00 +00:00
|
|
|
},
|
2021-05-23 02:52:50 +00:00
|
|
|
// See the following issues for more information
|
|
|
|
// https://github.com/jordansissel/fpm/issues/1503
|
|
|
|
// https://github.com/jgraph/drawio-desktop/issues/259
|
|
|
|
rpm: {
|
|
|
|
fpm: [`--rpm-rpmbuild-define=_build_id_links none`]
|
|
|
|
},
|
2021-04-24 17:41:07 +00:00
|
|
|
deb: {
|
|
|
|
depends: [
|
|
|
|
"libgtk-3-0",
|
|
|
|
"libnotify4",
|
|
|
|
"libnss3",
|
|
|
|
"libxss1",
|
|
|
|
"libxtst6",
|
|
|
|
"xdg-utils",
|
|
|
|
"libatspi2.0-0",
|
|
|
|
"libuuid1",
|
|
|
|
"libsecret-1-0"
|
|
|
|
]
|
|
|
|
},
|
2020-02-16 18:30:00 +00:00
|
|
|
mac: {
|
|
|
|
category: 'public.app-category.utilities',
|
2021-03-07 01:41:26 +00:00
|
|
|
icon: '_icons/iconMac.icns',
|
2020-02-16 18:30:00 +00:00
|
|
|
target: ['dmg', 'zip'],
|
|
|
|
type: 'distribution',
|
2020-10-10 01:09:23 +00:00
|
|
|
extendInfo: {
|
|
|
|
CFBundleURLTypes: [
|
|
|
|
'freetube'
|
|
|
|
],
|
|
|
|
CFBundleURLSchemes: [
|
|
|
|
'freetube'
|
|
|
|
]
|
|
|
|
}
|
2020-02-16 18:30:00 +00:00
|
|
|
},
|
|
|
|
win: {
|
2021-03-06 22:17:06 +00:00
|
|
|
icon: '_icons/icon.ico',
|
2020-05-27 21:18:04 +00:00
|
|
|
target: ['nsis', 'zip', 'portable', 'squirrel'],
|
2020-02-16 18:30:00 +00:00
|
|
|
},
|
|
|
|
nsis: {
|
|
|
|
allowToChangeInstallationDirectory: true,
|
|
|
|
oneClick: false,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
builder
|
|
|
|
.build({
|
|
|
|
targets,
|
|
|
|
config,
|
|
|
|
})
|
|
|
|
.then(m => {
|
|
|
|
console.log(m)
|
|
|
|
})
|
|
|
|
.catch(e => {
|
|
|
|
console.error(e)
|
|
|
|
})
|