mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 14:13:37 +08:00
webpack progress plugin
This commit is contained in:
parent
d46b790493
commit
9b1bbc855b
20
nico.js
20
nico.js
@ -1,13 +1,26 @@
|
||||
var path = require('path');
|
||||
var package = require('./package');
|
||||
var webpack = require('webpack');
|
||||
var ProgressPlugin = require('webpack/lib/ProgressPlugin');
|
||||
var inspect = require('util').inspect;
|
||||
var Busboy = require('busboy');
|
||||
var chalk = require('chalk');
|
||||
var webpackMiddleware = require('webpack-dev-middleware');
|
||||
var webpackConfig = require('./webpack.config');
|
||||
var webpackCompiler = webpack(webpackConfig);
|
||||
var handler;
|
||||
|
||||
webpackCompiler.apply(new ProgressPlugin(function(percentage, msg) {
|
||||
var stream = process.stderr;
|
||||
if (stream.isTTY && percentage < 0.71) {
|
||||
stream.cursorTo(0);
|
||||
stream.write('📦 ' + chalk.green(parseInt(percentage*100)+ '% ') + msg);
|
||||
stream.clearLine(1);
|
||||
} else if (percentage === 1) {
|
||||
console.log(chalk.green('\nwebpack: bundle build is now finished.'));
|
||||
}
|
||||
}));
|
||||
|
||||
// {{ settings for nico
|
||||
exports.site = {
|
||||
name: package.title,
|
||||
@ -72,12 +85,7 @@ exports.middlewares = [
|
||||
aggregateTimeout: 300,
|
||||
poll: true
|
||||
},
|
||||
stats: {
|
||||
hash: false,
|
||||
cached: false,
|
||||
cachedAssets: false,
|
||||
colors: true
|
||||
}
|
||||
quiet: true
|
||||
});
|
||||
try {
|
||||
return handler(req, res, next);
|
||||
|
@ -68,6 +68,8 @@
|
||||
"babel": "^5.8.12",
|
||||
"babel-core": "^5.8.12",
|
||||
"babel-loader": "^5.3.2",
|
||||
"busboy": "~0.2.9",
|
||||
"chalk": "~1.1.0",
|
||||
"css-animation": "~1.0.3",
|
||||
"css-loader": "^0.14.1",
|
||||
"eslint": "^1.1.0",
|
||||
@ -81,8 +83,7 @@
|
||||
"nico-jsx": "~0.5.8",
|
||||
"precommit-hook": "^1.0.7",
|
||||
"webpack": "^1.10.1",
|
||||
"webpack-dev-middleware": "^1.2.0",
|
||||
"busboy": "~0.2.9"
|
||||
"webpack-dev-middleware": "^1.2.0"
|
||||
},
|
||||
"scripts": {
|
||||
"babel": "babel components --out-dir lib",
|
||||
|
Loading…
Reference in New Issue
Block a user