-
Notifications
You must be signed in to change notification settings - Fork 70
/
forge.config.js
84 lines (79 loc) · 1.99 KB
/
forge.config.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/* eslint-disable @typescript-eslint/no-var-requires */
const { version } = require("./package.json");
const {
addMetaDataFilesToPackage,
buildPackageArchive,
} = require("./package-utils");
const APP_NAME_WITH_VERSION = `ScanCode-Workbench-${version}`;
const ARCHIVE_DIR = "dist";
const MetaDataFiles = [
"apache-2.0.LICENSE",
"AUTHORS.rst",
"CHANGELOG.rst",
"CODE_OF_CONDUCT.rst",
"CONTRIBUTING.rst",
"NOTICE",
"package-lock.json",
"README.md",
"SCANCODE_WORKBENCH_VERSION",
"workbench.ABOUT",
];
/** @type {import('@electron-forge/shared-types').ForgeConfig} */
const forgeConfig = {
/** @type {import('@electron/packager').Options} */
packagerConfig: {
name: APP_NAME_WITH_VERSION,
appBundleId: "com.nexb.scancode-workbench",
icon: "src/assets/app-icon/icon",
dir: ".",
out: "out",
overwrite: true,
prune: true,
protocols: [
{
name: "JSON File",
schemes: ["file"],
extensions: ["json"],
},
{
name: "SQLite Database",
schemes: ["file"],
extensions: ["sqlite", "db"],
},
],
},
plugins: [
{
name: "@electron-forge/plugin-webpack",
config: {
mainConfig: "./webpack.main.config.js",
renderer: {
config: "./webpack.renderer.config.js",
entryPoints: [
{
html: "./src/index.html",
js: "./src/renderer.ts",
name: "main_window",
},
],
},
},
},
{
name: "@timfish/forge-externals-plugin",
config: {
externals: ["sqlite3"],
includeDeps: true,
},
},
],
hooks: {
postPackage: async (_, options) => {
// Add metadata files like Readme, License, etc to the packaged app
addMetaDataFilesToPackage(options.outputPaths[0], MetaDataFiles);
// Build zip/tar.gz archive of the packaged app
buildPackageArchive(options.outputPaths[0], ARCHIVE_DIR);
},
},
};
module.exports = forgeConfig;