diff options
author | Rebecca Turner <me@re-becca.org> | 2018-09-12 19:53:43 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2018-09-12 19:53:44 +0300 |
commit | 2702f46bd7284fb303ca2119d23c52536811d705 (patch) | |
tree | 3f88a7c80196ab498511e2d3f5d4bc4925e5d361 /node_modules | |
parent | 83c2b117d0b760d0ea8d667e5e4bdfa6a7a7a8f6 (diff) |
ci-info@1.5.1
Diffstat (limited to 'node_modules')
-rw-r--r-- | node_modules/ci-info/README.md | 83 | ||||
-rw-r--r-- | node_modules/ci-info/index.js | 66 | ||||
-rw-r--r-- | node_modules/ci-info/package.json | 29 | ||||
-rw-r--r-- | node_modules/ci-info/vendors.json | 131 |
4 files changed, 214 insertions, 95 deletions
diff --git a/node_modules/ci-info/README.md b/node_modules/ci-info/README.md index a76fd2e16..b3f677ddc 100644 --- a/node_modules/ci-info/README.md +++ b/node_modules/ci-info/README.md @@ -32,28 +32,31 @@ if (ci.isCI) { Officially supported CI servers: -- [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` | ## API @@ -76,34 +79,20 @@ boolean to be set to `true` if they use certain vendor neutral environment variables. In those cases `ci.name` will be `null` and no vendor specific boolean will be set to `true`. +### `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. Deprecated vendor constants that will be removed in the next major release: diff --git a/node_modules/ci-info/index.js b/node_modules/ci-info/index.js index 74750a7c0..7f742f4ed 100644 --- a/node_modules/ci-info/index.js +++ b/node_modules/ci-info/index.js @@ -1,58 +1,56 @@ 'use strict' -var env = process.env +var vendors = require('./vendors.json') -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'] -] +var env = process.env // 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] return Object.keys(obj).every(function (k) { return env[k] === obj[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 ) diff --git a/node_modules/ci-info/package.json b/node_modules/ci-info/package.json index 6c1f1cada..961f89ff3 100644 --- a/node_modules/ci-info/package.json +++ b/node_modules/ci-info/package.json @@ -1,29 +1,29 @@ { - "_from": "ci-info@1.4.0", - "_id": "ci-info@1.4.0", + "_from": "ci-info@1.5.1", + "_id": "ci-info@1.5.1", "_inBundle": false, - "_integrity": "sha512-Oqmw2pVfCl8sCL+1QgMywPfdxPJPkC51y4usw0iiE2S9qnEOAqXy8bwl1CpMpnoU39g4iKJTz6QZj+28FvOnjQ==", + "_integrity": "sha512-fKFIKXaYiL1exImwJ0AhR/6jxFPSKQBk2ayV5NiNoruUs2+rxC2kNw0EG+1Z9dugZRdCrppskQ8DN2cyaUM1Hw==", "_location": "/ci-info", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "ci-info@1.4.0", + "raw": "ci-info@1.5.1", "name": "ci-info", "escapedName": "ci-info", - "rawSpec": "1.4.0", + "rawSpec": "1.5.1", "saveSpec": null, - "fetchSpec": "1.4.0" + "fetchSpec": "1.5.1" }, "_requiredBy": [ "#USER", "/", "/is-ci" ], - "_resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.4.0.tgz", - "_shasum": "4841d53cad49f11b827b648ebde27a6e189b412f", - "_spec": "ci-info@1.4.0", - "_where": "/Users/zkat/Documents/code/work/npm", + "_resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.5.1.tgz", + "_shasum": "17e8eb5de6f8b2b6038f0cbb714d410bfa9f3030", + "_spec": "ci-info@1.5.1", + "_where": "/Users/rebecca/code/npm", "author": { "name": "Thomas Watson Steen", "email": "w@tson.dk", @@ -34,15 +34,16 @@ }, "bundleDependencies": false, "coordinates": [ - 55.0113914, - 14.9747494 + 55.778273, + 12.593054 ], "dependencies": {}, "deprecated": false, "description": "Get details about the current Continuous Integration environment", "devDependencies": { "clear-require": "^1.0.1", - "standard": "^11.0.1" + "standard": "^12.0.1", + "tape": "^4.9.1" }, "homepage": "https://github.com/watson/ci-info", "keywords": [ @@ -62,5 +63,5 @@ "scripts": { "test": "standard && node test.js" }, - "version": "1.4.0" + "version": "1.5.1" } diff --git a/node_modules/ci-info/vendors.json b/node_modules/ci-info/vendors.json new file mode 100644 index 000000000..4c03de95c --- /dev/null +++ b/node_modules/ci-info/vendors.json @@ -0,0 +1,131 @@ +[ + { + "name": "AppVeyor", + "constant": "APPVEYOR", + "env": "APPVEYOR", + "pr": { "env": "APPVEYOR_PULL_REQUEST_NUMBER", "type": "string" } + }, + { + "name": "Bamboo", + "constant": "BAMBOO", + "env": "bamboo_planKey" + }, + { + "name": "Bitbucket Pipelines", + "constant": "BITBUCKET", + "env": "BITBUCKET_COMMIT" + }, + { + "name": "Buildkite", + "constant": "BUILDKITE", + "env": "BUILDKITE", + "pr": { "env": "BUILDKITE_PULL_REQUEST", "type": "not-false" } + }, + { + "name": "CircleCI", + "constant": "CIRCLE", + "env": "CIRCLECI", + "pr": { "env": "CIRCLE_PULL_REQUEST", "type": "string" } + }, + { + "name": "Cirrus CI", + "constant": "CIRRUS", + "env": "CIRRUS_CI", + "pr": { "env": "CIRRUS_PR", "type": "string" } + }, + { + "name": "AWS CodeBuild", + "constant": "CODEBUILD", + "env": "CODEBUILD_BUILD_ARN" + }, + { + "name": "Codeship", + "constant": "CODESHIP", + "env": { "CI_NAME": "codeship" } + }, + { + "name": "Drone", + "constant": "DRONE", + "env": "DRONE" + }, + { + "name": "dsari", + "constant": "DSARI", + "env": "DSARI" + }, + { + "name": "GitLab CI", + "constant": "GITLAB", + "env": "GITLAB_CI" + }, + { + "name": "GoCD", + "constant": "GOCD", + "env": "GO_PIPELINE_LABEL" + }, + { + "name": "Hudson", + "constant": "HUDSON", + "env": "HUDSON_URL" + }, + { + "name": "Jenkins", + "constant": "JENKINS", + "env": ["JENKINS_URL", "BUILD_ID"] + }, + { + "name": "Magnum CI", + "constant": "MAGNUM", + "env": "MAGNUM" + }, + { + "name": "Semaphore", + "constant": "SEMAPHORE", + "env": "SEMAPHORE", + "pr": { "env": "PULL_REQUEST_NUMBER", "type": "string" } + }, + { + "name": "Shippable", + "constant": "SHIPPABLE", + "env": "SHIPPABLE", + "pr": { "env": "IS_PULL_REQUEST", "type": "boolean" } + }, + { + "name": "Solano CI", + "constant": "SOLANO", + "env": "TDDIUM", + "pr": { "env": "TDDIUM_PR_ID", "type": "string" } + }, + { + "name": "Strider CD", + "constant": "STRIDER", + "env": "STRIDER" + }, + { + "name": "TaskCluster", + "constant": "TASKCLUSTER", + "env": ["TASK_ID", "RUN_ID"] + }, + { + "name": "Solano CI", + "constant": "TDDIUM", + "env": "TDDIUM", + "deprecated": true + }, + { + "name": "TeamCity", + "constant": "TEAMCITY", + "env": "TEAMCITY_VERSION" + }, + { + "name": "Team Foundation Server", + "constant": "TFS", + "env": "TF_BUILD" + }, + { + "name": "Travis CI", + "constant": "TRAVIS", + "env": "TRAVIS", + "pr": { "env": "TRAVIS_PULL_REQUEST", "type": "not-false" } + } +] |