Skip to content

Commit

Permalink
Print app version in the command line (#362)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxcnunes authored Oct 13, 2017
1 parent 7c87a38 commit 52595eb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/browser/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ exports.get = function getConfiguration(cleanCache) {
devMode: args.indexOf('--dev') !== -1,
};

if (args.indexOf('--version') !== -1 || args.indexOf('-v') !== -1) {
argsConfig.printVersion = true;
}

const basePath = path.resolve(__dirname, '..', '..');
const packageConfig = readJSON(path.resolve(basePath, 'package.json'));

Expand Down
9 changes: 8 additions & 1 deletion src/browser/main.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
/* eslint global-require:0, no-var: 0, no-extend-native: 0, vars-on-top: 0 */
var config = require('./config');

var configData = config.get();

if (configData.printVersion) {
console.log(configData.name, configData.version); // eslint-disable-line no-console
process.exit(0);
}

// enables ES6+ support
if (config.get().devMode) {
if (configData.devMode) {
require('babel-register');
}

Expand Down

0 comments on commit 52595eb

Please sign in to comment.