is-ci
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
ci-info | 3.9.0 | 7.21 kB | MIT | prod |
The is-ci
npm package is a JavaScript tool that helps in identifying if the current environment in which the code is running is a Continuous Integration (CI) server. It plays a crucial role in CI/CD pipelines, enabling developers to discern CI environments and carry out tasks accordingly. However, please note that if your CI server isn't detected properly, you can alert the package author by opening an issue.
Using is-ci
in your codebase is incredibly straightforward. Firstly, you need to install the package in your project with the command npm install is-ci --save
. Then you can include it in your file using the CommonJS require
syntax as shown below:
const isCI = require('is-ci');
if (isCI) {
console.log('The code is running on a CI server');
}
If the environment is indeed a CI server, then isCI
will be true
and the message will be logged to the console.
is-ci
also supports CLI usage. You can use it globally by installing it with the -g
flag (i.e., npm install is-ci -g
) or as a dependency in your project. Once installed, you can use it as shown below:
is-ci && echo "This is a CI server"
In this scenario, if the environment is a CI server, the message "This is a CI server" will be outputted on your terminal.
The read-me document you've supplied is the main source of documentation for the is-ci
package. For detailed information on the supported CI servers by is-ci
, you can refer to the ci-info documentation. The is-ci
project and its documentation are hosted on GitHub at https://github.com/watson/is-ci.