From 191c02af1ebfc7e6c53dc88d97c4e3ca23fbea8b Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Wed, 26 Oct 2016 16:46:32 +0200 Subject: Basic skeleton --- build/build.js | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 build/build.js (limited to 'build/build.js') diff --git a/build/build.js b/build/build.js new file mode 100644 index 00000000..b3c9aad4 --- /dev/null +++ b/build/build.js @@ -0,0 +1,36 @@ +// https://github.com/shelljs/shelljs +require('./check-versions')() +require('shelljs/global') +env.NODE_ENV = 'production' + +var path = require('path') +var config = require('../config') +var ora = require('ora') +var webpack = require('webpack') +var webpackConfig = require('./webpack.prod.conf') + +console.log( + ' Tip:\n' + + ' Built files are meant to be served over an HTTP server.\n' + + ' Opening index.html over file:// won\'t work.\n' +) + +var spinner = ora('building for production...') +spinner.start() + +var assetsPath = path.join(config.build.assetsRoot, config.build.assetsSubDirectory) +rm('-rf', assetsPath) +mkdir('-p', assetsPath) +cp('-R', 'static/*', assetsPath) + +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') +}) -- cgit v1.2.3-70-g09d2