https://github.com/haltcase/if-ci
Easily run npm scripts only when in a CI environment.
https://github.com/haltcase/if-ci
ci circle cli npm scripts tests travis
Last synced: 10 months ago
JSON representation
Easily run npm scripts only when in a CI environment.
- Host: GitHub
- URL: https://github.com/haltcase/if-ci
- Owner: haltcase
- License: mit
- Created: 2017-07-06T08:04:43.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-01-14T16:33:19.000Z (almost 7 years ago)
- Last Synced: 2024-10-23T00:30:28.791Z (about 1 year ago)
- Topics: ci, circle, cli, npm, scripts, tests, travis
- Language: JavaScript
- Size: 77.1 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# if-ci · [](https://www.npmjs.com/package/if-ci) [](https://www.npmjs.com/package/if-ci) [](https://travis-ci.org/citycide/if-ci) [](https://standardjs.com)
> Easily run npm scripts only when in (or not in) a CI environment.
## installation
```console
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.
```json
{
"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:
```json
{
"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.
```json
{
"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](https://github.com/citycide/if-ci/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](https://github.com/citycide)