Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
refactor(cli): use node to read package version
Browse files Browse the repository at this point in the history
Node will natively parse a json file if it is passed into a require
statement. One less variable and function call. Also passes OS correct
path separators with the path.join call.
  • Loading branch information
eddiemonge authored and juliemr committed Jan 31, 2014
1 parent 11c4210 commit 0202576
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ try {

var util = require('util');
var path = require('path');
var fs = require('fs');
var runner = require('./runner.js');
var argv = require('optimist').
usage('Usage: protractor [options] [configFile]\n' +
Expand Down Expand Up @@ -63,8 +62,7 @@ var argv = require('optimist').
argv;

if (argv.version) {
util.puts('Version ' + JSON.parse(
fs.readFileSync(__dirname + '/../package.json', 'utf8')).version);
util.puts('Version ' + require(path.join(__dirname, '../package.json')).version);
process.exit(0);
}

Expand Down

0 comments on commit 0202576

Please sign in to comment.