Comparing version 1.4.0 to 1.5.0
66
index.js
'use strict' | ||
var vendors = require('./vendors') | ||
var env = process.env | ||
var vendors = [ | ||
// Constant, Name, Envs | ||
['APPVEYOR', 'AppVeyor', 'APPVEYOR'], | ||
['BAMBOO', 'Bamboo', 'bamboo_planKey'], | ||
['BITBUCKET', 'Bitbucket Pipelines', 'BITBUCKET_COMMIT'], | ||
['BUILDKITE', 'Buildkite', 'BUILDKITE'], | ||
['CIRCLE', 'CircleCI', 'CIRCLECI'], | ||
['CIRRUS', 'Cirrus CI', 'CIRRUS_CI'], | ||
['CODEBUILD', 'AWS CodeBuild', 'CODEBUILD_BUILD_ARN'], | ||
['CODESHIP', 'Codeship', {CI_NAME: 'codeship'}], | ||
['DRONE', 'Drone', 'DRONE'], | ||
['GITLAB', 'GitLab CI', 'GITLAB_CI'], | ||
['GOCD', 'GoCD', 'GO_PIPELINE_LABEL'], | ||
['HUDSON', 'Hudson', 'HUDSON_URL'], | ||
['JENKINS', 'Jenkins', 'JENKINS_URL', 'BUILD_ID'], | ||
['MAGNUM', 'Magnum CI', 'MAGNUM'], | ||
['SEMAPHORE', 'Semaphore', 'SEMAPHORE'], | ||
['SHIPPABLE', 'Shippable', 'SHIPPABLE'], | ||
['SOLANO', 'Solano CI', 'TDDIUM'], | ||
['STRIDER', 'Strider CD', 'STRIDER'], | ||
['TASKCLUSTER', 'TaskCluster', 'TASK_ID', 'RUN_ID'], | ||
['TDDIUM', 'Solano CI', 'TDDIUM'], // Deprecated | ||
['TEAMCITY', 'TeamCity', 'TEAMCITY_VERSION'], | ||
['TFS', 'Team Foundation Server', 'TF_BUILD'], | ||
['TRAVIS', 'Travis CI', 'TRAVIS'] | ||
] | ||
// Used for testinging only | ||
Object.defineProperty(exports, '_vendors', { | ||
value: vendors.map(function (v) { return v[0] }) | ||
value: vendors.map(function (v) { return v.constant }) | ||
}) | ||
exports.name = null | ||
exports.isPR = null | ||
vendors.forEach(function (vendor) { | ||
var constant = vendor.shift() | ||
var name = vendor.shift() | ||
var isCI = vendor.every(function (obj) { | ||
var envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env] | ||
var isCI = envs.every(function (obj) { | ||
if (typeof obj === 'string') return !!env[obj] | ||
@@ -48,12 +23,35 @@ return Object.keys(obj).every(function (k) { | ||
}) | ||
exports[constant] = isCI | ||
if (isCI) exports.name = name | ||
exports[vendor.constant] = isCI | ||
if (isCI) { | ||
exports.name = vendor.name | ||
if (vendor.pr) { | ||
var val = env[vendor.pr.env] | ||
if (val) { | ||
switch (vendor.pr.type) { | ||
case 'not-false': | ||
exports.isPR = val !== 'false' | ||
break | ||
case 'boolean': | ||
exports.isPR = val === 'true' | ||
break | ||
default: | ||
exports.isPR = true | ||
} | ||
} else { | ||
exports.isPR = false | ||
} | ||
} | ||
} | ||
}) | ||
exports.isCI = !!( | ||
env.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip | ||
env.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari | ||
env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI | ||
env.BUILD_NUMBER || // Jenkins, TeamCity | ||
env.RUN_ID || // TaskCluster, dsari | ||
exports.name || | ||
false | ||
) |
{ | ||
"name": "ci-info", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "Get details about the current Continuous Integration environment", | ||
@@ -9,3 +9,4 @@ "main": "index.js", | ||
"clear-require": "^1.0.1", | ||
"standard": "^11.0.1" | ||
"standard": "^12.0.1", | ||
"tape": "^4.9.1" | ||
}, | ||
@@ -33,5 +34,5 @@ "scripts": { | ||
"coordinates": [ | ||
55.0113914, | ||
14.9747494 | ||
55.776761, | ||
12.592082 | ||
] | ||
} |
@@ -35,24 +35,27 @@ # ci-info | ||
- [AWS CodeBuild](https://aws.amazon.com/codebuild/) | ||
- [AppVeyor](http://www.appveyor.com) | ||
- [Bamboo](https://www.atlassian.com/software/bamboo) by Atlassian | ||
- [Bitbucket Pipelines](https://bitbucket.org/product/features/pipelines) | ||
- [Buildkite](https://buildkite.com) | ||
- [CircleCI](http://circleci.com) | ||
- [Cirrus CI](https://cirrus-ci.org) | ||
- [Codeship](https://codeship.com) | ||
- [Drone](https://drone.io) | ||
- [GitLab CI](https://about.gitlab.com/gitlab-ci/) | ||
- [GoCD](https://www.go.cd/) | ||
- [Hudson](http://hudson-ci.org) | ||
- [Jenkins CI](https://jenkins-ci.org) | ||
- [Magnum CI](https://magnum-ci.com) | ||
- [Semaphore](https://semaphoreci.com) | ||
- [Shippable](https://www.shippable.com/) | ||
- [Solano CI](https://www.solanolabs.com/) | ||
- [Strider CD](https://strider-cd.github.io/) | ||
- [TaskCluster](http://docs.taskcluster.net) | ||
- [Team Foundation Server](https://www.visualstudio.com/en-us/products/tfs-overview-vs.aspx) by Microsoft | ||
- [TeamCity](https://www.jetbrains.com/teamcity/) by JetBrains | ||
- [Travis CI](http://travis-ci.org) | ||
| Name | Constant | | ||
|------|----------| | ||
| [AWS CodeBuild](https://aws.amazon.com/codebuild/) | `ci.CODEBUILD` | | ||
| [AppVeyor](http://www.appveyor.com) | `ci.APPVEYOR` | | ||
| [Bamboo](https://www.atlassian.com/software/bamboo) by Atlassian | `ci.BAMBOO` | | ||
| [Bitbucket Pipelines](https://bitbucket.org/product/features/pipelines) | `ci.BITBUCKET` | | ||
| [Buildkite](https://buildkite.com) | `ci.BUILDKITE` | | ||
| [CircleCI](http://circleci.com) | `ci.CIRCLE` | | ||
| [Cirrus CI](https://cirrus-ci.org) | `ci.CIRRUS` | | ||
| [Codeship](https://codeship.com) | `ci.CODESHIP` | | ||
| [Drone](https://drone.io) | `ci.DRONE` | | ||
| [dsari](https://github.com/rfinnie/dsari) | `ci.DSARI` | | ||
| [GitLab CI](https://about.gitlab.com/gitlab-ci/) | `ci.GITLAB` | | ||
| [GoCD](https://www.go.cd/) | `ci.GOCD` | | ||
| [Hudson](http://hudson-ci.org) | `ci.HUDSON` | | ||
| [Jenkins CI](https://jenkins-ci.org) | `ci.JENKINS` | | ||
| [Magnum CI](https://magnum-ci.com) | `ci.MAGNUM` | | ||
| [Semaphore](https://semaphoreci.com) | `ci.SEMAPHORE` | | ||
| [Shippable](https://www.shippable.com/) | `ci.SHIPPABLE` | | ||
| [Solano CI](https://www.solanolabs.com/) | `ci.SOLANO` | | ||
| [Strider CD](https://strider-cd.github.io/) | `ci.STRIDER` | | ||
| [TaskCluster](http://docs.taskcluster.net) | `ci.TASKCLUSTER` | | ||
| [Team Foundation Server](https://www.visualstudio.com/en-us/products/tfs-overview-vs.aspx) by Microsoft | `ci.TFS` | | ||
| [TeamCity](https://www.jetbrains.com/teamcity/) by JetBrains | `ci.TEAMCITY` | | ||
| [Travis CI](http://travis-ci.org) | `ci.TRAVIS` | | ||
@@ -80,30 +83,16 @@ ## API | ||
### `ci.isPR` | ||
A boolean if PR detection is supported for the current CI server. Will | ||
be `true` if a PR is being tested. Otherwise `false`. If PR detection is | ||
not supported for the current CI server, the value will be `null`. | ||
### `ci.<VENDOR-CONSTANT>` | ||
The following vendor specific boolean constants are exposed. A constant | ||
will be `true` if the code is determined to run on the given CI server. | ||
Otherwise `false`. | ||
A vendor specific boolean constants is exposed for each support CI | ||
vendor. A constant will be `true` if the code is determined to run on | ||
the given CI server. Otherwise `false`. | ||
- `ci.APPVEYOR` | ||
- `ci.BAMBOO` | ||
- `ci.BITBUCKET` | ||
- `ci.BUILDKITE` | ||
- `ci.CIRCLE` | ||
- `ci.CIRRUS` | ||
- `ci.CODEBUILD` | ||
- `ci.CODESHIP` | ||
- `ci.DRONE` | ||
- `ci.GITLAB` | ||
- `ci.GOCD` | ||
- `ci.HUDSON` | ||
- `ci.JENKINS` | ||
- `ci.MAGNUM` | ||
- `ci.SEMAPHORE` | ||
- `ci.SHIPPABLE` | ||
- `ci.SOLANO` | ||
- `ci.STRIDER` | ||
- `ci.TASKCLUSTER` | ||
- `ci.TEAMCITY` | ||
- `ci.TFS` (Team Foundation Server) | ||
- `ci.TRAVIS` | ||
Examples of vendor constants are `ci.TRAVIS` or `ci.APPVEYOR`. For a | ||
complete list, see the support table above. | ||
@@ -110,0 +99,0 @@ Deprecated vendor constants that will be removed in the next major |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10579
6
178
3
105
1
1