Skip to content

Commit

Permalink
feat(client-electron): add oss attributions
Browse files Browse the repository at this point in the history
fixes #133 
fixes #143
  • Loading branch information
marcincichocki authored Jul 5, 2021
1 parent ab7d66f commit 61d153c
Showing 7 changed files with 106 additions and 25 deletions.
4 changes: 4 additions & 0 deletions configs/common.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { execSync } from 'child_process';
import { LicenseWebpackPlugin } from 'license-webpack-plugin';
import { DefinePlugin, RuleSetRule, WebpackPluginInstance } from 'webpack';

function git(command: string) {
@@ -18,6 +19,9 @@ export const commonPlugins: WebpackPluginInstance[] = [
BUGS_URL: JSON.stringify(pkg.bugs),
PRODUCT_NAME: JSON.stringify(pkg.build.productName),
}),
new LicenseWebpackPlugin({
outputFilename: 'THIRD_PARTY_LICENSES.txt',
}) as any,
];

export const commonRules: RuleSetRule[] = [
82 changes: 82 additions & 0 deletions package-lock.json

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

8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -19,7 +19,12 @@
],
"extraFiles": [
"resources/**/*",
"!resources/icon.png"
"!resources/icon.png",
{
"from": "dist",
"to": "resources",
"filter": "*.txt"
}
],
"directories": {
"buildResources": "resources",
@@ -71,6 +76,7 @@
"fs-extra": "^9.1.0",
"html-webpack-plugin": "^5.3.1",
"jest": "^26.6.3",
"license-webpack-plugin": "^2.3.19",
"patch-package": "^6.4.7",
"standard-version": "^9.3.0",
"style-loader": "^2.0.0",
24 changes: 0 additions & 24 deletions patches/tesseract.js+2.1.4.patch
Original file line number Diff line number Diff line change
@@ -15,27 +15,3 @@ index 03f5663..da7d3ea 100644
} else if (typeof process === 'object' && typeof require === 'function') {
env.type = 'node';
}
diff --git a/node_modules/tesseract.js/src/utils/resolvePaths.js b/node_modules/tesseract.js/src/utils/resolvePaths.js
index 5aa2b74..c7b379e 100644
--- a/node_modules/tesseract.js/src/utils/resolvePaths.js
+++ b/node_modules/tesseract.js/src/utils/resolvePaths.js
@@ -3,6 +3,7 @@ const resolveURL = isBrowser ? require('resolve-url') : s => s; // eslint-disabl

module.exports = (options) => {
const opts = { ...options };
+
['corePath', 'workerPath', 'langPath'].forEach((key) => {
if (typeof options[key] !== 'undefined') {
opts[key] = resolveURL(opts[key]);
diff --git a/node_modules/tesseract.js/src/worker/node/spawnWorker.js b/node_modules/tesseract.js/src/worker/node/spawnWorker.js
index 2901948..a2147c4 100644
--- a/node_modules/tesseract.js/src/worker/node/spawnWorker.js
+++ b/node_modules/tesseract.js/src/worker/node/spawnWorker.js
@@ -11,5 +11,6 @@ let debugPort = 9229;
*/
module.exports = ({ workerPath }) => {
debugPort += 1;
- return fork(workerPath, { execArgv: [`--debug-port=${debugPort}`] });
+ return fork(workerPath);
+ // return fork(workerPath, { execArgv: [`--debug-port=${debugPort}`] });
};
Binary file added resources/win32/nircmd/NirCmd.chm
Binary file not shown.
Binary file added resources/win32/nircmd/nircmdc.exe
Binary file not shown.
13 changes: 13 additions & 0 deletions src/electron/main/main.ts
Original file line number Diff line number Diff line change
@@ -38,6 +38,19 @@ export class Main {
},
},
{ type: 'separator' },
{
label: 'Third-party licenses',
click() {
const licensesFileName = 'THIRD_PARTY_LICENSES.txt';
const licensesPath =
process.env.NODE_ENV === 'production'
? join('..', licensesFileName)
: licensesFileName;

shell.showItemInFolder(join(app.getAppPath(), licensesPath));
},
},
{ type: 'separator' },
{
label: 'Report bug',
click() {

0 comments on commit 61d153c

Please sign in to comment.