Skip to content

Commit

Permalink
postinstall refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
ellman committed Sep 14, 2014
1 parent b50b3f7 commit f0ee0ac
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,9 @@ var install = exports.install = function(module, options) {
module = module.split('@');

var packageName = module[0];
var tag = module[1] || 'master';
var tag = 'master';

tag = tag === 'latest' ? 'master' : tag;

getPackage(packageName, function(data) {
console.log(chalk.green('Installing module: %s:'), module[0]);
Expand All @@ -645,25 +647,27 @@ var install = exports.install = function(module, options) {
shell.rm('-rf', destination + data.name + '/.git');
shell.rm('-rf', destination + data.name + '/.gitignore');

shell.cd(pkgPath);
// Load mean.json
packagesMeanJson(__dirname);

if (options.skipNpm) return;

// Load package.json
loadPackageJson(pkgPath+'/package.json', function(err, data) {
if (err) return console.error(err);

shell.exec('npm install .', function(code) {

if (code) return console.log(code);

// Load mean.json
packagesMeanJson(__dirname);

// Load package.json
loadPackageJson('./package.json', function(err, data) {
if (err) return console.error(err);

console.log();
if (!data.mean) {
console.log();
if (!data.mean) {
console.log();
console.log(chalk.yellow('Warning: The module installed is not a valid MEAN module'));
console.log(chalk.yellow('Warning: The module installed is not a valid MEAN module'));
}

npm.commands.install(pkgPath, [pkgPath], function(err) {
if (err) {
console.log(chalk.red('Error: npm install failed'));
return console.error(err);
} else {
console.log(chalk.green(' Dependencies installed for package ' + data.name));
}
});
});
Expand All @@ -681,13 +685,12 @@ exports.postinstall = function() {
console.log(chalk.red(err));
});


packagesNpmInstall('packages');
packagesNpmInstall('packages/custom');
packagesNpmInstall('packages/core');
packagesNpmInstall('packages/contrib');

// Load mean.json

var source = process.cwd();
packagesMeanJson(source);

Expand Down

0 comments on commit f0ee0ac

Please sign in to comment.