JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2207
  • Score
    100M100P100Q110607F
  • License MIT

Programmatically add entries to yr package.json scripts!

Package Exports

  • npm-add-script

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (npm-add-script) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

npm-add-script

programmatically add scripts entries to yr package.json file.

NPM js-standard-style Build Status

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

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]

Examples:
  npmAddScript -k test -v "node test.js"

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!

  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"})