This repository has been archived by the owner on Dec 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.js
62 lines (62 loc) · 2.64 KB
/
build.js
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
const {
resolve,
join
} = require("node:path");
const builder = require("electron-builder");
const packagejson = require(resolve(join(__dirname, "package.json")));
let Platform;
if (process.platform == "win32") Platform = builder.Platform.WINDOWS;
/*else if (process.platform == "darwin") Platform = builder.Platform.MAC;
else if (process.platform == "linux") Platform = builder.Platform.LINUX;*/
if (typeof Platform != "undefined")(async () => await builder.build({
targets: await Platform.createTarget(),
config: {
appId: `com.${String(packagejson.exeName).toLowerCase()}.desktop`,
productName: packagejson.displayName,
copyright: `${packagejson.license} ${new Date().getFullYear().toString() == packagejson.releaseYear ? packagejson.releaseYear : `${packagejson.releaseYear} - ${new Date().getFullYear()}`} ${packagejson.author.name}`,
removePackageScripts: true,
win: {
target: "nsis",
icon: "icon.ico",
publisherName: packagejson.author.name,
artifactName: `${packagejson.exeName}.\${ext}`,
executableName: packagejson.exeName,
compression: "maximum"
},
nsis: {
oneClick: true,
allowToChangeInstallationDirectory: false,
installerIcon: "icon.ico",
uninstallerIcon: "icon.ico",
installerHeaderIcon: "icon.ico",
uninstallDisplayName: packagejson.displayName,
artifactName: `${packagejson.exeName}_\${platform}_\${arch}.\${ext}`,
deleteAppDataOnUninstall: true,
menuCategory: true,
createStartMenuShortcut: true,
createDesktopShortcut: "always",
shortcutName: packagejson.displayName
},
files: [
"!assets",
"!dist",
"!.gitignore",
"!build.js",
"!CHANGELOG.md",
"!package-lock.json",
"!README.md",
"**/*",
"!**/node_modules/*/{CHANGELOG.md,README.md,README,readme.md,readme}",
"!**/node_modules/*/{test,__tests__,tests,powered-test,example,examples}",
"!**/node_modules/*.d.ts",
"!**/node_modules/.bin",
"!**/*.{iml,o,hprof,orig,pyc,pyo,rbc,swp,csproj,sln,xproj}",
"!.editorconfig",
"!**/._*",
"!**/{.DS_Store,.git,.hg,.svn,CVS,RCS,SCCS,.gitignore,.gitattributes}",
"!**/{__pycache__,thumbs.db,.flowconfig,.idea,.vs,.nyc_output}",
"!**/{appveyor.yml,.travis.yml,circle.yml}",
"!**/{npm-debug.log,yarn.lock,.yarn-integrity,.yarn-metadata.json}"
]
}
}))();