
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
npm-programmatic
Advanced tools
npm-programmatic is a library that allows you to access npm commands programmatically from javascript
Every function returns a Bluebird promise.
CWD refers to current working directory, allowing you to ensure the command executes in a certain folder in the filesystem.
If output is set, the output of npm will be shown in the console.
npm.install(packages, opts).then(function)
Name | Type | Value |
---|---|---|
packages | Array | packages to be installed |
opts | Object | save:true/false; global:true/false; cwd:string; saveDev:true/false; noOptional:true/false; legacyBundling: true/false; output:true/false |
var npm = require('npm-programmatic');
npm.install(['left-pad'], {
cwd:'/path/to/my/project',
save:true
})
.then(function(){
console.log("SUCCESS!!!");
})
.catch(function(){
console.log("Unable to install package");
});
npm.uninstall(packages, opts).then(function)
Name | Type | Value |
---|---|---|
packages | Array | packages to be uninstalled |
opts | Object | save:true/false; global:true/false; cwd:string; saveDev:true/false; output:true/false |
var npm = require('npm-programmatic');
npm.uninstall(['left-pad'], {
cwd:'/path/to/my/project',
save:true
})
.then(function(){
console.log("SUCCESS!!!");
})
.catch(function(){
console.log("Unable to uninstall package");
});
npm.list(path).then(function)
Name | Type | Value |
---|---|---|
path | String | path at which to look |
var npm = require('npm-programmatic');
npm.list('/path/to/project')
.then(function(arrayOfPackages){
console.log(arrayOfPackages);
})
.catch(function(){
console.log("Unable to uninstall package");
});
install mocha and dev dependencies. Then run
npm test
FAQs
Use NPM commands programmatically
The npm package npm-programmatic receives a total of 1,237 weekly downloads. As such, npm-programmatic popularity was classified as popular.
We found that npm-programmatic demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.