https://github.com/luftywiranda13/del-nm
Delete `node_modules` and lockfiles
https://github.com/luftywiranda13/del-nm
cleanup delete dependencies lockfile npm yarn
Last synced: 26 days ago
JSON representation
Delete `node_modules` and lockfiles
- Host: GitHub
- URL: https://github.com/luftywiranda13/del-nm
- Owner: luftywiranda13
- License: mit
- Created: 2017-09-13T15:11:00.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-06-03T09:18:26.000Z (about 6 years ago)
- Last Synced: 2025-10-02T08:45:03.348Z (8 months ago)
- Topics: cleanup, delete, dependencies, lockfile, npm, yarn
- Language: JavaScript
- Homepage:
- Size: 106 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# del-nm
> Delete `node_modules` and lockfiles
[](https://www.npmjs.com/package/del-nm)
[](https://npm-stat.com/charts.html?package=del-nm&from=2016-04-01)
[](https://travis-ci.org/luftywiranda13/del-nm)
[](https://codecov.io/gh/luftywiranda13/del-nm)
Useful to perform fresh installation of dependencies.
## Installation
```sh
npm install --save del-nm
```
## Usage
```sh
$ tree
.
├── bar
│ ├── node_modules
│ └── yarn.lock
└── foo
├── node_modules
└── package-lock.json
```
```js
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` 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](https://github.com/luftywiranda13/del-nm-cli) - CLI for this module
* [force-del](https://github.com/luftywiranda13/force-del) - Force delete files or folders using glob patterns
* [remove-lockfiles](https://github.com/luftywiranda13/remove-lockfiles) - Prevent committing lockfiles
## License
MIT © [Lufty Wiranda](https://www.luftywiranda.com)