UI for Zipcoin Blue

index.js 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. 'use strict'
  2. var env = process.env
  3. var vendors = [
  4. // Constant, Name, Envs
  5. ['TRAVIS', 'Travis CI', 'TRAVIS'],
  6. ['CIRCLE', 'CircleCI', 'CIRCLECI'],
  7. ['GITLAB', 'GitLab CI', 'GITLAB_CI'],
  8. ['APPVEYOR', 'AppVeyor', 'APPVEYOR'],
  9. ['CODESHIP', 'Codeship', {CI_NAME: 'codeship'}],
  10. ['DRONE', 'Drone', 'DRONE'],
  11. ['MAGNUM', 'Magnum CI', 'MAGNUM'],
  12. ['SEMAPHORE', 'Semaphore', 'SEMAPHORE'],
  13. ['JENKINS', 'Jenkins', 'JENKINS_URL', 'BUILD_ID'],
  14. ['BAMBOO', 'Bamboo', 'bamboo_planKey'],
  15. ['TFS', 'Team Foundation Server', 'TF_BUILD'],
  16. ['TEAMCITY', 'TeamCity', 'TEAMCITY_VERSION'],
  17. ['BUILDKITE', 'Buildkite', 'BUILDKITE'],
  18. ['HUDSON', 'Hudson', 'HUDSON_URL'],
  19. ['TASKCLUSTER', 'TaskCluster', 'TASK_ID', 'RUN_ID'],
  20. ['GOCD', 'GoCD', 'GO_PIPELINE_LABEL'],
  21. ['BITBUCKET', 'Bitbucket Pipelines', 'BITBUCKET_COMMIT'],
  22. ['CODEBUILD', 'AWS CodeBuild', 'CODEBUILD_BUILD_ARN']
  23. ]
  24. exports.name = null
  25. vendors.forEach(function (vendor) {
  26. var constant = vendor.shift()
  27. var name = vendor.shift()
  28. var isCI = vendor.every(function (obj) {
  29. if (typeof obj === 'string') return !!env[obj]
  30. return Object.keys(obj).every(function (k) {
  31. return env[k] === obj[k]
  32. })
  33. })
  34. exports[constant] = isCI
  35. if (isCI) exports.name = name
  36. })
  37. exports.isCI = !!(
  38. env.CI || // Travis CI, CircleCI, Gitlab CI, Appveyor, CodeShip
  39. env.CONTINUOUS_INTEGRATION || // Travis CI
  40. env.BUILD_NUMBER || // Jenkins, TeamCity
  41. exports.name ||
  42. false
  43. )