Skip to content

Commit b3f3004

Browse files
committed
deps: ci-info@4.1.0
1 parent a1f9d48 commit b3f3004

File tree

5 files changed

+82
-52
lines changed

5 files changed

+82
-52
lines changed

node_modules/ci-info/index.js

+46-34
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Object.defineProperty(exports, '_vendors', {
1313

1414
exports.name = null
1515
exports.isPR = null
16+
exports.id = null
1617

1718
vendors.forEach(function (vendor) {
1819
const envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env]
@@ -27,45 +28,23 @@ vendors.forEach(function (vendor) {
2728
}
2829

2930
exports.name = vendor.name
30-
31-
switch (typeof vendor.pr) {
32-
case 'string':
33-
// "pr": "CIRRUS_PR"
34-
exports.isPR = !!env[vendor.pr]
35-
break
36-
case 'object':
37-
if ('env' in vendor.pr) {
38-
// "pr": { "env": "BUILDKITE_PULL_REQUEST", "ne": "false" }
39-
exports.isPR = vendor.pr.env in env && env[vendor.pr.env] !== vendor.pr.ne
40-
} else if ('any' in vendor.pr) {
41-
// "pr": { "any": ["ghprbPullId", "CHANGE_ID"] }
42-
exports.isPR = vendor.pr.any.some(function (key) {
43-
return !!env[key]
44-
})
45-
} else {
46-
// "pr": { "DRONE_BUILD_EVENT": "pull_request" }
47-
exports.isPR = checkEnv(vendor.pr)
48-
}
49-
break
50-
default:
51-
// PR detection not supported for this vendor
52-
exports.isPR = null
53-
}
31+
exports.isPR = checkPR(vendor)
32+
exports.id = vendor.constant
5433
})
5534

5635
exports.isCI = !!(
5736
env.CI !== 'false' && // Bypass all checks if CI env is explicitly set to 'false'
5837
(env.BUILD_ID || // Jenkins, Cloudbees
59-
env.BUILD_NUMBER || // Jenkins, TeamCity
60-
env.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari
61-
env.CI_APP_ID || // Appflow
62-
env.CI_BUILD_ID || // Appflow
63-
env.CI_BUILD_NUMBER || // Appflow
64-
env.CI_NAME || // Codeship and others
65-
env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI
66-
env.RUN_ID || // TaskCluster, dsari
67-
exports.name ||
68-
false)
38+
env.BUILD_NUMBER || // Jenkins, TeamCity
39+
env.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari
40+
env.CI_APP_ID || // Appflow
41+
env.CI_BUILD_ID || // Appflow
42+
env.CI_BUILD_NUMBER || // Appflow
43+
env.CI_NAME || // Codeship and others
44+
env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI
45+
env.RUN_ID || // TaskCluster, dsari
46+
exports.name ||
47+
false)
6948
)
7049

7150
function checkEnv (obj) {
@@ -79,12 +58,45 @@ function checkEnv (obj) {
7958
return env[obj.env] && env[obj.env].includes(obj.includes)
8059
// }
8160
}
61+
8262
if ('any' in obj) {
8363
return obj.any.some(function (k) {
8464
return !!env[k]
8565
})
8666
}
67+
8768
return Object.keys(obj).every(function (k) {
8869
return env[k] === obj[k]
8970
})
9071
}
72+
73+
function checkPR (vendor) {
74+
switch (typeof vendor.pr) {
75+
case 'string':
76+
// "pr": "CIRRUS_PR"
77+
return !!env[vendor.pr]
78+
case 'object':
79+
if ('env' in vendor.pr) {
80+
if ('any' in vendor.pr) {
81+
// "pr": { "env": "CODEBUILD_WEBHOOK_EVENT", "any": ["PULL_REQUEST_CREATED", "PULL_REQUEST_UPDATED"] }
82+
return vendor.pr.any.some(function (key) {
83+
return env[vendor.pr.env] === key
84+
})
85+
} else {
86+
// "pr": { "env": "BUILDKITE_PULL_REQUEST", "ne": "false" }
87+
return vendor.pr.env in env && env[vendor.pr.env] !== vendor.pr.ne
88+
}
89+
} else if ('any' in vendor.pr) {
90+
// "pr": { "any": ["ghprbPullId", "CHANGE_ID"] }
91+
return vendor.pr.any.some(function (key) {
92+
return !!env[key]
93+
})
94+
} else {
95+
// "pr": { "DRONE_BUILD_EVENT": "pull_request" }
96+
return checkEnv(vendor.pr)
97+
}
98+
default:
99+
// PR detection not supported for this vendor
100+
return null
101+
}
102+
}

node_modules/ci-info/package.json

+17-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ci-info",
3-
"version": "4.0.0",
3+
"version": "4.1.0",
44
"description": "Get details about the current Continuous Integration environment",
55
"main": "index.js",
66
"typings": "index.d.ts",
@@ -9,6 +9,18 @@
99
"repository": "https://github.com/watson/ci-info.git",
1010
"bugs": "https://github.com/watson/ci-info/issues",
1111
"homepage": "https://github.com/watson/ci-info",
12+
"contributors": [
13+
{
14+
"name": "Sibiraj",
15+
"url": "https://github.com/sibiraj-s"
16+
}
17+
],
18+
"funding": [
19+
{
20+
"type": "github",
21+
"url": "https://github.com/sponsors/sibiraj-s"
22+
}
23+
],
1224
"keywords": [
1325
"ci",
1426
"continuous",
@@ -22,22 +34,16 @@
2234
"index.d.ts",
2335
"CHANGELOG.md"
2436
],
25-
"funding": [
26-
{
27-
"type": "github",
28-
"url": "https://github.com/sponsors/sibiraj-s"
29-
}
30-
],
3137
"scripts": {
3238
"lint:fix": "standard --fix",
3339
"test": "standard && node test.js",
34-
"prepare": "husky install"
40+
"prepare": "husky install || true"
3541
},
3642
"devDependencies": {
3743
"clear-module": "^4.1.2",
38-
"husky": "^8.0.3",
39-
"standard": "^17.1.0",
40-
"tape": "^5.7.0"
44+
"husky": "^9.1.6",
45+
"standard": "^17.1.2",
46+
"tape": "^5.9.0"
4147
},
4248
"engines": {
4349
"node": ">=8"

node_modules/ci-info/vendors.json

+14-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
{
99
"name": "Appcircle",
1010
"constant": "APPCIRCLE",
11-
"env": "AC_APPCIRCLE"
11+
"env": "AC_APPCIRCLE",
12+
"pr": {
13+
"env": "AC_GIT_PR",
14+
"ne": "false"
15+
}
1216
},
1317
{
1418
"name": "AppVeyor",
@@ -19,7 +23,15 @@
1923
{
2024
"name": "AWS CodeBuild",
2125
"constant": "CODEBUILD",
22-
"env": "CODEBUILD_BUILD_ARN"
26+
"env": "CODEBUILD_BUILD_ARN",
27+
"pr": {
28+
"env": "CODEBUILD_WEBHOOK_EVENT",
29+
"any": [
30+
"PULL_REQUEST_CREATED",
31+
"PULL_REQUEST_UPDATED",
32+
"PULL_REQUEST_REOPENED"
33+
]
34+
}
2335
},
2436
{
2537
"name": "Azure Pipelines",

package-lock.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
"archy": "~1.0.0",
101101
"cacache": "^19.0.1",
102102
"chalk": "^5.3.0",
103-
"ci-info": "^4.0.0",
103+
"ci-info": "^4.1.0",
104104
"cli-columns": "^4.0.0",
105105
"fastest-levenshtein": "^1.0.16",
106106
"fs-minipass": "^3.0.3",
@@ -4856,9 +4856,9 @@
48564856
}
48574857
},
48584858
"node_modules/ci-info": {
4859-
"version": "4.0.0",
4860-
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.0.0.tgz",
4861-
"integrity": "sha512-TdHqgGf9odd8SXNuxtUBVx8Nv+qZOejE6qyqiy5NtbYYQOeFa6zmHkxlPzmaLxWWHsU6nJmB7AETdVPi+2NBUg==",
4859+
"version": "4.1.0",
4860+
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.1.0.tgz",
4861+
"integrity": "sha512-HutrvTNsF48wnxkzERIXOe5/mlcfFcbfCmwcg6CJnizbSue78AbDt+1cgl26zwn61WFxhcPykPfZrbqjGmBb4A==",
48624862
"funding": [
48634863
{
48644864
"type": "github",

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"archy": "~1.0.0",
6666
"cacache": "^19.0.1",
6767
"chalk": "^5.3.0",
68-
"ci-info": "^4.0.0",
68+
"ci-info": "^4.1.0",
6969
"cli-columns": "^4.0.0",
7070
"fastest-levenshtein": "^1.0.16",
7171
"fs-minipass": "^3.0.3",

0 commit comments

Comments
 (0)