scradd

    1.0.4 • Public • Published

    ScrAdd - Script Adder

    Adds script to a package.json file from the terminal or in scripts.

    I've often seen the need to programatically be able to add a script or two to a package.json, for example when writing instructions for a tutorial or lesson. With ScrAdd this is now just a npx command away.

    ScrAdd will not overwrite existing scripts, but rather inform you that one of those exists already.

    Usage

    npx scradd {path to package.json} {script name} {script content}'

    Examples

    • Add a simple script to a local package.json

      npx scradd . test "mocha ."
    • Add a simple script to a non-local package.json

      npx scradd ~/projects/myproj/package.json test "mocha ."
    • Adding a script with a longer name requires quotes:

      npx scradd . "test:watch:integration" "mocha ."
    • Adding script content just about always requires quotes, since it contains spaces:

      npx scradd . "test:watch" "npm t -- -R min -w ./src/"

    Contribute

    This is a quick and dirty first version of the code. I wanted it to be workable but not perfect.

    You can contribute to this package by forking the repository and clone it to your computer. Remember to add tests.

    Install

    npm i scradd

    DownloadsWeekly Downloads

    0

    Version

    1.0.4

    License

    MIT

    Unpacked Size

    11 kB

    Total Files

    11

    Last publish

    Collaborators

    • avatar