tiptap/build/examples/build.js

25 lines
561 B
JavaScript
Raw Normal View History

2018-08-22 15:14:49 +08:00
import ora from 'ora'
import webpack from 'webpack'
2018-08-22 16:01:51 +08:00
import config from './webpack.config'
2018-08-22 15:14:49 +08:00
const spinner = ora('Building …')
export default new Promise((resolve, reject) => {
2018-11-09 05:03:10 +08:00
spinner.start()
2018-08-22 15:14:49 +08:00
2018-11-09 05:03:10 +08:00
webpack(config, (error, stats) => {
if (error) {
return reject(error)
}
2018-08-22 15:14:49 +08:00
2018-11-09 05:03:10 +08:00
if (stats.hasErrors()) {
process.stdout.write(stats.toString() + "\n");
return reject(new Error('Build failed with errors.'))
}
2018-08-22 15:14:49 +08:00
2018-11-09 05:03:10 +08:00
return resolve('Build complete.')
})
2018-08-22 15:14:49 +08:00
})
.then(success => spinner.succeed(success))
.catch(error => spinner.fail(error))