refactor: upgrade deps, setup tailwind4 and correct ci (#258)
* refresh * e2e test * Change debugger type from 'pwa-chrome' to 'chrome' * ci: align workflows with electron-vite-vue#540 * chore: update test, tsconfig and deps * chore: update deps and debug config * chore: refresh style * docs: update readme * docs: make linter happy * ci: bump versions * chore: refactor update handling and improve UI elements * 1.0.0
This commit is contained in:
39 files changed
+855
-916
No files matched your search
+20
-28
@@ -2,9 +2,15 @@ import { rmSync } from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import { defineConfig } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import electron from 'vite-plugin-electron/simple'
|
||||
import tailwindcss from '@tailwindcss/vite'
|
||||
import { electronSimple } from 'vite-plugin-electron/multi-env'
|
||||
import { notBundle } from 'vite-plugin-electron/plugin'
|
||||
import pkg from './package.json'
|
||||
|
||||
const external = Object.keys(
|
||||
'dependencies' in pkg ? (pkg.dependencies as Record<string, string>) : {},
|
||||
)
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig(({ command }) => {
|
||||
rmSync('dist-electron', { recursive: true, force: true })
|
||||
@@ -16,44 +22,37 @@ export default defineConfig(({ command }) => {
|
||||
return {
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.join(__dirname, 'src')
|
||||
'@': path.join(__dirname, 'src'),
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
react(),
|
||||
electron({
|
||||
tailwindcss(),
|
||||
electronSimple({
|
||||
main: {
|
||||
// Shortcut of `build.lib.entry`
|
||||
entry: 'electron/main/index.ts',
|
||||
onstart(args) {
|
||||
if (process.env.VSCODE_DEBUG) {
|
||||
console.log(/* For `.vscode/.debug.script.mjs` */'[startup] Electron App')
|
||||
} else {
|
||||
args.startup()
|
||||
}
|
||||
},
|
||||
vite: {
|
||||
input: 'electron/main/index.ts',
|
||||
plugins: [notBundle()],
|
||||
options: {
|
||||
build: {
|
||||
sourcemap,
|
||||
minify: isBuild,
|
||||
outDir: 'dist-electron/main',
|
||||
rollupOptions: {
|
||||
external: Object.keys('dependencies' in pkg ? pkg.dependencies : {}),
|
||||
rolldownOptions: {
|
||||
external,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
preload: {
|
||||
// Shortcut of `build.rollupOptions.input`.
|
||||
// Preload scripts may contain Web assets, so use the `build.rollupOptions.input` instead `build.lib.entry`.
|
||||
input: 'electron/preload/index.ts',
|
||||
vite: {
|
||||
plugins: [notBundle()],
|
||||
options: {
|
||||
build: {
|
||||
sourcemap: sourcemap ? 'inline' : undefined, // #332
|
||||
minify: isBuild,
|
||||
outDir: 'dist-electron/preload',
|
||||
rollupOptions: {
|
||||
external: Object.keys('dependencies' in pkg ? pkg.dependencies : {}),
|
||||
rolldownOptions: {
|
||||
external,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -61,16 +60,9 @@ export default defineConfig(({ command }) => {
|
||||
// Polyfill the Electron and Node.js API for Renderer process.
|
||||
// If you want use Node.js in Renderer process, the `nodeIntegration` needs to be enabled in the Main process.
|
||||
// See 👉 https://github.com/electron-vite/vite-plugin-electron-renderer
|
||||
renderer: {},
|
||||
// renderer: {},
|
||||
}),
|
||||
],
|
||||
server: process.env.VSCODE_DEBUG && (() => {
|
||||
const url = new URL(pkg.debug.env.VITE_DEV_SERVER_URL)
|
||||
return {
|
||||
host: url.hostname,
|
||||
port: +url.port,
|
||||
}
|
||||
})(),
|
||||
clearScreen: false,
|
||||
}
|
||||
})
|
||||
Reference in new issue
Block a user