tunnckoCore/npm-add-engines

View on GitHub
README.md

Summary

Maintainability
Test Coverage
# npm-add-engines [![NPM version](https://img.shields.io/npm/v/npm-add-engines.svg?style=flat)](https://www.npmjs.com/package/npm-add-engines) [![NPM downloads](https://img.shields.io/npm/dm/npm-add-engines.svg?style=flat)](https://npmjs.org/package/npm-add-engines) [![npm total downloads][downloads-img]][downloads-url]

> Add engines field to your package.json file in current working directory or user-defined directory

[![code climate][codeclimate-img]][codeclimate-url] 
[![standard code style][standard-img]][standard-url] 
[![linux build status][travis-img]][travis-url] 
[![windows build status][appveyor-img]][appveyor-url] 
[![coverage status][coveralls-img]][coveralls-url] 
[![dependency status][david-img]][david-url]

You might also be interested in [github-clone-labels](https://github.com/tunnckocore/github-clone-labels#readme).

## Table of Contents
- [Install](#install)
- [Usage](#usage)
- [CLI](#cli)
- [API](#api)
  * [npmAddEngines](#npmaddengines)
- [Related](#related)
- [Contributing](#contributing)
- [Building docs](#building-docs)
- [Running tests](#running-tests)
- [Author](#author)
- [License](#license)

_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_

## Install
Install with [npm](https://www.npmjs.com/)

```
$ npm install npm-add-engines --global
```

or install using [yarn](https://yarnpkg.com)

```
$ yarn global add npm-add-engines
```

## Usage
> For more use-cases see the [tests](test.js)

```js
const npmAddEngines = require('npm-add-engines')
```

## CLI
> Just run `npm-add-engines` in the terminal

```
$ npm-add-engines
Successfully updated!
Path: /home/charlike/code/path/to/your/module/package.json
```

## API

### [npmAddEngines](index.js#L38)
> Update `package.json` file of `dir` or current working directory, using [load-pkg][] behind.

**Params**

* `[dir]` **{String|Function}**: optional, can be `cb`    
* `<cb>` **{Function}**: required, callback function    

**Example**

```js
const add = require('npm-add-engines')

add((err, pkg) => {
  console.log(err) // => if error
  console.log(pkg.engines) // => { node: '>=4', npm: '>=2' }
})

add('~/foo/bar/dir', (err, pkg) => {
  console.log(err) // => if error
  console.log(pkg.name) // => my-foo-pkg
  console.log(pkg.engines) // => { node: '>=4', npm: '>=2' }
})
```

## Related
- [create-readdir-stream](https://www.npmjs.com/package/create-readdir-stream): Streaming `fs.readdir`, extensible with smart plugins. No recursion and no globs by default - [use][] plugins. Does not stat and… [more](https://github.com/tunnckocore/create-readdir-stream#readme) | [homepage](https://github.com/tunnckocore/create-readdir-stream#readme "Streaming `fs.readdir`, extensible with smart plugins. No recursion and no globs by default - [use][] plugins. Does not stat and doesn't read the filepaths - use plugins. It just push [vinyl][] files to stream. Follows signature and semantics of `fs.creat")
- [function-arguments](https://www.npmjs.com/package/function-arguments): Get arguments of a function, useful for and used in dependency injectors. Works for regular functions, generator functions and arrow… [more](https://github.com/tunnckocore/function-arguments#readme) | [homepage](https://github.com/tunnckocore/function-arguments#readme "Get arguments of a function, useful for and used in dependency injectors. Works for regular functions, generator functions and arrow functions.")
- [gruu](https://www.npmjs.com/package/gruu): Modern, small and powerful testing with TAP output and support for async/await, promises, callbacks, streams and observables, built on [always-done][]. | [homepage](https://github.com/tunnckocore/gruu#readme "Modern, small and powerful testing with TAP output and support for async/await, promises, callbacks, streams and observables, built on [always-done][].")
- [is-async-function](https://www.npmjs.com/package/is-async-function): Is function really asynchronous function? Trying to guess that based on check if [common-callback-names][] exists as function arguments names or… [more](https://github.com/tunnckocore/is-async-function#readme) | [homepage](https://github.com/tunnckocore/is-async-function#readme "Is function really asynchronous function? Trying to guess that based on check if [common-callback-names][] exists as function arguments names or you can pass your custom.")
- [minibase](https://www.npmjs.com/package/minibase): Minimalist alternative for Base. Build complex APIs with small units called plugins. Works well with most of the already existing… [more](https://github.com/node-minibase/minibase#readme) | [homepage](https://github.com/node-minibase/minibase#readme "Minimalist alternative for Base. Build complex APIs with small units called plugins. Works well with most of the already existing [base][] plugins.")
- [npm-pkgs](https://www.npmjs.com/package/npm-pkgs): List user npm packages from the [npmjs.com](http://npm.im)! | [homepage](https://github.com/tunnckoCore/npm-pkgs "List user npm packages from the [npmjs.com](http://npm.im)!")

## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/tunnckoCore/npm-add-engines/issues/new).  
Please read the [contributing guidelines](CONTRIBUTING.md) for advice on opening issues, pull requests, and coding standards.  
If you need some help and can spent some cash, feel free to [contact me at CodeMentor.io](https://www.codementor.io/tunnckocore?utm_source=github&utm_medium=button&utm_term=tunnckocore&utm_campaign=github) too.

**In short:** If you want to contribute to that project, please follow these things

1. Please DO NOT edit [README.md](README.md), [CHANGELOG.md](CHANGELOG.md) and [.verb.md](.verb.md) files. See ["Building docs"](#building-docs) section.
2. Ensure anything is okey by installing the dependencies and run the tests. See ["Running tests"](#running-tests) section.
3. Always use `npm run commit` to commit changes instead of `git commit`, because it is interactive and user-friendly. It uses [commitizen][] behind the scenes, which follows Conventional Changelog idealogy.
4. Do NOT bump the version in package.json. For that we use `npm run release`, which is [standard-version][] and follows Conventional Changelog idealogy.

Thanks a lot! :)

## Building docs
Documentation and that readme is generated using [verb-generate-readme][], which is a [verb][] generator, so you need to install both of them and then run `verb` command like that

```
$ npm install verbose/verb#dev verb-generate-readme --global && verb
```

_Please don't edit the README directly. Any changes to the readme must be made in [.verb.md](.verb.md)._

## Running tests
Clone repository and run the following in that cloned directory

```
$ npm install && npm test
```

## Author
**Charlike Mike Reagent**

+ [github/tunnckoCore](https://github.com/tunnckoCore)
+ [twitter/tunnckoCore](http://twitter.com/tunnckoCore)
+ [codementor/tunnckoCore](https://codementor.io/tunnckoCore)

## License
Copyright © 2016, [Charlike Mike Reagent](http://i.am.charlike.online). Released under the [MIT license](LICENSE).

***

_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.2.0, on December 11, 2016._  
_Project scaffolded using [charlike][] cli._

[always-done]: https://github.com/hybridables/always-done
[base]: https://github.com/node-base/base
[charlike]: https://github.com/tunnckocore/charlike
[commitizen]: https://github.com/commitizen/cz-cli
[common-callback-names]: https://github.com/tunnckocore/common-callback-names
[load-pkg]: https://github.com/jonschlinkert/load-pkg
[standard-version]: https://github.com/conventional-changelog/standard-version
[use]: https://github.com/jonschlinkert/use
[verb-generate-readme]: https://github.com/verbose/verb-generate-readme
[verb]: https://github.com/verbose/verb
[vinyl]: https://github.com/gulpjs/vinyl

[downloads-url]: https://www.npmjs.com/package/npm-add-engines
[downloads-img]: https://img.shields.io/npm/dt/npm-add-engines.svg

[codeclimate-url]: https://codeclimate.com/github/tunnckoCore/npm-add-engines
[codeclimate-img]: https://img.shields.io/codeclimate/github/tunnckoCore/npm-add-engines.svg

[travis-url]: https://travis-ci.org/tunnckoCore/npm-add-engines
[travis-img]: https://img.shields.io/travis/tunnckoCore/npm-add-engines/master.svg?label=linux

[appveyor-url]: https://ci.appveyor.com/project/tunnckoCore/npm-add-engines
[appveyor-img]: https://img.shields.io/appveyor/ci/tunnckoCore/npm-add-engines/master.svg?label=windows

[coveralls-url]: https://coveralls.io/r/tunnckoCore/npm-add-engines
[coveralls-img]: https://img.shields.io/coveralls/tunnckoCore/npm-add-engines.svg

[david-url]: https://david-dm.org/tunnckoCore/npm-add-engines
[david-img]: https://img.shields.io/david/tunnckoCore/npm-add-engines.svg

[standard-url]: https://github.com/feross/standard
[standard-img]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg