Skip to content

Commit

Permalink
Fixes #621 - Removed unnecessary bundling of entire node_modules for …
Browse files Browse the repository at this point in the history
…handling native modules

Signed-off-by: Omkar Phansopkar <omkarphansopkar@gmail.com>
  • Loading branch information
OmkarPh committed Dec 25, 2023
1 parent 5e93211 commit 3b5224a
Show file tree
Hide file tree
Showing 6 changed files with 515 additions and 186 deletions.
4 changes: 1 addition & 3 deletions docs/source/contribute/building.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ Windows
Release Instructions
====================

ScanCode Workbench is built using `electron-forge <https://www.electronforge.io/>`__ and
`electron-packager <https://www.npmjs.com/package/electron-packager>`__

ScanCode Workbench release is built using `electron-forge <https://www.electronforge.io/>`__.
You can build the application for your platform using following command:

.. code-block:: bash
Expand Down
38 changes: 38 additions & 0 deletions forge.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,34 @@
/* 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",
];

module.exports = {
packagerConfig: {
name: APP_NAME_WITH_VERSION,
icon: "src/assets/app-icon/icon",
dir: ".",
out: "out",
overwrite: true,
prune: true,
},
plugins: [
{
Expand All @@ -25,5 +47,21 @@ module.exports = {
},
},
},
{
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);
},
},
};
Loading

0 comments on commit 3b5224a

Please sign in to comment.