Skip to content

split electron-builder config to a separate file from build script #4431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 1 addition & 92 deletions _scripts/build.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const os = require('os')
const builder = require('electron-builder')
const config = require('./ebuilder.config.js')

const Platform = builder.Platform
const Arch = builder.Arch
const { name, productName } = require('../package.json')
const args = process.argv

let targets
Expand Down Expand Up @@ -39,97 +39,6 @@ if (platform === 'darwin') {
targets = Platform.LINUX.createTarget(['deb', 'zip', '7z', 'apk', 'rpm', 'AppImage', 'pacman'], arch)
}

const config = {
appId: `io.freetubeapp.${name}`,
copyright: 'Copyleft © 2020-2023 [email protected]',
// asar: false,
// compression: 'store',
productName,
directories: {
output: './build/',
},
protocols: [
{
name: "FreeTube",
schemes: [
"freetube"
]
}
],
files: [
'_icons/iconColor.*',
'icon.svg',
'./dist/**/*',
'!dist/web/*',
'!node_modules/**/*',
],
dmg: {
contents: [
{
path: '/Applications',
type: 'link',
x: 410,
y: 230,
},
{
type: 'file',
x: 130,
y: 230,
},
],
window: {
height: 380,
width: 540,
}
},
linux: {
category: 'Network',
icon: '_icons/icon.svg',
target: ['deb', 'zip', '7z', 'apk', 'rpm', 'AppImage', 'pacman'],
},
// 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`]
},
deb: {
depends: [
"libgtk-3-0",
"libnotify4",
"libnss3",
"libxss1",
"libxtst6",
"xdg-utils",
"libatspi2.0-0",
"libuuid1",
"libsecret-1-0"
]
},
mac: {
category: 'public.app-category.utilities',
icon: '_icons/iconMac.icns',
target: ['dmg', 'zip', '7z'],
type: 'distribution',
extendInfo: {
CFBundleURLTypes: [
'freetube'
],
CFBundleURLSchemes: [
'freetube'
]
}
},
win: {
icon: '_icons/icon.ico',
target: ['nsis', 'zip', '7z', 'portable'],
},
nsis: {
allowToChangeInstallationDirectory: true,
oneClick: false,
},
}

builder
.build({
targets,
Expand Down
94 changes: 94 additions & 0 deletions _scripts/ebuilder.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
const { name, productName } = require('../package.json')

const config = {
appId: `io.freetubeapp.${name}`,
copyright: 'Copyleft © 2020-2023 [email protected]',
// asar: false,
// compression: 'store',
productName,
directories: {
output: './build/',
},
protocols: [
{
name: "FreeTube",
schemes: [
"freetube"
]
}
],
files: [
'_icons/iconColor.*',
'icon.svg',
'./dist/**/*',
'!dist/web/*',
'!node_modules/**/*',
],
dmg: {
contents: [
{
path: '/Applications',
type: 'link',
x: 410,
y: 230,
},
{
type: 'file',
x: 130,
y: 230,
},
],
window: {
height: 380,
width: 540,
}
},
linux: {
category: 'Network',
icon: '_icons/icon.svg',
target: ['deb', 'zip', '7z', 'apk', 'rpm', 'AppImage', 'pacman'],
},
// 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`]
},
deb: {
depends: [
"libgtk-3-0",
"libnotify4",
"libnss3",
"libxss1",
"libxtst6",
"xdg-utils",
"libatspi2.0-0",
"libuuid1",
"libsecret-1-0"
]
},
mac: {
category: 'public.app-category.utilities',
icon: '_icons/iconMac.icns',
target: ['dmg', 'zip', '7z'],
type: 'distribution',
extendInfo: {
CFBundleURLTypes: [
'freetube'
],
CFBundleURLSchemes: [
'freetube'
]
}
},
win: {
icon: '_icons/icon.ico',
target: ['nsis', 'zip', '7z', 'portable'],
},
nsis: {
allowToChangeInstallationDirectory: true,
oneClick: false,
},
}

module.exports = config