Skip to content

Commit

Permalink
Fixed #622 - Include meta data files in packaged application
Browse files Browse the repository at this point in the history
Signed-off-by: Omkar Phansopkar <[email protected]>
  • Loading branch information
OmkarPh committed Dec 25, 2023
1 parent 99a1525 commit d3fe797
Show file tree
Hide file tree
Showing 18 changed files with 225 additions and 96 deletions.
20 changes: 20 additions & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The following organizations or individuals have contributed to ScanCode Workbench:

- @Aayush-hub => Aayush Garg
- @AyanSinhaMahapatra => Ayan Sinha Mahapatra
- @camillem => camillem
- @chinyeungli => Chin Yeung
- @dependabot[bot] => null
- @dotarjun => Arjun
- @jdaguil => Jillian Daguil
- @johnmhoran => John M. Horan
- @kopal960 => Kopal Rustagi
- @lakshay-angrish => null
- @OmkarPh => Omkar Phansopkar
- @pombredanne => Philippe Ombredanne
- @pranav1698 => Pranav Kulshrestha
- @Pushpit07 => Pushpit
- @RituRajSingh878 => Ritu Raj Singh
- @steven-esser => Steven Esser
- @Vishal-raj-1 => Vishal Rajput
- @vsvipul => Vipul
93 changes: 93 additions & 0 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
============
Contributing
============

Contributions are welcome and appreciated!
Every little bit helps, and a credit will always be given.

.. _issues : https://github.com/nexB/scancode-workbench/issues
__ issues_

If you are new to ScanCode Workbench and want to find easy tickets to work on,
check `easy issues <https://github.com/nexB/scancode-workbench/labels/easy>`_

When contributing to ScanCode Workbench (such as code, bugs, documentation, etc.) you
agree to the Developer `Certificate of Origin <http://developercertificate.org/>`_
and the ScanCode license (see the `NOTICE <https://github.com/nexB/scancode-workbench/blob/develop/NOTICE>`_ file).
The same approach is used by Linux Kernel developers and several other projects.

For commits, it is best to simply add a line like this to your commit message,
with your name and email::

Signed-off-by: Jane Doe <[email protected]>

Please try to write a good commit message, see `good commit message wiki
<https://aboutcode.readthedocs.io/en/latest/contributing/writing_good_commit_messages.html>`_ for
details. In particular use the imperative for your commit subject: think that
you are giving an order to the codebase to update itself.


Feature requests and feedback
=============================

To send feedback or ask a question, `file an issue <issues_>`_

If you are proposing a feature:

* Explain how it would work.
* Keep the scope as simple as possible to make it easier to implement.
* Remember that your contributions are welcomed to implement this feature!


Chat with other developers
==========================

For other questions, discussions, and chats, we have:

- an official Gitter channel at https://gitter.im/aboutcode-org/discuss
Gitter also has an IRC bridge at https://irc.gitter.im/
This is the main place where we chat and meet.

- a Gitter channel to discuss Documentation at https://gitter.im/aboutcode-org/gsod-season-of-docs

Bug reports
===========

When `reporting a bug`__ please include:

* Your operating system name, version, and architecture.
* Your ScanCode Workbench version.
* Any additional details about your local setup that might be helpful to
diagnose this bug.
* Detailed steps to reproduce the bug, such as the scan file you imported, filters you applied, etc.
* The error messages or failure trace if any.
* If helpful, you can add a screenshot as an issue attachment when relevant or
some extra file as a link to a `Gist <https://gist.github.com>`_.


Documentation improvements
==========================

Documentation can come in the form of new documentation pages/sections, tutorials/how-to documents,
any other general upgrades, etc. Even a minor typo fix is welcomed.

If something is missing in the documentation or if you found some part confusing,
please file an issue with your suggestions for improvement. Your help and contribution make ScanCode Workbench docs better, we love hearing from you!

The ScanCode Workbench documentation is hosted at `scancode-workbench.readthedocs.io <https://scancode-workbench.readthedocs.io/en/latest/>`_.

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.


Pull Request Guidelines
-----------------------

If you need a code review or feedback while you are developing the code just
create a pull request. You can add new commits to your branch as needed.

For merging, your request would need to:

