# npm-add-script

> Programmatically add entries to yr package.json scripts!

Latest version **1.1.0** (published 2016-08-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install npm-add-script
pnpm add npm-add-script
yarn add npm-add-script
bun add npm-add-script
```

Provides the command `npmAddScript`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2016-08-30 |
| First published | 2015-08-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 13 |
| Author | Cole Willsea |
| Maintainers | coleww |
| Keywords | npm, add, script |

## Links

- npm: https://www.npmjs.com/package/npm-add-script
- Repository: https://github.com/coleww/npm-add-script
- Issues: https://github.com/coleww/npm-add-script/issues
- npm.io page: https://npm.io/package/npm-add-script

## Dependencies (2)

- [yargs](https://npm.io/package/yargs.md) ^3.19.0
- [jsonfile](https://npm.io/package/jsonfile.md) ^2.2.1

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2016-08-30
- 1.0.4 — 2015-08-20
- 1.0.3 — 2015-08-16
- 1.0.2 — 2015-08-15
- 1.0.1 — 2015-08-15
- 1.0.0 — 2015-08-15

## README

npm-add-script
----------------

programmatically add `scripts` entries to yr package.json file.

[![NPM](https://nodei.co/npm/npm-add-script.png)](https://nodei.co/npm/npm-add-script/)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)
[![Build Status](https://secure.travis-ci.org/coleww/npm-add-script.png)](http://travis-ci.org/coleww/npm-add-script)

OK SO you can use `--save` or `--save-dev` to download modules and save them to yr package.json. But what if you are building a tool that generates stuff for projects and you need to be able to insert a brand new script into an existing thing? Or what if you want to just add a script entry at the command line because you've already been running and re-running the same convoluted test command for hours?!?!

NPM-ADD-SCRIPT IS HERE.

![hello](welcome.jpg)

### CLI

To use as a cli tool, just install it globally!  This is most probably what you want if you just want command line manipulation of scripts entries.

`npm install -g npm-add-script`

```
--~~===////|||||NPM-ADD-SCRIPT|||||\\\\\===~~--
           - add scripts to yr package.json's!

Options:
  -k, --key    the name of your script                                [required]
  -v, --value  your script                                            [required]
  -h, --help   Show help                                               [boolean]
  -f, --force  Override existing script entry                          [boolean]

Examples:
  npmAddScript -k test -v "node test.js"
  npmAddScript -k test -v "node test2.js" -f
```


### API

If you're making some sort of project scaffolding tool or test library or i don't know what you can also call this from node. For example, maybe your library requires a convoluted series of manuevers to work properly, you could automagically add those commands as a scripts entry! 

```javascript
  var npmAddScript = require('npm-add-script')
  // do some stuff related to yr special snowflake of a node module
  npmAddScript({key: "specialSnowFlake" , value: "node special_snowflake.js"})
  npmAddScript({key: "specialSnowFlake" , value: "node specialer_snowflake.js" , force: true})
```

---
_Source: https://npm.io/package/npm-add-script · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
