Skip to content

Commit

Permalink
fix(cli): Fix local and global denali version
Browse files Browse the repository at this point in the history
  • Loading branch information
davewasmer committed Sep 27, 2016
1 parent bde7c1a commit e733ca2
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lib/cli/commands/root.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import path from 'path';
import resolve from 'resolve';
import ui from '../lib/ui';
import Command from '../lib/command';
import forIn from 'lodash/forIn';
import padEnd from 'lodash/padEnd';
import tryRequire from '../../utils/try-require';

export default class RootCommand extends Command {

Expand Down Expand Up @@ -30,8 +33,16 @@ export default class RootCommand extends Command {
}

printVersion() {
let pkg = require('./package.json');
ui.info(`denali: ${ pkg.dependencies.denali }`);
let localPkg;
try {
let localDir = resolve.sync('denali', { basedir: process.cwd() });
localPkg = require(path.join(localDir, '../package.json'));
} catch (e) { /* ignore failed lookups */ }
let globalPkg = require('../../../package.json');
if (localPkg) {
ui.info(`denali (local): ${ localPkg.version }`);
}
ui.info(`denali (global): ${ globalPkg.version }`);
ui.info(`node: ${ process.version }`);
}

Expand Down

0 comments on commit e733ca2

Please sign in to comment.