node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

autonpm

autonpm

Use npm in scripts without package.json

Install

npm install autonpm

API

var autonpm = require("../index.js");
 
autonpm("blahblahblah123")
    .then(null, function (error) {
        console.log(error)
    })
    .done();
 
autonpm("arrows")
    .then(function (module) {
        console.log(module._.compile("(x,y) => x + y")(1,2));
    })
    .done();
 

Apart from module name, you can pass a config object

  • config.where -- for an alternate location of node_modules folder
  • config.logger -- logging

Security

  • Be wary
  • if sudo is used, uid is set back to the original user so that malicious scripts don't go root