-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.cjs
More file actions
85 lines (84 loc) · 2.6 KB
/
build.cjs
File metadata and controls
85 lines (84 loc) · 2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
const { build } = require("electron-builder");
build({
config: {
// package.json の 'name' と異なる名前をつける場合に必要
productName: "PickShot",
// 出力ファイル名, 例: PickShot-0.1.0-win32-x64.exe
artifactName: "${productName}-${version}-${platform}-${arch}.${ext}",
copyright: "Copyright (c) 2025 igz0",
// パッケージ対象とするファイル
files: ["dist/**"],
// 出力先とアセットファイル置き場
directories: {
output: "release",
buildResources: "assets",
},
asar: true,
publish: process.env.GH_TOKEN
? {
// GitHub へデプロイする
provider: "github",
// とりあえず draft としてデプロイ
releaseType: "draft", // or 'release', 'prerelease'
}
: null,
// Windows 向け設定
win: {
// ICO ファイルが必要
icon: "assets/icon.ico",
// ターゲット
target: [
{
target: "nsis",
arch: ["x64"],
},
"zip",
],
},
// Windows インストーラの設定
nsis: {
// インストーラと分かる名前にする
artifactName: "${productName}-${version}-win32-installer.exe",
oneClick: false,
perMachine: false,
allowToChangeInstallationDirectory: true,
installerIcon: "assets/icon.ico",
installerHeaderIcon: "assets/icon.ico",
},
mac: {
// PNG ファイルを使用(ICNSがない場合)
icon: "assets/icon.png",
/**
* macOS では 'category' が必須
* https://developer.apple.com/documentation/bundleresources/information_property_list/lsapplicationcategorytype
*/
category: "public.app-category.photography",
target: {
// macOS では string 型のみ指定可, 配列は使えないことに注意
target: "dmg", // or 'default', 'zip'
// Intel, Apple Silicon ともにビルド可能
arch: ["x64", "arm64"],
},
// コード署名しない場合は null の設定が必須
identity: null,
hardenedRuntime: false,
},
dmg: {
sign: false,
},
linux: {
// PNG ファイルを使用
icon: "assets/icon.png",
// どのディストロでも使える AppImage を選択
target: ["AppImage"], // or 'deb', 'snap' など
/**
* Linux では 'category' が必要
* https://specifications.freedesktop.org/menu-spec/latest/apa.html
*/
category: "Graphics",
},
},
}).catch((error) => {
console.error("Build failed:", error);
process.exit(1);
});