veendor
Version:
a tool for stroing your npm dependencies in arbitraty storage
49 lines (48 loc) • 1.89 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const lodash_1 = __importDefault(require("lodash"));
const helpers = __importStar(require("./helpers"));
const helpers_1 = require("./helpers");
function install(packages, timeoutDuration = 0) {
const args = ['install', '--no-save'];
lodash_1.default.forOwn(packages, (version, pkgname) => {
args.push(`${pkgname}@${version}`);
});
return helpers.getOutput('npm', args, {
timeoutDuration, stdout: helpers_1.StdioPolicy.copy, stderr: helpers_1.StdioPolicy.inherit
});
}
exports.install = install;
function installAll(timeoutDuration = 0) {
return helpers.getOutput('npm', ['install', '--no-save'], {
timeoutDuration, stdout: helpers_1.StdioPolicy.copy, stderr: helpers_1.StdioPolicy.inherit
});
}
exports.installAll = installAll;
function version() {
return helpers.getOutput('npm', ['--version']);
}
exports.version = version;
function uninstall(packages, timeoutDuration = 0) {
const args = ['uninstall'].concat(packages);
return helpers.getOutput('npm', args, {
timeoutDuration, stdout: helpers_1.StdioPolicy.copy, stderr: helpers_1.StdioPolicy.inherit
});
}
exports.uninstall = uninstall;
function dedupe(timeoutDuration = 0) {
return helpers.getOutput('npm', ['dedupe'], {
timeoutDuration, stdout: helpers_1.StdioPolicy.copy, stderr: helpers_1.StdioPolicy.inherit
});
}
exports.dedupe = dedupe;