remove(v1.0.0) scripts
This commit is contained in:
parent
31f487d860
commit
a1bfdfba8d
|
@ -1,5 +0,0 @@
|
|||
import { build } from 'vite'
|
||||
|
||||
await build({ configFile: 'packages/main/vite.config.ts' })
|
||||
await build({ configFile: 'packages/preload/vite.config.ts' })
|
||||
await build({ configFile: 'packages/renderer/vite.config.ts' })
|
|
@ -1,70 +0,0 @@
|
|||
import { spawn } from 'child_process'
|
||||
import { createServer, build } from 'vite'
|
||||
import electron from 'electron'
|
||||
|
||||
const query = new URLSearchParams(import.meta.url.split('?')[1])
|
||||
const debug = query.has('debug')
|
||||
|
||||
/**
|
||||
* @type {(server: import('vite').ViteDevServer) => Promise<import('rollup').RollupWatcher>}
|
||||
*/
|
||||
function watchMain(server) {
|
||||
/**
|
||||
* @type {import('child_process').ChildProcessWithoutNullStreams | null}
|
||||
*/
|
||||
let electronProcess = null
|
||||
const address = server.httpServer.address()
|
||||
const env = Object.assign(process.env, {
|
||||
VITE_DEV_SERVER_HOST: address.address,
|
||||
VITE_DEV_SERVER_PORT: address.port,
|
||||
})
|
||||
/**
|
||||
* @type {import('vite').Plugin}
|
||||
*/
|
||||
const startElectron = {
|
||||
name: 'electron-main-watcher',
|
||||
writeBundle() {
|
||||
if (electronProcess) {
|
||||
electronProcess.removeAllListeners()
|
||||
electronProcess.kill()
|
||||
}
|
||||
electronProcess = spawn(electron, ['.'], { stdio: 'inherit', env })
|
||||
electronProcess.once('exit', process.exit)
|
||||
},
|
||||
}
|
||||
|
||||
return build({
|
||||
configFile: 'packages/main/vite.config.ts',
|
||||
mode: 'development',
|
||||
plugins: [!debug && startElectron].filter(Boolean),
|
||||
build: {
|
||||
watch: {},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {(server: import('vite').ViteDevServer) => Promise<import('rollup').RollupWatcher>}
|
||||
*/
|
||||
function watchPreload(server) {
|
||||
return build({
|
||||
configFile: 'packages/preload/vite.config.ts',
|
||||
mode: 'development',
|
||||
plugins: [{
|
||||
name: 'electron-preload-watcher',
|
||||
writeBundle() {
|
||||
server.ws.send({ type: 'full-reload' })
|
||||
},
|
||||
}],
|
||||
build: {
|
||||
watch: {},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// bootstrap
|
||||
const server = await createServer({ configFile: 'packages/renderer/vite.config.ts' })
|
||||
|
||||
await server.listen()
|
||||
await watchPreload(server)
|
||||
await watchMain(server)
|
Loading…
Reference in New Issue