Skip to content

Commit

Permalink
Now we are printing better NPM logs.
Browse files Browse the repository at this point in the history
related to: #5
  • Loading branch information
arunoda committed Aug 3, 2016
1 parent b80ab9a commit b28466d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/helpers.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
var path = require('path');
var fs = require('fs');
var chalk = require('chalk');
var sh = require('shelljs');
var logger = console;
var spawnSync = require('spawn-sync');

exports.getPackageJson = function getPackageJson() {
var packageJsonPath = path.resolve('package.json');
Expand Down Expand Up @@ -87,9 +87,12 @@ exports.codeLog = function codeLog(codeLines, leftPadAmount) {
};

exports.installNpmDeps = function () {
var done = exports.commandLog('Installing NPM dependencies');
var result = sh.exec('npm install', { silent: true });
if (result.code !== 0) {
var done = exports.commandLog('Preparing to install NPM dependencies');
done();

var result = spawnSync('npm', ['install'], { stdio: 'inherit' });
done = exports.commandLog('Installing NPM dependencies');
if (result.status !== 0) {
done('An error occured while running `npm install`.', result.stderr);
process.exit(1);
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"commander": "^2.9.0",
"merge-dirs": "^0.2.1",
"shelljs": "^0.7.3",
"spawn-sync": "^1.0.15",
"update-notifier": "^1.0.2"
},
"devDependencies": {
Expand Down

0 comments on commit b28466d

Please sign in to comment.