if-ci

3.0.0 • Public • Published

if-ci · Version License Travis CI JavaScript Standard Style

Easily run npm scripts only when in (or not in) a CI environment.

installation

npm i --save-dev if-ci

usage

if-ci ships with two commands, the obvious if-ci as well as if-not-ci. To use them, just prepend them to any existing command in an npm script.

if-ci

Will only run the given command when in a CI environment.

{
  "name": "my-great-package",
  "version": "1.2.34",
  "scripts": {
    "maybeEcho": "if-ci echo \"hello!\""
  }
}

If you have multiple commands in a script, just use it again:

{
  "name": "my-great-package",
  "version": "1.2.34",
  "scripts": {
    "maybeEcho": "if-ci echo \"hello\" && if-ci echo \"world!\""
  }
}

if-not-ci

Works inversely to if-ci and will only run the given command when not in a CI environment.

{
  "name": "my-great-package",
  "version": "1.2.34",
  "scripts": {
    "maybeEcho": "if-not-ci echo \"hello\" && if-not-ci echo \"world!\""
  }
}

contributing

Pull requests and any issues found are always welcome.

  1. Fork the project, and preferably create a branch named something like feat-make-better
  2. Modify as needed
  3. Make sure all tests continue to pass, and it never hurts to have more tests
  4. Push & pull request! 🎉

license

MIT © Bo Lingen / citycide

Package Sidebar

Install

npm i if-ci

Weekly Downloads

127

Version

3.0.0

License

MIT

Unpacked Size

5.16 kB

Total Files

6

Last publish

Collaborators

  • citycide
  • haltcase