Skip to content

Commit d3fe797

Browse files
committed
Fixed #622 - Include meta data files in packaged application
Signed-off-by: Omkar Phansopkar <omkarphansopkar@gmail.com>
1 parent 99a1525 commit d3fe797

18 files changed

Lines changed: 225 additions & 96 deletions

AUTHORS.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
The following organizations or individuals have contributed to ScanCode Workbench:
2+
3+
- @Aayush-hub => Aayush Garg
4+
- @AyanSinhaMahapatra => Ayan Sinha Mahapatra
5+
- @camillem => camillem
6+
- @chinyeungli => Chin Yeung
7+
- @dependabot[bot] => null
8+
- @dotarjun => Arjun
9+
- @jdaguil => Jillian Daguil
10+
- @johnmhoran => John M. Horan
11+
- @kopal960 => Kopal Rustagi
12+
- @lakshay-angrish => null
13+
- @OmkarPh => Omkar Phansopkar
14+
- @pombredanne => Philippe Ombredanne
15+
- @pranav1698 => Pranav Kulshrestha
16+
- @Pushpit07 => Pushpit
17+
- @RituRajSingh878 => Ritu Raj Singh
18+
- @steven-esser => Steven Esser
19+
- @Vishal-raj-1 => Vishal Rajput
20+
- @vsvipul => Vipul

CONTRIBUTING.rst

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
============
2+
Contributing
3+
============
4+
5+
Contributions are welcome and appreciated!
6+
Every little bit helps, and a credit will always be given.
7+
8+
.. _issues : https://github.com/nexB/scancode-workbench/issues
9+
__ issues_
10+
11+
If you are new to ScanCode Workbench and want to find easy tickets to work on,
12+
check `easy issues <https://github.com/nexB/scancode-workbench/labels/easy>`_
13+
14+
When contributing to ScanCode Workbench (such as code, bugs, documentation, etc.) you
15+
agree to the Developer `Certificate of Origin <http://developercertificate.org/>`_
16+
and the ScanCode license (see the `NOTICE <https://github.com/nexB/scancode-workbench/blob/develop/NOTICE>`_ file).
17+
The same approach is used by Linux Kernel developers and several other projects.
18+
19+
For commits, it is best to simply add a line like this to your commit message,
20+
with your name and email::
21+
22+
Signed-off-by: Jane Doe <developer@example.com>
23+
24+
Please try to write a good commit message, see `good commit message wiki
25+
<https://aboutcode.readthedocs.io/en/latest/contributing/writing_good_commit_messages.html>`_ for
26+
details. In particular use the imperative for your commit subject: think that
27+
you are giving an order to the codebase to update itself.
28+
29+
30+
Feature requests and feedback
31+
=============================
32+
33+
To send feedback or ask a question, `file an issue <issues_>`_
34+
35+
If you are proposing a feature:
36+
37+
* Explain how it would work.
38+
* Keep the scope as simple as possible to make it easier to implement.
39+
* Remember that your contributions are welcomed to implement this feature!
40+
41+
42+
Chat with other developers
43+
==========================
44+
45+
For other questions, discussions, and chats, we have:
46+
47+
- an official Gitter channel at https://gitter.im/aboutcode-org/discuss
48+
Gitter also has an IRC bridge at https://irc.gitter.im/
49+
This is the main place where we chat and meet.
50+
51+
- a Gitter channel to discuss Documentation at https://gitter.im/aboutcode-org/gsod-season-of-docs
52+
53+
Bug reports
54+
===========
55+
56+
When `reporting a bug`__ please include:
57+
58+
* Your operating system name, version, and architecture.
59+
* Your ScanCode Workbench version.
60+
* Any additional details about your local setup that might be helpful to
61+
diagnose this bug.
62+
* Detailed steps to reproduce the bug, such as the scan file you imported, filters you applied, etc.
63+
* The error messages or failure trace if any.
64+
* If helpful, you can add a screenshot as an issue attachment when relevant or
65+
some extra file as a link to a `Gist <https://gist.github.com>`_.
66+
67+
68+
Documentation improvements
69+
==========================
70+
71+
Documentation can come in the form of new documentation pages/sections, tutorials/how-to documents,
72+
any other general upgrades, etc. Even a minor typo fix is welcomed.
73+
74+
If something is missing in the documentation or if you found some part confusing,
75+
please file an issue with your suggestions for improvement. Your help and contribution make ScanCode Workbench docs better, we love hearing from you!
76+
77+
The ScanCode Workbench documentation is hosted at `scancode-workbench.readthedocs.io <https://scancode-workbench.readthedocs.io/en/latest/>`_.
78+
79+
If you want to contribute to Scancode Workbench Documentation, you'll find `this guide here <https://scancode-workbench.readthedocs.io/en/latest/contribute/building.html#building-documentation>`_ helpful.
80+
81+
82+
Pull Request Guidelines
83+
-----------------------
84+
85+
If you need a code review or feedback while you are developing the code just
86+
create a pull request. You can add new commits to your branch as needed.
87+
88+
For merging, your request would need to:
89+
90+
1. Include unit tests that are passing (run ``npm test``).
91+
2. Update documentation as needed for new UI screen, functionality, etc.
92+
3. Add a note to ``CHANGELOG.rst`` about the changes.
93+
4. Add your name to ``AUTHORS.rst``.

