Skip to content

Commit

Permalink
Merge pull request #118 from fatadel/fix-electron
Browse files Browse the repository at this point in the history
  • Loading branch information
egekorkan authored Jun 28, 2022
2 parents 453e0cc + 0503475 commit dd633ca
Show file tree
Hide file tree
Showing 8 changed files with 4,574 additions and 6,897 deletions.
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
presets: [
'@vue/app'
'@vue/cli-plugin-babel/preset'
]
}
3 changes: 0 additions & 3 deletions electron-builder.yml

This file was deleted.

67 changes: 33 additions & 34 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"email": "[email protected]"
}
],
"version": "2.0.0",
"version": "2.0.1",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
Expand All @@ -44,46 +44,44 @@
"@node-wot/binding-websockets": "~0.8.1",
"@node-wot/core": "~0.8.1",
"ajv": "^8.11.0",
"coap": "^0.23.1",
"core-js": "^2.6.5",
"cors-anywhere": "^0.4.3",
"electron-json-storage": "^4.1.8",
"js-beautify": "^1.13.0",
"core-js": "^3.8.3",
"cors-anywhere": "^0.4.4",
"electron-json-storage": "^4.5.0",
"js-beautify": "^1.14.4",
"js-combinatorics": "^0.6.1",
"jsonld-streaming-parser": "^2.2.0",
"mermaid": "^8.7.0",
"monaco-editor": "^0.21.2",
"monaco-editor-webpack-plugin": "^2.0.0",
"jsonld-streaming-parser": "^2.4.3",
"mermaid": "8.9.1",
"monaco-editor": "^0.33.0",
"monaco-editor-webpack-plugin": "^7.0.1",
"n3": "^1.6.3",
"npm": "^6.14.5",
"rdfxml-streaming-parser": "^1.4.0",
"typescript": "^4.6.3",
"vue": "^2.6.10",
"vue-class-component": "^7.1.0",
"vue-property-decorator": "^8.3.0",
"vue-router": "^3.1.3",
"vuex": "^3.1.1",
"rdfxml-streaming-parser": "^1.5.0",
"ts-loader": "~8.2.0",
"vue": "^2.6.14",
"vue-router": "^3.5.1",
"vuex": "^3.6.2",
"vuex-electron-store": "^1.4.26"
},
"devDependencies": {
"@types/electron-devtools-installer": "^2.2.0",
"@types/js-beautify": "^1.13.1",
"@types/js-beautify": "^1.13.3",
"@types/js-combinatorics": "^0.5.32",
"@types/mermaid": "^8.2.1",
"@types/n3": "^1.4.4",
"@types/node": "^12.12.11",
"@types/request": "^2.48.5",
"@vue/cli-plugin-babel": "^3.12.1",
"@vue/cli-plugin-typescript": "^3.12.1",
"@vue/cli-service": "^3.12.1",
"@types/mermaid": "8.2.2",
"@types/n3": "1.4.4",
"@types/node": "^18.0.0",
"@types/request": "^2.48.8",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-router": "~5.0.0",
"@vue/cli-plugin-typescript": "~5.0.0",
"@vue/cli-plugin-vuex": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"electron": "^18.2.0",
"electron-devtools-installer": "^3.1.1",
"electron-icon-builder": "^1.0.2",
"less": "^3.10.3",
"less-loader": "^4.1.0",
"tslint": "^5.20.1",
"vue-cli-plugin-electron-builder": "^1.4.0",
"vue-template-compiler": "^2.6.10"
"electron-devtools-installer": "^3.1.0",
"less": "^4.0.0",
"less-loader": "^8.0.0",
"tslint": "^6.1.3",
"typescript": "~4.5.5",
"vue-cli-plugin-electron-builder": "~2.1.1",
"vue-template-compiler": "^2.6.14"
},
"postcss": {
"plugins": {
Expand All @@ -92,6 +90,7 @@
},
"browserslist": [
"> 1%",
"last 2 versions"
"last 2 versions",
"not dead"
]
}
21 changes: 1 addition & 20 deletions postinstall.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/**
* A simple script that comments out parts of node-dtls-client and json-placeholder-replacer.
* A simple script that comments out parts of node-dtls-client.
* Needed to make sure building wade does not fail.
*/

fs = require("fs");
const PATH_AEAD = "./node_modules/node-dtls-client/build/lib/AEADCrypto.js"
const PATH_REPLACER = "./node_modules/json-placeholder-replacer/dist/index.js"

// Commenting out lines in node-dtls-client
let lines = [""];
Expand All @@ -28,21 +27,3 @@ fs.writeFile(PATH_AEAD, text, function (err) {
if (err) return console.log(err)
else console.log("Written to file " + PATH_AEAD + " successfully");
});

// Removing shebang in json-placeholder-replacer (otherwise wade won't build)
try {
lines = fs.readFileSync(PATH_REPLACER).toString().split("\n");
console.log("Read file " + PATH_REPLACER + " successfully");
} catch (err) {
console.error(err);
return
}

if(lines[0].startsWith("#!")) lines.shift();
text = lines.join("\n");


fs.writeFile(PATH_REPLACER, text, function (err) {
if (err) return console.log(err)
else console.log("Written to file " + PATH_REPLACER + " successfully");
});
9 changes: 8 additions & 1 deletion src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@ function createWindow() {
minWidth: 800,
minHeight: 600,
autoHideMenuBar: true,
webPreferences: { nodeIntegration: true, webSecurity: false, contextIsolation: false },
webPreferences: {

// Use pluginOptions.nodeIntegration, leave this alone
// See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info
nodeIntegration: (process.env
.ELECTRON_NODE_INTEGRATION as unknown) as boolean,
contextIsolation: !process.env.ELECTRON_NODE_INTEGRATION
},
icon: path.join(__static, 'icon.png')
});
// win.setMenu(null);
Expand Down
3 changes: 3 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"experimentalDecorators": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"useDefineForClassFields": true,
"sourceMap": true,
"noImplicitAny": false,
"baseUrl": ".",
Expand Down
9 changes: 6 additions & 3 deletions vue.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
const { defineConfig } = require('@vue/cli-service')
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin')

module.exports = {
module.exports = defineConfig({
transpileDependencies: true,
pluginOptions: {
electronBuilder: {
nodeIntegration: true,
builderOptions: {
// options placed here will be merged with default configuration and passed to electron-builder
extraResources: ["example-tds", "./node_modules/virtual-thing"],
Expand All @@ -17,4 +20,4 @@ module.exports = {
})
]
}
};
})
Loading

0 comments on commit dd633ca

Please sign in to comment.