Fix: notifications (fix #88, fix #956), processEnvs, using as git (#955)

1. Fix (broken since 2016): Notifications broken by lambda constructor
2. Fix: `--processEnvs` broken by additional processEnvs object, the result was:
`processEnvs: {processEnvs: {...}}` which caused the conversion of the inner object into string `[object Object]`, no nesting allowed there probably. Compatibility introduced.
3. Fix: package.json missing `prepare` (or even prepublish), which breaks using as git dependency.
This commit is contained in:
Alexander Weps 2020-04-27 17:52:21 +02:00 committed by GitHub
parent 9ccda87938
commit 1d3bed5f09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 6 deletions

View File

@ -24,10 +24,15 @@ const fileDownloadOptions = { ...appArgs.fileDownloadOptions };
electronDownload(fileDownloadOptions); electronDownload(fileDownloadOptions);
if (appArgs.processEnvs) { if (appArgs.processEnvs) {
Object.keys(appArgs.processEnvs).forEach((key) => { // This is compatibility if just a string was passed.
/* eslint-env node */ if (typeof appArgs.processEnvs === 'string') {
process.env[key] = appArgs.processEnvs[key]; process.env.processEnvs = appArgs.processEnvs;
}); } else {
Object.keys(appArgs.processEnvs).forEach((key) => {
/* eslint-env node */
process.env[key] = appArgs.processEnvs[key];
});
}
} }
let mainWindow; let mainWindow;

View File

@ -22,7 +22,7 @@ const INJECT_JS_PATH = path.join(__dirname, '..', 'inject/inject.js');
*/ */
function setNotificationCallback(createCallback, clickCallback) { function setNotificationCallback(createCallback, clickCallback) {
const OldNotify = window.Notification; const OldNotify = window.Notification;
const newNotify = (title, opt) => { const newNotify = function (title, opt) {
createCallback(title, opt); createCallback(title, opt);
const instance = new OldNotify(title, opt); const instance = new OldNotify(title, opt);
instance.addEventListener('click', clickCallback); instance.addEventListener('click', clickCallback);

View File

@ -42,6 +42,7 @@
"lint:format": "prettier --write 'src/**/*.js' 'app/src/**/*.js'", "lint:format": "prettier --write 'src/**/*.js' 'app/src/**/*.js'",
"lint": "eslint . --ext .ts", "lint": "eslint . --ext .ts",
"list-outdated-deps": "npm out; cd app && npm out; true", "list-outdated-deps": "npm out; cd app && npm out; true",
"prepare": "cd ./app && npm install && cd .. && npm run build",
"test:integration": "jest --testRegex '.*integration-test.js'", "test:integration": "jest --testRegex '.*integration-test.js'",
"test:manual": "npm run build && ./docs/manual-test", "test:manual": "npm run build && ./docs/manual-test",
"test:unit": "jest", "test:unit": "jest",

View File

@ -52,7 +52,7 @@ function getProcessEnvs(val: string): any {
if (!val) { if (!val) {
return {}; return {};
} }
return { processEnvs: parseJson(val) }; return parseJson(val);
} }
function checkInternet(): void { function checkInternet(): void {