Release.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,8 @@ This v4.0.0 of ScanCode Workbench is compatible with scans from any [ScanCode To
4141
- Automatic height for tables https://github.com/nexB/scancode-workbench/pull/606
4242
- Fixed Empty directory being shown with file icon https://github.com/nexB/scancode-workbench/pull/604
4343
- Fix irregular scroll behavior for files in deeply nested FileTree https://github.com/nexB/scancode-workbench/pull/599
44+
45+
## Framework
46+
47+
- Electorn [v28.1.0](https://releases.electronjs.org/release/v28.1.0)
48+
- Chromium [v120.0.6099.109](https://source.chromium.org/chromium/chromium/src/+/refs/tags/120.0.6099.109:)

SCANCODE_WORKBENCH_VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4.0.1

archive_builder.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
APP_NAME = 'ScanCode-Workbench'
2121
APP_BUNDLE_ID = 'com.nexb.scancode-workbench'
2222
ARCHIVE_DIR = 'dist'
23-
PACKAGE_DIR = 'out' # @NOTE - PACKAGE_DIR must be same as 'out' property in packager.js
23+
OUT_DIR = 'out' # @NOTE - OUT_DIR must be same as 'out' property in packager.js
2424

2525
# Get scancode workbench version from package.json
2626
with open('package.json') as json_file:
@@ -51,24 +51,25 @@
5151
raise Exception('Unsupported OS/platform %r' % SYSTEM_PLATFORM)
5252

5353
# Prepare file name for archive using platform, architecture & app version
54-
archive_file_name = '-'.join([APP_NAME, PLATFORM_NAME, ARCH, APP_VERSION])
54+
archive_file_name = '-'.join([APP_NAME, APP_VERSION, PLATFORM_NAME, ARCH])
55+
PACKAGE_DIR_NAME = '-'.join([APP_NAME, APP_VERSION, PLATFORM, ARCH])
5556
print(f"Composed Archive file name: '{archive_file_name}'")
5657

5758
# Ensure archive directory dist/ is created, before attempting to store archive inside it
5859
ensure_archive_directory = f"mkdir -p {ARCHIVE_DIR}"
59-
print("Executing mkdir command:", ensure_archive_directory)
60+
print("Ensure `dist/` directory exists using:", ensure_archive_directory)
6061
os.system(ensure_archive_directory)
6162

6263
# Prepare .zip file for windows
6364
if on_windows:
64-
zip_command = f"powershell Compress-Archive {PACKAGE_DIR}/* {ARCHIVE_DIR}/{archive_file_name}.zip"
65+
zip_command = f"powershell Compress-Archive {OUT_DIR}/{PACKAGE_DIR_NAME} {ARCHIVE_DIR}/{archive_file_name}.zip"
6566
print("Executing zip command on powershell:", zip_command)
6667
os.system(zip_command)
6768
print(f"Zip file ready: {ARCHIVE_DIR}/{archive_file_name}.zip")
6869

6970
# Prepare .tar.gz file for mac & linux
7071
else:
71-
tar_command = f"tar -czf {ARCHIVE_DIR}/{archive_file_name}.tar.gz -C {PACKAGE_DIR} ."
72+
tar_command = f"tar -czf {ARCHIVE_DIR}/{archive_file_name}.tar.gz -C {OUT_DIR} {PACKAGE_DIR_NAME}"
7273
print("Executing tar command:", tar_command)
7374
os.system(tar_command)
7475
print(f"Tar file ready: {ARCHIVE_DIR}/{archive_file_name}.tar.gz")

attribution.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,6 @@ <h2>About ScanCode Workbench 4.0.0:</h2>
9797

9898
<!-- <h2>ScanCode Workbench contains the following software components:</h2> -->
9999
<!-- <h3><a id="End">End</a></h3> -->
100-
101-
<h2>ScanCode Workbench contains the following image assets:</h2>
102-
Import file illustration -
103-
<a href="https://storyset.com/work">Work illustrations by Storyset</a>
104-
105100
<br />
106101
<br />
107102
</body>

forge.config.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/* eslint-disable @typescript-eslint/no-var-requires */
2+
const { version } = require("./package.json");
3+
4+
const APP_NAME_WITH_VERSION = `ScanCode-Workbench-${version}`;
5+
6+
module.exports = {
7+
packagerConfig: {
8+
name: APP_NAME_WITH_VERSION,
9+
icon: "src/assets/app-icon/icon",
10+
},
11+
plugins: [
12+
{
13+
name: "@electron-forge/plugin-webpack",
14+
config: {
15+
mainConfig: "./webpack.main.config.js",
16+
renderer: {
17+
config: "./webpack.renderer.config.js",
18+
entryPoints: [
19+
{
20+
html: "./src/index.html",
21+
js: "./src/renderer.ts",
22+
name: "main_window",
23+
},
24+
],
25+
},
26+
},
27+
},
28+
],
29+
};

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "scancode-workbench",
33
"productName": "scancode-workbench",
4-
"version": "4.0.0",
4+
"version": "4.0.1",
55
"description": "An application for viewing ScanCode results and concluding component origin and license",
66
"repository": {
77
"type": "git",
@@ -48,7 +48,7 @@
4848
"@typescript-eslint/parser": "^6.9.1",
4949
"@vercel/webpack-asset-relocator-loader": "^1.7.3",
5050
"css-loader": "^6.8.1",
51-
"electron": "^27.0.3",
51+
"electron": "^28.1.0",
5252
"electron-builder": "^24.6.4",
5353
"electron-packager": "^17.1.2",
5454
"eslint": "^8.53.0",
@@ -57,8 +57,8 @@
5757
"fork-ts-checker-webpack-plugin": "^9.0.2",
5858
"husky": "^8.0.3",
5959
"jest": "^29.7.0",
60-
"node-loader": "^2.0.0",
6160
"jest-environment-jsdom": "^29.7.0",
61+
"node-loader": "^2.0.0",
6262
"style-loader": "^3.3.3",
6363
"ts-jest": "^29.1.1",
6464
"ts-loader": "^9.5.0",
@@ -109,29 +109,6 @@
109109
"d3-color": "3.1.0"
110110
},
111111
"config": {
112-
"forge": {
113-
"packagerConfig": {
114-
"name": "ScanCode Workbench",
115-
"icon": "src/assets/app-icon/icon"
116-
},
117-
"plugins": [
118-
{
119-
"name": "@electron-forge/plugin-webpack",
120-
"config": {
121-
"mainConfig": "./webpack.main.config.js",
122-
"renderer": {
123-
"config": "./webpack.renderer.config.js",
124-
"entryPoints": [
125-
{
126-
"html": "./src/index.html",
127-
"js": "./src/renderer.ts",
128-
"name": "main_window"
129-
}
130-
]
131-
}
132-
}
133-
}
134-
]
135-
}
112+
"forge": "./forge.config.js"
136113
}
137114
}

packager.js

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
/* eslint-disable @typescript-eslint/no-var-requires */
2+
const fs = require("fs");
23
const packager = require("electron-packager");
4+
const { packagerConfig } = require("./forge.config.js");
5+
6+
const MetaDataFiles = [
7+
"apache-2.0.LICENSE",
8+
"AUTHORS.rst",
9+
"CHANGELOG.rst",
10+
"CODE_OF_CONDUCT.rst",
11+
"CONTRIBUTING.rst",
12+
"NOTICE",
13+
"package-lock.json",
14+
"README.md",
15+
"SCANCODE_WORKBENCH_VERSION",
16+
"workbench.ABOUT",
17+
];
318

419
const ignoreDir = [
520
"src",
@@ -9,23 +24,32 @@ const ignoreDir = [
924
".github",
1025
"docs",
1126
"test-db",
27+
".husky",
28+
"coverage",
29+
"tests",
1230
"", // Required as the last element !!
1331
].join("*|");
32+
1433
const ignoreFilesOrExtensions = [
1534
"rst",
1635
"py",
1736
"md",
1837
"txt",
1938
"enc",
2039
".test.ts",
21-
"ABOUT",
40+
".config.js",
41+
".plugins.js",
42+
".rules.js",
43+
".toml",
44+
"workbench.ABOUT",
2245
"LICENSE",
2346
"NOTICE",
2447
".gitignore",
2548
".eslintrc.json",
26-
"package-lock.json",
49+
"packager.js",
2750
"electron-builder.json",
2851
"tsconfig.json",
52+
...MetaDataFiles,
2953
].join("|");
3054

3155
packager({
@@ -34,7 +58,7 @@ packager({
3458
overwrite: true,
3559
icon: "src/assets/app-icon/icon",
3660
prune: true,
37-
name: "ScanCode-Workbench",
61+
name: packagerConfig.name,
3862
ignore: new RegExp(`(${ignoreDir}^.*.(${ignoreFilesOrExtensions})$)`),
3963
// osxSign: true,
4064
// osxSign: {
@@ -48,4 +72,10 @@ packager({
4872
// appleId: 'felix@felix.fun',
4973
// appleIdPassword: 'my-apple-id-password'
5074
// },
75+
}).then((packagePath) => {
76+
// Copy the metadata files to package directory
77+
MetaDataFiles.forEach((file) =>
78+
fs.copyFileSync(file, `${packagePath}/${file}`)
79+
);
80+
console.log(`Packaged app at ${packagePath}`);
5181
});

0 commit comments

Comments
 (0)