Skip to content

Commit 3b5224a

Browse files
committed
Fixes #621 - Removed unnecessary bundling of entire node_modules for handling native modules
Signed-off-by: Omkar Phansopkar <omkarphansopkar@gmail.com>
1 parent 5e93211 commit 3b5224a

6 files changed

Lines changed: 515 additions & 186 deletions

File tree

docs/source/contribute/building.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,7 @@ Windows
6666
Release Instructions
6767
====================
6868

69-
ScanCode Workbench is built using `electron-forge <https://www.electronforge.io/>`__ and
70-
`electron-packager <https://www.npmjs.com/package/electron-packager>`__
71-
69+
ScanCode Workbench release is built using `electron-forge <https://www.electronforge.io/>`__.
7270
You can build the application for your platform using following command:
7371

7472
.. code-block:: bash

forge.config.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,34 @@
11
/* eslint-disable @typescript-eslint/no-var-requires */
22
const { version } = require("./package.json");
3+
const {
4+
addMetaDataFilesToPackage,
5+
buildPackageArchive,
6+
} = require("./package-utils");
37

48
const APP_NAME_WITH_VERSION = `ScanCode-Workbench-${version}`;
9+
const ARCHIVE_DIR = "dist";
10+
11+
const MetaDataFiles = [
12+
"apache-2.0.LICENSE",
13+
"AUTHORS.rst",
14+
"CHANGELOG.rst",
15+
"CODE_OF_CONDUCT.rst",
16+
"CONTRIBUTING.rst",
17+
"NOTICE",
18+
"package-lock.json",
19+
"README.md",
20+
"SCANCODE_WORKBENCH_VERSION",
21+
"workbench.ABOUT",
22+
];
523

624
module.exports = {
725
packagerConfig: {
826
name: APP_NAME_WITH_VERSION,
927
icon: "src/assets/app-icon/icon",
28+
dir: ".",
29+
out: "out",
30+
overwrite: true,
31+
prune: true,
1032
},
1133
plugins: [
1234
{
@@ -25,5 +47,21 @@ module.exports = {
2547
},
2648
},
2749
},
50+
{
51+
name: "@timfish/forge-externals-plugin",
52+
config: {
53+
externals: ["sqlite3"],
54+
includeDeps: true,
55+
},
56+
},
2857
],
58+
hooks: {
59+
postPackage: async (_, options) => {
60+
// Add metadata files like Readme, License, etc to the packaged app
61+
addMetaDataFilesToPackage(options.outputPaths[0], MetaDataFiles);
62+
63+
// Build zip/tar.gz archive of the packaged app
64+
buildPackageArchive(options.outputPaths[0], ARCHIVE_DIR);
65+
},
66+
},
2967
};

0 commit comments

Comments
 (0)