-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(UI) Migration to new Electron building tool
electron-vite
- Loading branch information
Showing
34 changed files
with
5,039 additions
and
33,646 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
dist | ||
out | ||
.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* eslint-env node */ | ||
require("@rushstack/eslint-patch/modern-module-resolution"); | ||
|
||
module.exports = { | ||
extends: [ | ||
"eslint:recommended", | ||
"plugin:vue/vue3-recommended", | ||
"@electron-toolkit", | ||
//"@vue/eslint-config-prettier", | ||
], | ||
rules: { | ||
"vue/require-default-prop": "off", | ||
"vue/multi-word-component-names": "off", | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
out | ||
dist | ||
pnpm-lock.yaml | ||
LICENSE.md | ||
tsconfig.json | ||
tsconfig.*.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,39 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Electron: Main", | ||
"type": "node", | ||
"request": "launch", | ||
"protocol": "inspector", | ||
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron", | ||
"windows": { | ||
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd" | ||
}, | ||
"preLaunchTask": "electron-debug", | ||
"args": ["--remote-debugging-port=9223", "./dist_electron"], | ||
"outFiles": ["${workspaceFolder}/dist_electron/**/*.js"], | ||
"env": { | ||
"IS_DEBUG": "true" | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Debug Main Process", | ||
"type": "node", | ||
"request": "launch", | ||
"cwd": "${workspaceRoot}", | ||
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron-vite", | ||
"windows": { | ||
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron-vite.cmd" | ||
}, | ||
}, | ||
{ | ||
"name": "Electron: Renderer", | ||
"type": "chrome", | ||
"request": "attach", | ||
"port": 9223, | ||
"urlFilter": "http://localhost:*", | ||
"timeout": 30000, | ||
"webRoot": "${workspaceFolder}/src", | ||
"sourceMapPathOverrides": { | ||
"webpack:///./src/*": "${webRoot}/*" | ||
}, | ||
"runtimeArgs": ["--sourcemap"], | ||
"env": { | ||
"REMOTE_DEBUGGING_PORT": "9222" | ||
} | ||
}, | ||
{ | ||
"name": "Debug Renderer Process", | ||
"port": 9222, | ||
"request": "attach", | ||
"type": "chrome", | ||
"webRoot": "${workspaceFolder}/src/renderer", | ||
"timeout": 60000, | ||
"presentation": { | ||
"hidden": true | ||
} | ||
], | ||
"compounds": [ | ||
{ | ||
"name": "Electron: All", | ||
"configurations": ["Electron: Main", "Electron: Renderer"] | ||
} | ||
], | ||
"compounds": [ | ||
{ | ||
"name": "Debug All", | ||
"configurations": ["Debug Main Process", "Debug Renderer Process"], | ||
"presentation": { | ||
"order": 1 | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
exports.default = async function (context) { | ||
console.log (`afterPack hook triggered (${__filename})`); | ||
console.log (" - removing all locales except en-US"); | ||
var fs = require ('fs'); | ||
var localeDir = context.appOutDir+'/locales/'; | ||
|
||
fs.readdir (localeDir, function (err, files) { | ||
if (! (files && files.length)) return; | ||
for (var i = 0, len = files.length; i < len; i++) { | ||
var match = files[i].match(/en-US\.pak/); | ||
if (match === null) { | ||
fs.unlinkSync (localeDir+files [i]); | ||
} | ||
} | ||
}); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
module.exports = { | ||
files: [ | ||
"!**/.vscode/*", | ||
"!src/*", | ||
"!**/buildHooks/*", | ||
"!**/public/*", | ||
"!**/References/*", | ||
"!**/extraResources/*", | ||
"!{index.html,pre_build.js}", | ||
"!electron-builder.config.{js,ts,mjs,cjs}", | ||
"!electron.vite.config.{js,ts,mjs,cjs}", | ||
"!{.eslintignore,.eslintrc.cjs,.prettierignore,.prettierrc.yaml,dev-app-update.yml,CHANGELOG.md,README.md}", | ||
"!{.env,.env.*,.npmrc,pnpm-lock.yaml}", | ||
], | ||
|
||
afterPack: "buildHooks/afterPack.js", | ||
|
||
mac: { | ||
target: "dir", | ||
extendInfo: { | ||
LSUIElement: 1, | ||
SUPublicDSAKeyFile: "dsa_pub.pem", | ||
}, | ||
}, | ||
win: { | ||
target: "dir", | ||
//extraResources: [ | ||
// { | ||
// from: "public/tray/windows", | ||
// to: "tray/windows", | ||
// filter: ["**/*"], | ||
// }, | ||
//], | ||
}, | ||
linux: { | ||
target: ["dir"], | ||
category: "Network", | ||
}, | ||
snap: { | ||
confinement: "strict", | ||
autoStart: true, | ||
plugs: [ | ||
"default", | ||
{ | ||
port: { | ||
interface: "content", | ||
content: "file", | ||
target: "$SNAP_COMMON/opt/ivpn/mutable", | ||
}, | ||
}, | ||
], | ||
}, | ||
extraResources: [ | ||
{ | ||
from: "extraResources", | ||
filter: ["**/*"], | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { defineConfig, externalizeDepsPlugin } from 'electron-vite' | ||
import vue from '@vitejs/plugin-vue' | ||
import { resolve } from 'path' | ||
|
||
// https://electron-vite.org/config/ | ||
export default defineConfig({ | ||
//https://electron-vite.org/config/#built-in-config-for-main | ||
main: { | ||
plugins: [externalizeDepsPlugin()], | ||
build: { | ||
lib: { | ||
entry: resolve('./src/background.js'), | ||
}, | ||
}, | ||
resolve: { | ||
alias: { | ||
"@": resolve("src") | ||
}, | ||
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'] | ||
}, | ||
}, | ||
// https://electron-vite.org/config/#built-in-config-for-preload | ||
preload: { | ||
plugins: [externalizeDepsPlugin()], | ||
build: { | ||
lib: { | ||
entry: './src/preload.js', | ||
}, | ||
}, | ||
resolve: { | ||
alias: { | ||
"@": resolve("src") | ||
}, | ||
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'] | ||
}, | ||
}, | ||
// https://electron-vite.org/config/#built-in-config-for-renderer | ||
renderer: { | ||
plugins: [vue()], | ||
root: '.', | ||
build: { | ||
rollupOptions: { | ||
input: 'index.html' | ||
} | ||
}, | ||
resolve: { | ||
alias: { | ||
"@": resolve("src") | ||
}, | ||
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'] | ||
}, | ||
} | ||
}) |
Oops, something went wrong.