forked from wangdahoo/vonic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.js
29 lines (24 loc) · 774 Bytes
/
build.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
process.env.NODE_ENV = 'production'
if (!process.env.BUILD) process.env.BUILD = 'publish'
var ora = require('ora')
var path = require('path')
var chalk = require('chalk')
var shell = require('shelljs')
var webpack = require('webpack')
var webpackConfig = require('./webpack.config')
var spinner = ora('building ' +
(process.env.BUILD == 'publish' ? 'vonic for production' : 'gh-pages') + '...')
spinner.start()
if (process.env.BUILD == 'publish') shell.rm('-rf', './dist')
webpack(webpackConfig, function (err, stats) {
spinner.stop()
if (err) throw err
process.stdout.write(stats.toString({
colors: true,
modules: false,
children: false,
chunks: false,
chunkModules: false
}) + '\n\n')
console.log(chalk.cyan(' Build complete.\n'))
})