1. Include unit tests that are passing (run ``npm test``).
2. Update documentation as needed for new UI screen, functionality, etc.
3. Add a note to ``CHANGELOG.rst`` about the changes.
4. Add your name to ``AUTHORS.rst``.
5 changes: 5 additions & 0 deletions Release.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,8 @@ This v4.0.0 of ScanCode Workbench is compatible with scans from any [ScanCode To
- Automatic height for tables https://github.com/nexB/scancode-workbench/pull/606
- Fixed Empty directory being shown with file icon https://github.com/nexB/scancode-workbench/pull/604
- Fix irregular scroll behavior for files in deeply nested FileTree https://github.com/nexB/scancode-workbench/pull/599

## Framework

- Electorn [v28.1.0](https://releases.electronjs.org/release/v28.1.0)
- Chromium [v120.0.6099.109](https://source.chromium.org/chromium/chromium/src/+/refs/tags/120.0.6099.109:)
1 change: 1 addition & 0 deletions SCANCODE_WORKBENCH_VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4.0.1
11 changes: 6 additions & 5 deletions archive_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
APP_NAME = 'ScanCode-Workbench'
APP_BUNDLE_ID = 'com.nexb.scancode-workbench'
ARCHIVE_DIR = 'dist'
PACKAGE_DIR = 'out' # @NOTE - PACKAGE_DIR must be same as 'out' property in packager.js
OUT_DIR = 'out' # @NOTE - OUT_DIR must be same as 'out' property in packager.js

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

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

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

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

# Prepare .tar.gz file for mac & linux
else:
tar_command = f"tar -czf {ARCHIVE_DIR}/{archive_file_name}.tar.gz -C {PACKAGE_DIR} ."
tar_command = f"tar -czf {ARCHIVE_DIR}/{archive_file_name}.tar.gz -C {OUT_DIR} {PACKAGE_DIR_NAME}"
print("Executing tar command:", tar_command)
os.system(tar_command)
print(f"Tar file ready: {ARCHIVE_DIR}/{archive_file_name}.tar.gz")
Expand Down
5 changes: 0 additions & 5 deletions attribution.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,6 @@ <h2>About ScanCode Workbench 4.0.0:</h2>

<!-- <h2>ScanCode Workbench contains the following software components:</h2> -->
<!-- <h3><a id="End">End</a></h3> -->

<h2>ScanCode Workbench contains the following image assets:</h2>
Import file illustration -
<a href="https://storyset.com/work">Work illustrations by Storyset</a>

<br />
<br />
</body>
Expand Down
29 changes: 29 additions & 0 deletions forge.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const { version } = require("./package.json");

const APP_NAME_WITH_VERSION = `ScanCode-Workbench-${version}`;

module.exports = {
packagerConfig: {
name: APP_NAME_WITH_VERSION,
icon: "src/assets/app-icon/icon",
},
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",
},
],
},
},
},
],
};
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 4 additions & 27 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "scancode-workbench",
"productName": "scancode-workbench",
"version": "4.0.0",
"version": "4.0.1",
"description": "An application for viewing ScanCode results and concluding component origin and license",
"repository": {
"type": "git",
Expand Down Expand Up @@ -48,7 +48,7 @@
"@typescript-eslint/parser": "^6.9.1",
"@vercel/webpack-asset-relocator-loader": "^1.7.3",
"css-loader": "^6.8.1",
"electron": "^27.0.3",
"electron": "^28.1.0",
"electron-builder": "^24.6.4",
"electron-packager": "^17.1.2",
"eslint": "^8.53.0",
Expand All @@ -57,8 +57,8 @@
"fork-ts-checker-webpack-plugin": "^9.0.2",
"husky": "^8.0.3",
"jest": "^29.7.0",
"node-loader": "^2.0.0",
"jest-environment-jsdom": "^29.7.0",
"node-loader": "^2.0.0",
"style-loader": "^3.3.3",
"ts-jest": "^29.1.1",
"ts-loader": "^9.5.0",
Expand Down Expand Up @@ -109,29 +109,6 @@
"d3-color": "3.1.0"
},
"config": {
"forge": {
"packagerConfig": {
"name": "ScanCode Workbench",
"icon": "src/assets/app-icon/icon"
},
"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"
}
]
}
}
}
]
}
"forge": "./forge.config.js"
}
}
36 changes: 33 additions & 3 deletions packager.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const fs = require("fs");
const packager = require("electron-packager");
const { packagerConfig } = require("./forge.config.js");

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",
];

const ignoreDir = [
"src",
Expand All @@ -9,23 +24,32 @@ const ignoreDir = [
".github",
"docs",
"test-db",
".husky",
"coverage",
"tests",
"", // Required as the last element !!
].join("*|");

const ignoreFilesOrExtensions = [
"rst",
"py",
"md",
"txt",
"enc",
".test.ts",
"ABOUT",
".config.js",
".plugins.js",
".rules.js",
".toml",
"workbench.ABOUT",
"LICENSE",
"NOTICE",
".gitignore",
".eslintrc.json",
"package-lock.json",
"packager.js",
"electron-builder.json",
"tsconfig.json",
...MetaDataFiles,
].join("|");

packager({
Expand All @@ -34,7 +58,7 @@ packager({
overwrite: true,
icon: "src/assets/app-icon/icon",
prune: true,
name: "ScanCode-Workbench",
name: packagerConfig.name,
ignore: new RegExp(`(${ignoreDir}^.*.(${ignoreFilesOrExtensions})$)`),
// osxSign: true,
// osxSign: {
Expand All @@ -48,4 +72,10 @@ packager({
// appleId: '[email protected]',
// appleIdPassword: 'my-apple-id-password'
// },
}).then((packagePath) => {
// Copy the metadata files to package directory
MetaDataFiles.forEach((file) =>
fs.copyFileSync(file, `${packagePath}/${file}`)
);
console.log(`Packaged app at ${packagePath}`);
});
Binary file removed src/assets/images/AddFiles.png
Binary file not shown.
8 changes: 0 additions & 8 deletions src/assets/images/Addfiles.png.ABOUT

This file was deleted.

Loading

0 comments on commit d3fe797

Please sign in to comment.