Skip to content

Commit 142ad9d

Browse files
kentendosokra
authored andcommitted
Adding option ( -v or --version ) to print version. (webpack#2935)
1 parent f5d9a09 commit 142ad9d

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

bin/config-yargs.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ module.exports = function(yargs) {
2222
describe: "Enviroment passed to the config, when it is a function",
2323
group: CONFIG_GROUP
2424
},
25+
"version": {
26+
type: "string",
27+
describe: "Webpack version",
28+
alias: "v",
29+
group: BASIC_GROUP,
30+
},
2531
"context": {
2632
type: "string",
2733
describe: "The root directory for resolving entry point and stats",

bin/convert-argv.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@ module.exports = function(optimist, argv, convertOptions) {
1212
// Help
1313
if(argv.help) {
1414
optimist.showHelp();
15-
process.exit(-1); // eslint-disable-line
15+
process.exit(0); // eslint-disable-line
16+
}
17+
18+
// Version
19+
if(argv.v || argv.version) {
20+
console.log(require("../package.json").version);
21+
process.exit(0); // eslint-disable-line
1622
}
1723

1824
// Shortcuts

0 commit comments

Comments
 (0)