del-nm
v4.0.1
Published
Delete `node_modules` and lockfiles
Downloads
5
Maintainers
Readme
del-nm
Delete
node_modules
and lockfiles
Useful to perform fresh installation of dependencies.
Installation
npm install --save del-nm
Usage
$ tree
.
├── bar
│ ├── node_modules
│ └── yarn.lock
└── foo
├── node_modules
└── package-lock.json
const delNm = require('del-nm');
delNm({ cwd: 'bar' }).then(paths => {
console.log(paths);
/*
[
'/Users/luftywiranda/bar/node_modules',
'/Users/luftywiranda/bar/yarn.lock'
]
*/
});
delNm({ cwd: 'foo' }).then(paths => {
console.log(paths);
/*
[
'/Users/luftywiranda/foo/node_modules',
'/Users/luftywiranda/foo/package-lock.json'
]
*/
});
delNm().then(paths => {
console.log(paths);
//=> []
});
API
delNm([options])
Returns Promise<Array>
of deleted paths.
options
Type: Object
cwd
Type: string
Default: process.cwd()
Current working directory.
lockfiles
Type: boolean
Default: true
Set this to false
to not delete lockfiles. Remember that npm-shrinkwrap.json
will also be deleted when this option is set to true
.
Related
- del-nm-cli - CLI for this module
- force-del - Force delete files or folders using glob patterns
- remove-lockfiles - Prevent committing lockfiles
License
MIT © Lufty Wiranda