rm-local-modules

0.0.2 • Public • Published

rm-local-modules

Build Status

Removes your locally installed modules.

Use case:

  • Make sure you always have latest version of your locally installed modules using it in preinstall. Example. There is a caveat though, as npm@3 preinstall is broken. Works fine with npm@2

CLI Options

-verbose, -v: outputs which modules where detected and if they were successfully removed:

Tried to remove 2 local module(s):
local ✔
sublocal ✔

-dir, -d <path>: the path were to run the tool, defaults to current dir.

Programmatically

var rmLocalModules = require('.');
 
var opts = {
  log: console.log.bind(console), // optional
  dir: '.', // mandatory
};
 
rmLocalModules(opts).then(function(results){
  // results is like [
  //   {name: 'local', success: true},
  //   {name: 'local', success: false, error: ... }
  // ]
});

Example

// package.json
{
  // ...
  "scripts": {
    "preinstall": "rm-local-modules"
  },
  "dependencies": {
    "local": "file:local",
    "sublocal": "file:sub/local"
  },
  "devDependencies": {
    "rm-local-modules": "^0.0.0"
  }
}

Readme

Keywords

Package Sidebar

Install

npm i rm-local-modules

Weekly Downloads

105

Version

0.0.2

License

MIT

Last publish

Collaborators

  • arnaudrinquin