ducky/web
2015-05-31
Parent:99a43a6d1d30
ducky/web/bin/dev-server
Update our ValidationError component to accept arrays. Allow our ValidationError component to match an array of fields, headers, or params. This is for components that may address multiple inputs (e.g., month/year inputs) but also lays the ground work for inverse-matching. Ideally, inverse-matching and matching ValidationErrors should mirror each other, logically, so the syntax is identical. But we also should have the common use case easily supported, so if you use field instead of fields (or header/headers, param/params) we'll automatically turn that into an array.
1 #!/usr/bin/env node
3 var fs = require('fs')
4 var path = require('path')
5 var webpack = require('webpack')
6 var WebpackDevServer = require('webpack-dev-server')
7 var argv = require('minimist')(process.argv.slice(2))
8 var findRoot = require('find-root')
9 var rootFolder = findRoot(process.env.PWD)
11 var configfile = '';
13 // get config
14 if (argv.config) {
15 configfile = path.resolve(argv.config)
16 } else {
17 configfile = path.resolve(path.join(rootFolder, 'webpack.config.js'))
18 }
19 argv.config = require(configfile);
21 // run it
22 new WebpackDevServer(webpack(argv.config), {
23 historyApiFallback: true,
24 hot: true,
25 publicPath: argv.config.output.publicPath,
26 }).listen(argv.config.port, argv.config.host, function (err, result) {
27 if (err) {
28 console.log(err)
29 }
30 console.log('development server running at: http://' + argv.config.host + ':' + argv.config.port)
31 })