diff --git a/nico.js b/nico.js index aa1b88ffb2..5ccd124f91 100644 --- a/nico.js +++ b/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); diff --git a/package.json b/package.json index 0311bd3697..f614b500be 100644 --- a/package.json +++ b/package.json @@ -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",