Skip to content

Commit

Permalink
chore: some log info
Browse files Browse the repository at this point in the history
  • Loading branch information
ArcherGu committed May 31, 2022
1 parent 8f8fcda commit 0390523
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions packages/builder/node/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ import { TAG } from './constants'
const logger = createLogger()

function exitMainProcess() {
logger.warn(TAG, 'Main Process Exit')
logger.warn(TAG, 'Main process exit')
process.exit(0)
}

function runMainProcess(mainFile: string, type: AppType = 'node') {
if (!fs.existsSync(mainFile))
throw new Error(`Main File Not Found: ${mainFile}`)
throw new Error(`Main file not found: ${mainFile}`)

logger.success(TAG, `⚡ Run Main File: ${path.basename(mainFile)}`)
logger.success(TAG, `⚡ Run main file: ${path.basename(mainFile)}`)
return spawn(type === 'electron' ? electron as any : 'node', [mainFile], { stdio: 'inherit' }).on('exit', exitMainProcess)
}

export async function dev(type: AppType) {
logger.info(TAG, `Mode: ${bgCyanBright('Development')}`)
logger.info(TAG, `Application Type: ${type === 'electron' ? bgCyan(' electron ') : bgGreen(' node ')}`)
logger.info(TAG, `Application type: ${type === 'electron' ? bgCyan(' electron ') : bgGreen(' node ')}`)

const config = await resolveConfig()
let child: ChildProcess
Expand Down Expand Up @@ -60,10 +60,10 @@ export async function dev(type: AppType) {
userOnRebuild?.(error, result)

if (error) {
logger.error(TAG, 'Rebuild Failed:', error)
logger.error(TAG, 'Rebuild failed:', error)
}
else {
logger.success(TAG, 'Rebuild Succeeded!')
logger.success(TAG, 'Rebuild succeeded!')
if (child) {
child.off('exit', exitMainProcess)
child.kill()
Expand Down
2 changes: 1 addition & 1 deletion packages/runner/node/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ async function doElectronBuild(buildConfig: ElectronBuildConfig | undefined) {
const logger = createLogger()
const startTime = performance.now()
try {
logger.info(`\n[${TAG}] electron-builder`, 'Start Electron build...\n')
logger.info(`\n[${TAG}] electron-builder`, 'Start electron build...\n')
await electronBuilder({
projectDir: buildConfig?.projectDir || process.cwd(),
config: buildConfig?.config,
Expand Down

0 comments on commit 0390523

Please sign in to comment.