waveterm/electron-builder.config.cjs
Evan Simkowitz 8971e2feba
Set up electron-builder for new app (#113)
Adds electron-builder, which we will use to package and distribute our
application, same as in the existing app.
Replaces explicit port assignments with dynamic ones, which are then
stored into environment variables.
Adds a ~/.w2-dev folder for use when running a dev build.

The build-helper pipeline from the old repo is included here too, but it
is not updated yet so it will fail.

Also removes some redundant utility functions and cleans up some let vs.
const usage.

The packaging can be run using the `package:prod` and `package:dev`
tasks.

---------

Co-authored-by: sawka <mike.sawka@gmail.com>
2024-07-17 18:42:49 -07:00

80 lines
1.8 KiB
JavaScript

const pkg = require("./package.json");
const fs = require("fs");
const path = require("path");
/**
* @type {import('electron-builder').Configuration}
* @see https://www.electron.build/configuration/configuration
*/
const config = {
appId: pkg.build.appId,
productName: pkg.productName,
artifactName: "${productName}-${platform}-${arch}-${version}.${ext}",
npmRebuild: false,
nodeGypRebuild: false,
electronCompile: false,
files: [
{
from: "./dist",
to: "./dist",
filter: ["**/*"],
},
{
from: ".",
to: ".",
filter: ["package.json"],
},
],
directories: {
output: "make",
},
asarUnpack: ["dist/bin/**/*"],
mac: {
target: [
{
target: "zip",
arch: "universal",
},
{
target: "dmg",
arch: "universal",
},
],
icon: "build/icons.icns",
category: "public.app-category.developer-tools",
minimumSystemVersion: "10.15.0",
notarize: process.env.APPLE_TEAM_ID
? {
teamId: process.env.APPLE_TEAM_ID,
}
: false,
binaries: fs
.readdirSync("dist/bin", { recursive: true, withFileTypes: true })
.filter((f) => f.isFile() && (f.name.startsWith("wavesrv") || f.name.includes("darwin")))
.map((f) => path.resolve(f.path, f.name)),
},
linux: {
executableName: pkg.productName,
category: "TerminalEmulator",
icon: "build/icons.icns",
target: ["zip", "deb", "rpm", "AppImage", "pacman"],
synopsis: pkg.description,
description: null,
desktop: {
Name: pkg.productName,
Comment: pkg.description,
Keywords: "developer;terminal;emulator;",
category: "Development;Utility;",
},
},
appImage: {
license: "LICENSE",
},
publish: {
provider: "generic",
url: "https://dl.waveterm.dev/releases",
},
};
module.exports = config;