Sha256: 5657b82aff0ffa919682bdbb3a4858d664588d2a2790c0de990175f5a57f7e63
Contents?: true
Size: 1.44 KB
Versions: 7
Compression:
Stored size: 1.44 KB
Contents
var mout = require('mout'); var Project = require('../core/Project'); var cli = require('../util/cli'); var defaultConfig = require('../config'); function prune(logger, options, config) { var project; options = options || {}; config = defaultConfig(config); project = new Project(config, logger); return clean(project, options); } function clean(project, options, removed) { removed = removed || {}; // Continually call clean until there is no more extraneous // dependencies to remove return project.getTree(options) .spread(function (tree, flattened, extraneous) { var names = extraneous.map(function (extra) { return extra.endpoint.name; }); // Uninstall extraneous return project.uninstall(names, options) .then(function (uninstalled) { // Are we done? if (!mout.object.size(uninstalled)) { return removed; } // Not yet, recurse! mout.object.mixIn(removed, uninstalled); return clean(project, options, removed); }); }); } // ------------------- prune.line = function (logger, argv) { var options = prune.options(argv); return prune(logger, options); }; prune.options = function (argv) { return cli.readOptions({ 'production': { type: Boolean, shorthand: 'p' }, }, argv); }; prune.completion = function () { // TODO: }; module.exports = prune;
Version data entries
7 entries across 7 versions & 1 rubygems