mirror of
https://github.com/alex8088/electron-vite.git
synced 2025-11-09 22:16:01 +08:00
chore: improve logging message clarity and consistency
This commit is contained in:
parent
88f6db2239
commit
2576484604
@ -13,5 +13,5 @@ export async function preview(inlineConfig: InlineConfig = {}, options: { skipBu
|
||||
|
||||
startElectron(inlineConfig.root)
|
||||
|
||||
logger.info(colors.green(`\nstart electron app...\n`))
|
||||
logger.info(colors.green(`\nstarting electron app...\n`))
|
||||
}
|
||||
|
||||
@ -31,22 +31,20 @@ export async function createServer(
|
||||
const mainViteConfig = config.config?.main
|
||||
if (mainViteConfig && !options.rendererOnly) {
|
||||
const watchHook = (): void => {
|
||||
logger.info(colors.green(`\nrebuild the electron main process successfully`))
|
||||
logger.info(colors.green(`\nelectron main process rebuilt successfully`))
|
||||
|
||||
if (ps) {
|
||||
logger.info(colors.cyan(`\n waiting for electron to exit...`))
|
||||
|
||||
ps.removeAllListeners()
|
||||
ps.kill()
|
||||
ps = startElectron(inlineConfig.root)
|
||||
|
||||
logger.info(colors.green(`\nrestart electron app...`))
|
||||
logger.info(colors.green(`\nrestarting electron app...\n`))
|
||||
}
|
||||
}
|
||||
|
||||
await doBuild(mainViteConfig, watchHook, errorHook)
|
||||
|
||||
logger.info(colors.green(`\nbuild the electron main process successfully`))
|
||||
logger.info(colors.green(`\nelectron main process built successfully`))
|
||||
}
|
||||
|
||||
const preloadViteConfig = config.config?.preload
|
||||
@ -54,10 +52,10 @@ export async function createServer(
|
||||
logger.info(colors.gray(`\n-----\n`))
|
||||
|
||||
const watchHook = (): void => {
|
||||
logger.info(colors.green(`\nrebuild the electron preload files successfully`))
|
||||
logger.info(colors.green(`\nelectron preload scripts rebuilt successfully`))
|
||||
|
||||
if (server) {
|
||||
logger.info(colors.cyan(`\n trigger renderer reload`))
|
||||
logger.info(colors.cyan(`\nreloading electron renderer...\n`))
|
||||
|
||||
server.ws.send({ type: 'full-reload' })
|
||||
}
|
||||
@ -65,14 +63,12 @@ export async function createServer(
|
||||
|
||||
await doBuild(preloadViteConfig, watchHook, errorHook)
|
||||
|
||||
logger.info(colors.green(`\nbuild the electron preload files successfully`))
|
||||
logger.info(colors.green(`\nelectron preload scripts built successfully`))
|
||||
}
|
||||
|
||||
if (options.rendererOnly) {
|
||||
logger.warn(
|
||||
`\n${colors.yellow(colors.bold('warn'))}:${colors.yellow(
|
||||
' you have skipped the main process and preload scripts building'
|
||||
)}`
|
||||
`\n${colors.yellow(colors.bold('(!)'))} ${colors.yellow('skipped building main process and preload scripts (using previous build)')}`
|
||||
)
|
||||
}
|
||||
|
||||
@ -106,7 +102,7 @@ export async function createServer(
|
||||
|
||||
ps = startElectron(inlineConfig.root)
|
||||
|
||||
logger.info(colors.green(`\nstart electron app...\n`))
|
||||
logger.info(colors.green(`\nstarting electron app...\n`))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user