wrangler 2.0.21 → 2.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -1
- package/src/__tests__/metrics.test.ts +30 -0
- package/src/metrics/is-ci.ts +14 -0
- package/src/metrics/metrics-config.ts +19 -2
- package/wrangler-dist/cli.js +311 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wrangler",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.22",
|
|
4
4
|
"description": "Command-line interface for all things Cloudflare Workers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"wrangler",
|
|
@@ -130,6 +130,7 @@
|
|
|
130
130
|
"ink-table": "^3.0.0",
|
|
131
131
|
"ink-testing-library": "^2.1.0",
|
|
132
132
|
"ink-text-input": "^4.0.3",
|
|
133
|
+
"is-ci": "^3.0.1",
|
|
133
134
|
"jest-fetch-mock": "^3.0.3",
|
|
134
135
|
"jest-websocket-mock": "^2.3.0",
|
|
135
136
|
"mime": "^3.0.0",
|
|
@@ -4,6 +4,7 @@ import { version as wranglerVersion } from "../../package.json";
|
|
|
4
4
|
import { purgeConfigCaches, saveToConfigCache } from "../config-cache";
|
|
5
5
|
import { logger } from "../logger";
|
|
6
6
|
import { getMetricsDispatcher, getMetricsConfig } from "../metrics";
|
|
7
|
+
import { CI } from "../metrics/is-ci";
|
|
7
8
|
import {
|
|
8
9
|
CURRENT_METRICS_DATE,
|
|
9
10
|
readMetricsConfig,
|
|
@@ -200,13 +201,42 @@ describe("metrics", () => {
|
|
|
200
201
|
});
|
|
201
202
|
|
|
202
203
|
describe("getMetricsConfig()", () => {
|
|
204
|
+
let isCISpy: jest.SpyInstance;
|
|
205
|
+
|
|
203
206
|
const { setIsTTY } = useMockIsTTY();
|
|
204
207
|
beforeEach(() => {
|
|
205
208
|
// Default the mock TTY to interactive for all these tests.
|
|
206
209
|
setIsTTY(true);
|
|
210
|
+
isCISpy = jest.spyOn(CI, "isCI").mockReturnValue(false);
|
|
207
211
|
});
|
|
208
212
|
|
|
209
213
|
describe("enabled", () => {
|
|
214
|
+
const ORIGINAL_ENV = process.env;
|
|
215
|
+
beforeEach(() => {
|
|
216
|
+
process.env = { ...ORIGINAL_ENV };
|
|
217
|
+
});
|
|
218
|
+
afterEach(() => {
|
|
219
|
+
process.env = ORIGINAL_ENV;
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
it("should return the WRANGLER_SEND_METRICS environment variable for enabled if it is defined", async () => {
|
|
223
|
+
process.env.WRANGLER_SEND_METRICS = "false";
|
|
224
|
+
expect(await getMetricsConfig({})).toMatchObject({
|
|
225
|
+
enabled: false,
|
|
226
|
+
});
|
|
227
|
+
process.env.WRANGLER_SEND_METRICS = "true";
|
|
228
|
+
expect(await getMetricsConfig({})).toMatchObject({
|
|
229
|
+
enabled: true,
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
it("should return false if running in a CI environment", async () => {
|
|
234
|
+
isCISpy.mockReturnValue(true);
|
|
235
|
+
expect(await getMetricsConfig({})).toMatchObject({
|
|
236
|
+
enabled: false,
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
|
|
210
240
|
it("should return the sendMetrics argument for enabled if it is defined", async () => {
|
|
211
241
|
expect(
|
|
212
242
|
await getMetricsConfig({ sendMetrics: false, offline: false })
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import isCI from "is-ci";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Use this object to find out if we are currently running in a continuous integration environment.
|
|
5
|
+
*
|
|
6
|
+
* The isCI constant imported above cannot be easily mocked for testing.
|
|
7
|
+
* By wrapping this up in a method on an object, it results in clean and testable code.
|
|
8
|
+
*/
|
|
9
|
+
export const CI = {
|
|
10
|
+
/** Is Wrangler currently running in a CI? */
|
|
11
|
+
isCI() {
|
|
12
|
+
return isCI;
|
|
13
|
+
},
|
|
14
|
+
};
|
|
@@ -5,9 +5,11 @@ import path from "node:path";
|
|
|
5
5
|
import { fetchResult } from "../cfetch";
|
|
6
6
|
import { getConfigCache, saveToConfigCache } from "../config-cache";
|
|
7
7
|
import { confirm } from "../dialogs";
|
|
8
|
+
import { getEnvironmentVariableFactory } from "../environment-variables";
|
|
8
9
|
import isInteractive from "../is-interactive";
|
|
9
10
|
import { logger } from "../logger";
|
|
10
11
|
import { getAPIToken } from "../user";
|
|
12
|
+
import { CI } from "./is-ci";
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* The date that the metrics being gathered was last updated in a way that would require
|
|
@@ -21,6 +23,10 @@ import { getAPIToken } from "../user";
|
|
|
21
23
|
export const CURRENT_METRICS_DATE = new Date(2022, 6, 4);
|
|
22
24
|
export const USER_ID_CACHE_PATH = "user-id.json";
|
|
23
25
|
|
|
26
|
+
export const getWranglerSendMetricsFromEnv = getEnvironmentVariableFactory({
|
|
27
|
+
variableName: "WRANGLER_SEND_METRICS",
|
|
28
|
+
});
|
|
29
|
+
|
|
24
30
|
export interface MetricsConfigOptions {
|
|
25
31
|
/**
|
|
26
32
|
* Defines whether to send metrics to Cloudflare:
|
|
@@ -70,6 +76,17 @@ export async function getMetricsConfig({
|
|
|
70
76
|
const deviceId = getDeviceId(config);
|
|
71
77
|
const userId = await getUserId(offline);
|
|
72
78
|
|
|
79
|
+
// If the WRANGLER_SEND_METRICS environment variable has been set use that
|
|
80
|
+
// and ignore everything else.
|
|
81
|
+
const sendMetricsEnv = getWranglerSendMetricsFromEnv();
|
|
82
|
+
if (sendMetricsEnv !== undefined) {
|
|
83
|
+
return {
|
|
84
|
+
enabled: sendMetricsEnv.toLowerCase() === "true",
|
|
85
|
+
deviceId,
|
|
86
|
+
userId,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
73
90
|
// If the project is explicitly set the `send_metrics` options in `wrangler.toml`
|
|
74
91
|
// then use that and ignore any user preference.
|
|
75
92
|
if (sendMetrics !== undefined) {
|
|
@@ -89,8 +106,8 @@ export async function getMetricsConfig({
|
|
|
89
106
|
}
|
|
90
107
|
|
|
91
108
|
// We couldn't get the metrics permission from the project-level nor the user-level config.
|
|
92
|
-
// If we are not interactive then just bail out.
|
|
93
|
-
if (!isInteractive()) {
|
|
109
|
+
// If we are not interactive or in a CI build then just bail out.
|
|
110
|
+
if (!isInteractive() || CI.isCI()) {
|
|
94
111
|
return { enabled: false, deviceId, userId };
|
|
95
112
|
}
|
|
96
113
|
|
package/wrangler-dist/cli.js
CHANGED
|
@@ -11463,11 +11463,11 @@ var require_ci_info = __commonJS({
|
|
|
11463
11463
|
exports2.isPR = null;
|
|
11464
11464
|
vendors.forEach(function(vendor) {
|
|
11465
11465
|
var envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env];
|
|
11466
|
-
var
|
|
11466
|
+
var isCI2 = envs.every(function(obj) {
|
|
11467
11467
|
return checkEnv(obj);
|
|
11468
11468
|
});
|
|
11469
|
-
exports2[vendor.constant] =
|
|
11470
|
-
if (
|
|
11469
|
+
exports2[vendor.constant] = isCI2;
|
|
11470
|
+
if (isCI2) {
|
|
11471
11471
|
exports2.name = vendor.name;
|
|
11472
11472
|
switch (typeof vendor.pr) {
|
|
11473
11473
|
case "string":
|
|
@@ -66376,7 +66376,7 @@ var require_ink = __commonJS({
|
|
|
66376
66376
|
var dom = __importStar(require_dom());
|
|
66377
66377
|
var instances_1 = __importDefault(require_instances());
|
|
66378
66378
|
var App_1 = __importDefault(require_App());
|
|
66379
|
-
var
|
|
66379
|
+
var isCI2 = process.env.CI === "false" ? false : is_ci_1.default;
|
|
66380
66380
|
var noop = () => {
|
|
66381
66381
|
};
|
|
66382
66382
|
var Ink = class {
|
|
@@ -66400,7 +66400,7 @@ var require_ink = __commonJS({
|
|
|
66400
66400
|
this.options.stdout.write(this.fullStaticOutput + output);
|
|
66401
66401
|
return;
|
|
66402
66402
|
}
|
|
66403
|
-
if (
|
|
66403
|
+
if (isCI2) {
|
|
66404
66404
|
if (hasStaticOutput) {
|
|
66405
66405
|
this.options.stdout.write(staticOutput);
|
|
66406
66406
|
}
|
|
@@ -66453,7 +66453,7 @@ var require_ink = __commonJS({
|
|
|
66453
66453
|
if (options.patchConsole) {
|
|
66454
66454
|
this.patchConsole();
|
|
66455
66455
|
}
|
|
66456
|
-
if (!
|
|
66456
|
+
if (!isCI2) {
|
|
66457
66457
|
options.stdout.on("resize", this.onRender);
|
|
66458
66458
|
this.unsubscribeResize = () => {
|
|
66459
66459
|
options.stdout.off("resize", this.onRender);
|
|
@@ -66472,7 +66472,7 @@ var require_ink = __commonJS({
|
|
|
66472
66472
|
this.options.stdout.write(data + this.fullStaticOutput + this.lastOutput);
|
|
66473
66473
|
return;
|
|
66474
66474
|
}
|
|
66475
|
-
if (
|
|
66475
|
+
if (isCI2) {
|
|
66476
66476
|
this.options.stdout.write(data);
|
|
66477
66477
|
return;
|
|
66478
66478
|
}
|
|
@@ -66489,7 +66489,7 @@ var require_ink = __commonJS({
|
|
|
66489
66489
|
this.options.stdout.write(this.fullStaticOutput + this.lastOutput);
|
|
66490
66490
|
return;
|
|
66491
66491
|
}
|
|
66492
|
-
if (
|
|
66492
|
+
if (isCI2) {
|
|
66493
66493
|
this.options.stderr.write(data);
|
|
66494
66494
|
return;
|
|
66495
66495
|
}
|
|
@@ -66509,7 +66509,7 @@ var require_ink = __commonJS({
|
|
|
66509
66509
|
if (typeof this.unsubscribeResize === "function") {
|
|
66510
66510
|
this.unsubscribeResize();
|
|
66511
66511
|
}
|
|
66512
|
-
if (
|
|
66512
|
+
if (isCI2) {
|
|
66513
66513
|
this.options.stdout.write(this.lastOutput + "\n");
|
|
66514
66514
|
} else if (!this.options.debug) {
|
|
66515
66515
|
this.log.done();
|
|
@@ -66533,7 +66533,7 @@ var require_ink = __commonJS({
|
|
|
66533
66533
|
return this.exitPromise;
|
|
66534
66534
|
}
|
|
66535
66535
|
clear() {
|
|
66536
|
-
if (!
|
|
66536
|
+
if (!isCI2 && !this.options.debug) {
|
|
66537
66537
|
this.log.clear();
|
|
66538
66538
|
}
|
|
66539
66539
|
}
|
|
@@ -108185,6 +108185,284 @@ var require_build4 = __commonJS({
|
|
|
108185
108185
|
}
|
|
108186
108186
|
});
|
|
108187
108187
|
|
|
108188
|
+
// ../../node_modules/ci-info/vendors.json
|
|
108189
|
+
var require_vendors2 = __commonJS({
|
|
108190
|
+
"../../node_modules/ci-info/vendors.json"(exports2, module2) {
|
|
108191
|
+
module2.exports = [
|
|
108192
|
+
{
|
|
108193
|
+
name: "AppVeyor",
|
|
108194
|
+
constant: "APPVEYOR",
|
|
108195
|
+
env: "APPVEYOR",
|
|
108196
|
+
pr: "APPVEYOR_PULL_REQUEST_NUMBER"
|
|
108197
|
+
},
|
|
108198
|
+
{
|
|
108199
|
+
name: "Azure Pipelines",
|
|
108200
|
+
constant: "AZURE_PIPELINES",
|
|
108201
|
+
env: "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI",
|
|
108202
|
+
pr: "SYSTEM_PULLREQUEST_PULLREQUESTID"
|
|
108203
|
+
},
|
|
108204
|
+
{
|
|
108205
|
+
name: "Appcircle",
|
|
108206
|
+
constant: "APPCIRCLE",
|
|
108207
|
+
env: "AC_APPCIRCLE"
|
|
108208
|
+
},
|
|
108209
|
+
{
|
|
108210
|
+
name: "Bamboo",
|
|
108211
|
+
constant: "BAMBOO",
|
|
108212
|
+
env: "bamboo_planKey"
|
|
108213
|
+
},
|
|
108214
|
+
{
|
|
108215
|
+
name: "Bitbucket Pipelines",
|
|
108216
|
+
constant: "BITBUCKET",
|
|
108217
|
+
env: "BITBUCKET_COMMIT",
|
|
108218
|
+
pr: "BITBUCKET_PR_ID"
|
|
108219
|
+
},
|
|
108220
|
+
{
|
|
108221
|
+
name: "Bitrise",
|
|
108222
|
+
constant: "BITRISE",
|
|
108223
|
+
env: "BITRISE_IO",
|
|
108224
|
+
pr: "BITRISE_PULL_REQUEST"
|
|
108225
|
+
},
|
|
108226
|
+
{
|
|
108227
|
+
name: "Buddy",
|
|
108228
|
+
constant: "BUDDY",
|
|
108229
|
+
env: "BUDDY_WORKSPACE_ID",
|
|
108230
|
+
pr: "BUDDY_EXECUTION_PULL_REQUEST_ID"
|
|
108231
|
+
},
|
|
108232
|
+
{
|
|
108233
|
+
name: "Buildkite",
|
|
108234
|
+
constant: "BUILDKITE",
|
|
108235
|
+
env: "BUILDKITE",
|
|
108236
|
+
pr: { env: "BUILDKITE_PULL_REQUEST", ne: "false" }
|
|
108237
|
+
},
|
|
108238
|
+
{
|
|
108239
|
+
name: "CircleCI",
|
|
108240
|
+
constant: "CIRCLE",
|
|
108241
|
+
env: "CIRCLECI",
|
|
108242
|
+
pr: "CIRCLE_PULL_REQUEST"
|
|
108243
|
+
},
|
|
108244
|
+
{
|
|
108245
|
+
name: "Cirrus CI",
|
|
108246
|
+
constant: "CIRRUS",
|
|
108247
|
+
env: "CIRRUS_CI",
|
|
108248
|
+
pr: "CIRRUS_PR"
|
|
108249
|
+
},
|
|
108250
|
+
{
|
|
108251
|
+
name: "AWS CodeBuild",
|
|
108252
|
+
constant: "CODEBUILD",
|
|
108253
|
+
env: "CODEBUILD_BUILD_ARN"
|
|
108254
|
+
},
|
|
108255
|
+
{
|
|
108256
|
+
name: "Codefresh",
|
|
108257
|
+
constant: "CODEFRESH",
|
|
108258
|
+
env: "CF_BUILD_ID",
|
|
108259
|
+
pr: { any: ["CF_PULL_REQUEST_NUMBER", "CF_PULL_REQUEST_ID"] }
|
|
108260
|
+
},
|
|
108261
|
+
{
|
|
108262
|
+
name: "Codeship",
|
|
108263
|
+
constant: "CODESHIP",
|
|
108264
|
+
env: { CI_NAME: "codeship" }
|
|
108265
|
+
},
|
|
108266
|
+
{
|
|
108267
|
+
name: "Drone",
|
|
108268
|
+
constant: "DRONE",
|
|
108269
|
+
env: "DRONE",
|
|
108270
|
+
pr: { DRONE_BUILD_EVENT: "pull_request" }
|
|
108271
|
+
},
|
|
108272
|
+
{
|
|
108273
|
+
name: "dsari",
|
|
108274
|
+
constant: "DSARI",
|
|
108275
|
+
env: "DSARI"
|
|
108276
|
+
},
|
|
108277
|
+
{
|
|
108278
|
+
name: "Expo Application Services",
|
|
108279
|
+
constant: "EAS",
|
|
108280
|
+
env: "EAS_BUILD"
|
|
108281
|
+
},
|
|
108282
|
+
{
|
|
108283
|
+
name: "GitHub Actions",
|
|
108284
|
+
constant: "GITHUB_ACTIONS",
|
|
108285
|
+
env: "GITHUB_ACTIONS",
|
|
108286
|
+
pr: { GITHUB_EVENT_NAME: "pull_request" }
|
|
108287
|
+
},
|
|
108288
|
+
{
|
|
108289
|
+
name: "GitLab CI",
|
|
108290
|
+
constant: "GITLAB",
|
|
108291
|
+
env: "GITLAB_CI",
|
|
108292
|
+
pr: "CI_MERGE_REQUEST_ID"
|
|
108293
|
+
},
|
|
108294
|
+
{
|
|
108295
|
+
name: "GoCD",
|
|
108296
|
+
constant: "GOCD",
|
|
108297
|
+
env: "GO_PIPELINE_LABEL"
|
|
108298
|
+
},
|
|
108299
|
+
{
|
|
108300
|
+
name: "LayerCI",
|
|
108301
|
+
constant: "LAYERCI",
|
|
108302
|
+
env: "LAYERCI",
|
|
108303
|
+
pr: "LAYERCI_PULL_REQUEST"
|
|
108304
|
+
},
|
|
108305
|
+
{
|
|
108306
|
+
name: "Hudson",
|
|
108307
|
+
constant: "HUDSON",
|
|
108308
|
+
env: "HUDSON_URL"
|
|
108309
|
+
},
|
|
108310
|
+
{
|
|
108311
|
+
name: "Jenkins",
|
|
108312
|
+
constant: "JENKINS",
|
|
108313
|
+
env: ["JENKINS_URL", "BUILD_ID"],
|
|
108314
|
+
pr: { any: ["ghprbPullId", "CHANGE_ID"] }
|
|
108315
|
+
},
|
|
108316
|
+
{
|
|
108317
|
+
name: "Magnum CI",
|
|
108318
|
+
constant: "MAGNUM",
|
|
108319
|
+
env: "MAGNUM"
|
|
108320
|
+
},
|
|
108321
|
+
{
|
|
108322
|
+
name: "Netlify CI",
|
|
108323
|
+
constant: "NETLIFY",
|
|
108324
|
+
env: "NETLIFY",
|
|
108325
|
+
pr: { env: "PULL_REQUEST", ne: "false" }
|
|
108326
|
+
},
|
|
108327
|
+
{
|
|
108328
|
+
name: "Nevercode",
|
|
108329
|
+
constant: "NEVERCODE",
|
|
108330
|
+
env: "NEVERCODE",
|
|
108331
|
+
pr: { env: "NEVERCODE_PULL_REQUEST", ne: "false" }
|
|
108332
|
+
},
|
|
108333
|
+
{
|
|
108334
|
+
name: "Render",
|
|
108335
|
+
constant: "RENDER",
|
|
108336
|
+
env: "RENDER",
|
|
108337
|
+
pr: { IS_PULL_REQUEST: "true" }
|
|
108338
|
+
},
|
|
108339
|
+
{
|
|
108340
|
+
name: "Sail CI",
|
|
108341
|
+
constant: "SAIL",
|
|
108342
|
+
env: "SAILCI",
|
|
108343
|
+
pr: "SAIL_PULL_REQUEST_NUMBER"
|
|
108344
|
+
},
|
|
108345
|
+
{
|
|
108346
|
+
name: "Semaphore",
|
|
108347
|
+
constant: "SEMAPHORE",
|
|
108348
|
+
env: "SEMAPHORE",
|
|
108349
|
+
pr: "PULL_REQUEST_NUMBER"
|
|
108350
|
+
},
|
|
108351
|
+
{
|
|
108352
|
+
name: "Screwdriver",
|
|
108353
|
+
constant: "SCREWDRIVER",
|
|
108354
|
+
env: "SCREWDRIVER",
|
|
108355
|
+
pr: { env: "SD_PULL_REQUEST", ne: "false" }
|
|
108356
|
+
},
|
|
108357
|
+
{
|
|
108358
|
+
name: "Shippable",
|
|
108359
|
+
constant: "SHIPPABLE",
|
|
108360
|
+
env: "SHIPPABLE",
|
|
108361
|
+
pr: { IS_PULL_REQUEST: "true" }
|
|
108362
|
+
},
|
|
108363
|
+
{
|
|
108364
|
+
name: "Solano CI",
|
|
108365
|
+
constant: "SOLANO",
|
|
108366
|
+
env: "TDDIUM",
|
|
108367
|
+
pr: "TDDIUM_PR_ID"
|
|
108368
|
+
},
|
|
108369
|
+
{
|
|
108370
|
+
name: "Strider CD",
|
|
108371
|
+
constant: "STRIDER",
|
|
108372
|
+
env: "STRIDER"
|
|
108373
|
+
},
|
|
108374
|
+
{
|
|
108375
|
+
name: "TaskCluster",
|
|
108376
|
+
constant: "TASKCLUSTER",
|
|
108377
|
+
env: ["TASK_ID", "RUN_ID"]
|
|
108378
|
+
},
|
|
108379
|
+
{
|
|
108380
|
+
name: "TeamCity",
|
|
108381
|
+
constant: "TEAMCITY",
|
|
108382
|
+
env: "TEAMCITY_VERSION"
|
|
108383
|
+
},
|
|
108384
|
+
{
|
|
108385
|
+
name: "Travis CI",
|
|
108386
|
+
constant: "TRAVIS",
|
|
108387
|
+
env: "TRAVIS",
|
|
108388
|
+
pr: { env: "TRAVIS_PULL_REQUEST", ne: "false" }
|
|
108389
|
+
},
|
|
108390
|
+
{
|
|
108391
|
+
name: "Vercel",
|
|
108392
|
+
constant: "VERCEL",
|
|
108393
|
+
env: "NOW_BUILDER"
|
|
108394
|
+
},
|
|
108395
|
+
{
|
|
108396
|
+
name: "Visual Studio App Center",
|
|
108397
|
+
constant: "APPCENTER",
|
|
108398
|
+
env: "APPCENTER_BUILD_ID"
|
|
108399
|
+
}
|
|
108400
|
+
];
|
|
108401
|
+
}
|
|
108402
|
+
});
|
|
108403
|
+
|
|
108404
|
+
// ../../node_modules/ci-info/index.js
|
|
108405
|
+
var require_ci_info2 = __commonJS({
|
|
108406
|
+
"../../node_modules/ci-info/index.js"(exports2) {
|
|
108407
|
+
"use strict";
|
|
108408
|
+
init_import_meta_url();
|
|
108409
|
+
var vendors = require_vendors2();
|
|
108410
|
+
var env5 = process.env;
|
|
108411
|
+
Object.defineProperty(exports2, "_vendors", {
|
|
108412
|
+
value: vendors.map(function(v) {
|
|
108413
|
+
return v.constant;
|
|
108414
|
+
})
|
|
108415
|
+
});
|
|
108416
|
+
exports2.name = null;
|
|
108417
|
+
exports2.isPR = null;
|
|
108418
|
+
vendors.forEach(function(vendor) {
|
|
108419
|
+
const envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env];
|
|
108420
|
+
const isCI2 = envs.every(function(obj) {
|
|
108421
|
+
return checkEnv(obj);
|
|
108422
|
+
});
|
|
108423
|
+
exports2[vendor.constant] = isCI2;
|
|
108424
|
+
if (isCI2) {
|
|
108425
|
+
exports2.name = vendor.name;
|
|
108426
|
+
switch (typeof vendor.pr) {
|
|
108427
|
+
case "string":
|
|
108428
|
+
exports2.isPR = !!env5[vendor.pr];
|
|
108429
|
+
break;
|
|
108430
|
+
case "object":
|
|
108431
|
+
if ("env" in vendor.pr) {
|
|
108432
|
+
exports2.isPR = vendor.pr.env in env5 && env5[vendor.pr.env] !== vendor.pr.ne;
|
|
108433
|
+
} else if ("any" in vendor.pr) {
|
|
108434
|
+
exports2.isPR = vendor.pr.any.some(function(key2) {
|
|
108435
|
+
return !!env5[key2];
|
|
108436
|
+
});
|
|
108437
|
+
} else {
|
|
108438
|
+
exports2.isPR = checkEnv(vendor.pr);
|
|
108439
|
+
}
|
|
108440
|
+
break;
|
|
108441
|
+
default:
|
|
108442
|
+
exports2.isPR = null;
|
|
108443
|
+
}
|
|
108444
|
+
}
|
|
108445
|
+
});
|
|
108446
|
+
exports2.isCI = !!(env5.CI || env5.CONTINUOUS_INTEGRATION || env5.BUILD_NUMBER || env5.RUN_ID || exports2.name || false);
|
|
108447
|
+
function checkEnv(obj) {
|
|
108448
|
+
if (typeof obj === "string")
|
|
108449
|
+
return !!env5[obj];
|
|
108450
|
+
return Object.keys(obj).every(function(k) {
|
|
108451
|
+
return env5[k] === obj[k];
|
|
108452
|
+
});
|
|
108453
|
+
}
|
|
108454
|
+
}
|
|
108455
|
+
});
|
|
108456
|
+
|
|
108457
|
+
// ../../node_modules/is-ci/index.js
|
|
108458
|
+
var require_is_ci2 = __commonJS({
|
|
108459
|
+
"../../node_modules/is-ci/index.js"(exports2, module2) {
|
|
108460
|
+
"use strict";
|
|
108461
|
+
init_import_meta_url();
|
|
108462
|
+
module2.exports = require_ci_info2().isCI;
|
|
108463
|
+
}
|
|
108464
|
+
});
|
|
108465
|
+
|
|
108188
108466
|
// ../../node_modules/timeago.js/lib/lang/en_US.js
|
|
108189
108467
|
var require_en_US = __commonJS({
|
|
108190
108468
|
"../../node_modules/timeago.js/lib/lang/en_US.js"(exports2) {
|
|
@@ -115926,7 +116204,7 @@ var import_websocket_server = __toESM(require_websocket_server2(), 1);
|
|
|
115926
116204
|
var wrapper_default = import_websocket.default;
|
|
115927
116205
|
|
|
115928
116206
|
// package.json
|
|
115929
|
-
var version = "2.0.
|
|
116207
|
+
var version = "2.0.22";
|
|
115930
116208
|
var package_default = {
|
|
115931
116209
|
name: "wrangler",
|
|
115932
116210
|
version,
|
|
@@ -116059,6 +116337,7 @@ var package_default = {
|
|
|
116059
116337
|
"ink-table": "^3.0.0",
|
|
116060
116338
|
"ink-testing-library": "^2.1.0",
|
|
116061
116339
|
"ink-text-input": "^4.0.3",
|
|
116340
|
+
"is-ci": "^3.0.1",
|
|
116062
116341
|
"jest-fetch-mock": "^3.0.3",
|
|
116063
116342
|
"jest-websocket-mock": "^2.3.0",
|
|
116064
116343
|
mime: "^3.0.0",
|
|
@@ -119540,9 +119819,21 @@ function select(text, options, initialIndex) {
|
|
|
119540
119819
|
});
|
|
119541
119820
|
}
|
|
119542
119821
|
|
|
119822
|
+
// src/metrics/is-ci.ts
|
|
119823
|
+
init_import_meta_url();
|
|
119824
|
+
var import_is_ci = __toESM(require_is_ci2());
|
|
119825
|
+
var CI = {
|
|
119826
|
+
isCI() {
|
|
119827
|
+
return import_is_ci.default;
|
|
119828
|
+
}
|
|
119829
|
+
};
|
|
119830
|
+
|
|
119543
119831
|
// src/metrics/metrics-config.ts
|
|
119544
119832
|
var CURRENT_METRICS_DATE = new Date(2022, 6, 4);
|
|
119545
119833
|
var USER_ID_CACHE_PATH = "user-id.json";
|
|
119834
|
+
var getWranglerSendMetricsFromEnv = getEnvironmentVariableFactory({
|
|
119835
|
+
variableName: "WRANGLER_SEND_METRICS"
|
|
119836
|
+
});
|
|
119546
119837
|
async function getMetricsConfig({
|
|
119547
119838
|
sendMetrics,
|
|
119548
119839
|
offline = false
|
|
@@ -119550,6 +119841,14 @@ async function getMetricsConfig({
|
|
|
119550
119841
|
const config = readMetricsConfig();
|
|
119551
119842
|
const deviceId = getDeviceId(config);
|
|
119552
119843
|
const userId = await getUserId(offline);
|
|
119844
|
+
const sendMetricsEnv = getWranglerSendMetricsFromEnv();
|
|
119845
|
+
if (sendMetricsEnv !== void 0) {
|
|
119846
|
+
return {
|
|
119847
|
+
enabled: sendMetricsEnv.toLowerCase() === "true",
|
|
119848
|
+
deviceId,
|
|
119849
|
+
userId
|
|
119850
|
+
};
|
|
119851
|
+
}
|
|
119553
119852
|
if (sendMetrics !== void 0) {
|
|
119554
119853
|
return { enabled: sendMetrics, deviceId, userId };
|
|
119555
119854
|
}
|
|
@@ -119561,7 +119860,7 @@ async function getMetricsConfig({
|
|
|
119561
119860
|
logger.log("Usage metrics tracking has changed since you last granted permission.");
|
|
119562
119861
|
}
|
|
119563
119862
|
}
|
|
119564
|
-
if (!isInteractive()) {
|
|
119863
|
+
if (!isInteractive() || CI.isCI()) {
|
|
119565
119864
|
return { enabled: false, deviceId, userId };
|
|
119566
119865
|
}
|
|
119567
119866
|
const enabled = await confirm("Would you like to help improve Wrangler by sending usage metrics to Cloudflare?");
|