Implement full electron functionality

I have also structured the project so electron is fairly isolated.
master
kts of kettek (POWERQWACK) 2021-02-16 06:36:12 -08:00
parent 67cf9b5bf7
commit 488b7a5e27
6 changed files with 21 additions and 7 deletions

View File

@ -6,12 +6,13 @@ function createWindow() {
width: 800,
height: 600,
webPreferences: {
contextIsolation: true,
contextIsolation: false,
nodeIntegration: true,
},
});
if (process.env.NODE_ENV === 'production') {
win.loadFile('./build/index.html');
win.loadFile('./index.html');
} else {
win.loadURL('http://localhost:8080');
}

View File

@ -0,0 +1,3 @@
{
"main": "main.js"
}

9
app/package-lock.json generated
View File

@ -272,6 +272,15 @@
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
"dev": true
},
"cross-env": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz",
"integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==",
"dev": true,
"requires": {
"cross-spawn": "^7.0.1"
}
},
"cross-spawn": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",

View File

@ -1,18 +1,18 @@
{
"main": "electron.js",
"scripts": {
"start": "snowpack dev",
"build": "snowpack build",
"snowpack-dev": "snowpack dev --open none",
"electron-dev": "concurrently \"npm run snowpack-dev\" \"npm run electron-start\"",
"electron-start": "electron .",
"electron-prod": "cross-env NODE_ENV=production electron ."
"electron-start": "electron ./build",
"electron-prod": "cross-env NODE_ENV=production electron ./build"
},
"devDependencies": {
"@snowpack/plugin-svelte": "^3.5.2",
"@snowpack/plugin-typescript": "^1.2.1",
"@tsconfig/svelte": "^1.0.10",
"concurrently": "^5.3.0",
"cross-env": "^7.0.3",
"electron": "^11.2.3",
"snowpack": "^3.0.1",
"svelte-preprocess": "^4.6.9",

View File

@ -4,10 +4,10 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="Accord" />
<link rel="stylesheet" type="text/css" href="/index.css" />
<link rel="stylesheet" type="text/css" href="./index.css" />
<title>Accord</title>
</head>
<body>
<script type="module" src="/dist/index.js"></script>
<script type="module" src="./dist/index.js"></script>
</body>
</html>

View File

@ -4,6 +4,7 @@ module.exports = {
/* ... */
// 'build directory'
public: '/',
electron: '/',
src: '/dist',
},
plugins: [