if-ci

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

  • if-ci

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
if-ci
103.0.04 years ago6 years agoMinified + gzip package size for if-ci in KB

Readme

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! :tada:

license

MIT © Bo Lingen / citycide