diff --git a/lib/cli.js b/lib/cli.js index e7d57e89..f6afcc82 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -653,6 +653,10 @@ var install = exports.install = function(module, options) { 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); @@ -669,25 +673,8 @@ var install = exports.install = function(module, options) { }); }; -exports.preinstall = function() { - - requiresRoot(function() { - loadPackageJson('./mean.json', function(err, data) { - - if (err || !data) return; - - for (var dep in data.dependencies) { - - install(dep + '@' + data.dependencies[dep], { - skipNpm: true - }); - } - }); - }); -}; exports.postinstall = function() { - requiresRoot(function() { console.log(chalk.green('Installing Bower depenedencies')); require('bower').commands.install().on('error', function(err) { @@ -698,6 +685,12 @@ exports.postinstall = function() { packagesNpmInstall('packages/custom'); packagesNpmInstall('packages/core'); packagesNpmInstall('packages/contrib'); + + // Load mean.json + + var source = process.cwd(); + packagesMeanJson(source); + }); }; @@ -714,6 +707,9 @@ function packagesNpmInstall(source) { files.forEach(function(file) { var pkgPath = path.join(packages, file); + + packagesMeanJson(pkgPath); + loadPackageJson(path.join(pkgPath, 'package.json'), function(err, data) { if (err || !data.mean) return; @@ -731,6 +727,20 @@ function packagesNpmInstall(source) { }); } +function packagesMeanJson(source) { + // Load mean.json + loadPackageJson(path.join(source, 'mean.json'), function(err, data) { + if (err || !data) return; + + for (var dep in data.dependencies) { + install(dep + '@' + data.dependencies[dep], { + skipNpm: false + }); + } + }); + +} + exports.uninstall = function(module) { requiresRoot(function() { console.log(chalk.yellow('Removing module:'), module); diff --git a/package.json b/package.json index de054b8a..0725cb5a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meanio", - "version": "0.5.27", + "version": "0.5.28", "preferGlobal": true, "description": "Simple command line interface for installing and managing MEAN apps", "author": {