From 8b56af8738f7de4ec5f7cb5a5caaf72da8dbc9f1 Mon Sep 17 00:00:00 2001
From: AkiraFukushima
Date: Sat, 14 Jan 2023 11:19:04 +0900
Subject: [PATCH] Clean up build.js script
---
.electron-vue/build.js | 71 ++++++------------------------------------
1 file changed, 9 insertions(+), 62 deletions(-)
diff --git a/.electron-vue/build.js b/.electron-vue/build.js
index 65e61edb..385b506d 100644
--- a/.electron-vue/build.js
+++ b/.electron-vue/build.js
@@ -11,7 +11,6 @@ const Listr = require('listr')
const mainConfig = require('./webpack.main.config')
const rendererConfig = require('./webpack.renderer.config')
-const webConfig = require('./webpack.web.config')
const doneLog = chalk.bgGreen.white(' DONE ') + ' '
const errorLog = chalk.bgRed.white(' ERROR ') + ' '
@@ -19,7 +18,6 @@ const okayLog = chalk.bgBlue.white(' OKAY ') + ' '
const isCI = process.env.CI || false
if (process.env.BUILD_TARGET === 'clean') clean()
-else if (process.env.BUILD_TARGET === 'web') web()
else build()
function clean() {
@@ -30,8 +28,6 @@ function clean() {
}
async function build() {
- greeting()
-
del.sync(['dist/electron/*', '!.gitkeep'])
let results = ''
@@ -41,27 +37,19 @@ async function build() {
{
title: 'building master process',
task: async () => {
- await pack(mainConfig)
- .then(result => {
- results += result + '\n\n'
- })
- .catch(err => {
- console.log(`\n ${errorLog}failed to build main process`)
- console.error(`\n${err}\n`)
- })
+ await pack(mainConfig).catch(err => {
+ console.log(`\n ${errorLog}failed to build main process`)
+ console.error(`\n${err}\n`)
+ })
}
},
{
title: 'building renderer process',
task: async () => {
- await pack(rendererConfig)
- .then(result => {
- results += result + '\n\n'
- })
- .catch(err => {
- console.log(`\n ${errorLog}failed to build renderer process`)
- console.error(`\n${err}\n`)
- })
+ await pack(rendererConfig).catch(err => {
+ console.log(`\n ${errorLog}failed to build renderer process`)
+ console.error(`\n${err}\n`)
+ })
}
}
],
@@ -73,7 +61,6 @@ async function build() {
.then(() => {
process.stdout.write('\x1B[2J\x1B[0f')
console.log(`\n\n${results}`)
- console.log(`${okayLog}take it away ${chalk.yellow('`electron-builder`')}\n`)
process.exit()
})
.catch(err => {
@@ -101,48 +88,8 @@ function pack(config) {
reject(err)
} else {
- resolve(
- stats.toString({
- chunks: false,
- colors: true
- })
- )
+ resolve(null)
}
})
})
}
-
-function web() {
- del.sync(['dist/web/*', '!.gitkeep'])
- webConfig.mode = 'production'
- webpack(webConfig, (err, stats) => {
- if (err || stats.hasErrors()) console.log(err)
-
- console.log(
- stats.toString({
- chunks: false,
- colors: true
- })
- )
-
- process.exit()
- })
-}
-
-function greeting() {
- const cols = process.stdout.columns
- let text = ''
-
- if (cols > 85) text = 'lets-build'
- else if (cols > 60) text = 'lets-|build'
- else text = false
-
- if (text && !isCI) {
- say(text, {
- colors: ['yellow'],
- font: 'simple3d',
- space: false
- })
- } else console.log(chalk.yellow.bold('\n lets-build'))
- console.log()
-}