Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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: about 5 hours ago
JSON representation

Delete `node_modules` and lockfiles

Awesome Lists containing this project

README

        

# del-nm

> Delete `node_modules` and lockfiles

[![Package Version](https://img.shields.io/npm/v/del-nm.svg?style=flat-square)](https://www.npmjs.com/package/del-nm)
[![Downloads Status](https://img.shields.io/npm/dm/del-nm.svg?style=flat-square)](https://npm-stat.com/charts.html?package=del-nm&from=2016-04-01)
[![Build Status: Linux](https://img.shields.io/travis/luftywiranda13/del-nm/master.svg?style=flat-square)](https://travis-ci.org/luftywiranda13/del-nm)
[![Coverage Status](https://img.shields.io/codecov/c/github/luftywiranda13/del-nm/master.svg?style=flat-square)](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)