diff --git a/index.js b/index.js index 444e0c4..dfa62ef 100755 --- a/index.js +++ b/index.js @@ -1,7 +1,19 @@ #!/usr/bin/env node 'use strict' -const config = require(require('path').resolve(process.cwd(), 'webpack.config.test-bed.js')) +const relativeConfigPath = require('yargs') + .option('c', { + alias: 'config', + demand: false, + default: 'webpack.config.test-bed.js', + describe: 'Specify the configuration file', + type: 'string' + }) + .nargs('config', 1) + .help() + .argv.config; + +const config = require(require('path').resolve(process.cwd(), relativeConfigPath)) const server = require('./createServer')(config) server.listen(9011, function () { diff --git a/package.json b/package.json index 716e360..08333d4 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,8 @@ "socket.io": "^1.4.6", "style-loader": "^0.13.1", "webpack-dev-middleware": "^1.6.1", - "webpack-hot-middleware": "^2.10.0" + "webpack-hot-middleware": "^2.10.0", + "yargs": "^5.0.0" }, "devDependencies": { "mocha": "^2.5.3",