Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Replace multispinner with listr in build.js #971

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 46 additions & 29 deletions template/.electron-vue/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const packager = require('electron-packager')
const { spawn } = require('child_process')
{{/if_eq}}
const webpack = require('webpack')
const Multispinner = require('multispinner')
const Listr = require('listr')

{{#if_eq builder 'packager'}}const buildConfig = require('./build.config'){{/if_eq}}
const mainConfig = require('./webpack.main.config')
Expand All @@ -33,7 +33,7 @@ function clean () {
process.exit()
}

function build () {
async function build () {
greeting()

del.sync(['dist/electron/*', '!.gitkeep'])
Expand All @@ -46,32 +46,49 @@ function build () {

let results = ''

m.on('success', () => {
process.stdout.write('\x1B[2J\x1B[0f')
console.log(`\n\n${results}`)
console.log(`${okayLog}take it away ${chalk.yellow('`electron-{{builder}}`')}\n`)
{{#if_eq builder 'packager'}}bundleApp(){{else}}process.exit(){{/if_eq}}
})

pack(mainConfig).then(result => {
results += result + '\n\n'
m.success('main')
}).catch(err => {
m.error('main')
console.log(`\n ${errorLog}failed to build main process`)
console.error(`\n${err}\n`)
process.exit(1)
})

pack(rendererConfig).then(result => {
results += result + '\n\n'
m.success('renderer')
}).catch(err => {
m.error('renderer')
console.log(`\n ${errorLog}failed to build renderer process`)
console.error(`\n${err}\n`)
process.exit(1)
})
const tasks = new Listr(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

already has var named tasks
const tasks = ['main', 'renderer']

Copy link

@mel-florance mel-florance Jun 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes why a such mistake, alll the build pipeline is broken now.
How could this have been merged into master?

If we try to fix it and change its name, we get another error, like Multispinner is not declared.

Is there a fix for that?

Edit: Ok i proposed a fix right here #1090

[
{
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`)
})
}
},
{
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`)
})
}
}
],
{ concurrent: 2 }
)

await tasks
.run()
.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 => {
process.exit(1)
})
}

function pack (config) {
Expand Down Expand Up @@ -147,4 +164,4 @@ function greeting () {
})
} else console.log(chalk.yellow.bold('\n lets-build'))
console.log()
}
}
2 changes: 1 addition & 1 deletion template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
"karma-spec-reporter": "^0.0.32",
"karma-webpack": "^3.0.0",
{{/if}}
"listr": "^0.14.3",
{{#if e2e}}
"require-dir": "^1.0.0",
"spectron": "^3.8.0",
Expand All @@ -146,7 +147,6 @@
"chai": "^4.1.2",
"mocha": "^5.2.0",
{{/testing}}
"multispinner": "^0.2.1",
"node-loader": "^0.6.0",
{{#if usesass}}
"node-sass": "^4.9.2",
Expand Down