wrangler 2.0.6 → 2.0.7
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 +5 -3
- package/pages/functions/buildPlugin.ts +13 -0
- package/pages/functions/buildWorker.ts +13 -0
- package/src/__tests__/configuration.test.ts +14 -3
- package/src/__tests__/dev.test.tsx +11 -2
- package/src/__tests__/index.test.ts +25 -10
- package/src/__tests__/init.test.ts +61 -20
- package/src/__tests__/kv.test.ts +8 -8
- package/src/__tests__/pages.test.ts +339 -32
- package/src/__tests__/parse.test.ts +5 -1
- package/src/__tests__/publish.test.ts +184 -69
- package/src/abort.d.ts +3 -0
- package/src/cfetch/index.ts +4 -2
- package/src/cfetch/internal.ts +8 -9
- package/src/config/index.ts +162 -0
- package/src/config/validation.ts +24 -2
- package/src/create-worker-preview.ts +17 -7
- package/src/dev/dev.tsx +5 -4
- package/src/dev/remote.tsx +15 -1
- package/src/durable.ts +102 -0
- package/src/index.tsx +111 -41
- package/src/inspect.ts +39 -0
- package/src/kv.ts +74 -25
- package/src/open-in-browser.ts +5 -12
- package/src/pages.tsx +203 -61
- package/src/parse.ts +21 -4
- package/src/proxy.ts +38 -22
- package/src/publish.ts +18 -93
- package/src/sites.tsx +2 -7
- package/templates/new-worker.ts +16 -1
- package/wrangler-dist/cli.js +32779 -20005
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wrangler",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.7",
|
|
4
4
|
"author": "wrangler@cloudflare.com",
|
|
5
5
|
"description": "Command-line interface for all things Cloudflare Workers",
|
|
6
6
|
"bin": {
|
|
@@ -75,6 +75,7 @@
|
|
|
75
75
|
"find-up": "^6.3.0",
|
|
76
76
|
"get-port": "^6.1.2",
|
|
77
77
|
"glob-to-regexp": "0.4.1",
|
|
78
|
+
"http-terminator": "^3.2.0",
|
|
78
79
|
"ignore": "^5.2.0",
|
|
79
80
|
"ink": "^3.2.0",
|
|
80
81
|
"ink-select-input": "^4.2.1",
|
|
@@ -86,6 +87,7 @@
|
|
|
86
87
|
"jest-websocket-mock": "^2.3.0",
|
|
87
88
|
"mime": "^3.0.0",
|
|
88
89
|
"open": "^8.4.0",
|
|
90
|
+
"p-queue": "^7.2.0",
|
|
89
91
|
"pretty-bytes": "^6.0.0",
|
|
90
92
|
"prompts": "^2.4.2",
|
|
91
93
|
"react": "^17.0.2",
|
|
@@ -96,7 +98,7 @@
|
|
|
96
98
|
"timeago.js": "^4.0.2",
|
|
97
99
|
"tmp-promise": "^3.0.3",
|
|
98
100
|
"ts-dedent": "^2.2.0",
|
|
99
|
-
"undici": "^
|
|
101
|
+
"undici": "^5.3.0",
|
|
100
102
|
"update-check": "^1.5.4",
|
|
101
103
|
"ws": "^8.5.0",
|
|
102
104
|
"yargs": "^17.4.1"
|
|
@@ -131,7 +133,7 @@
|
|
|
131
133
|
"testTimeout": 30000,
|
|
132
134
|
"testRegex": ".*.(test|spec)\\.[jt]sx?$",
|
|
133
135
|
"transformIgnorePatterns": [
|
|
134
|
-
"node_modules/(?!find-up|locate-path|p-locate|p-limit|yocto-queue|path-exists|execa|strip-final-newline|npm-run-path|path-key|onetime|mimic-fn|human-signals|is-stream|get-port|supports-color|pretty-bytes)"
|
|
136
|
+
"node_modules/(?!find-up|locate-path|p-locate|p-limit|p-timeout|p-queue|yocto-queue|path-exists|execa|strip-final-newline|npm-run-path|path-key|onetime|mimic-fn|human-signals|is-stream|get-port|supports-color|pretty-bytes)"
|
|
135
137
|
],
|
|
136
138
|
"moduleNameMapper": {
|
|
137
139
|
"clipboardy": "<rootDir>/src/__tests__/helpers/clipboardy-mock.js",
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { access, lstat } from "node:fs/promises";
|
|
2
2
|
import { dirname, relative, resolve } from "node:path";
|
|
3
|
+
import NodeGlobalsPolyfills from "@esbuild-plugins/node-globals-polyfill";
|
|
4
|
+
import NodeModulesPolyfills from "@esbuild-plugins/node-modules-polyfill";
|
|
3
5
|
import { build } from "esbuild";
|
|
4
6
|
|
|
5
7
|
type Options = {
|
|
@@ -8,6 +10,7 @@ type Options = {
|
|
|
8
10
|
minify?: boolean;
|
|
9
11
|
sourcemap?: boolean;
|
|
10
12
|
watch?: boolean;
|
|
13
|
+
nodeCompat?: boolean;
|
|
11
14
|
onEnd?: () => void;
|
|
12
15
|
};
|
|
13
16
|
|
|
@@ -17,6 +20,7 @@ export function buildPlugin({
|
|
|
17
20
|
minify = false,
|
|
18
21
|
sourcemap = false,
|
|
19
22
|
watch = false,
|
|
23
|
+
nodeCompat,
|
|
20
24
|
onEnd = () => {},
|
|
21
25
|
}: Options) {
|
|
22
26
|
return build({
|
|
@@ -30,6 +34,7 @@ export function buildPlugin({
|
|
|
30
34
|
sourcemap,
|
|
31
35
|
watch,
|
|
32
36
|
allowOverwrite: true,
|
|
37
|
+
define: { ...(nodeCompat ? { global: "globalThis" } : {}) },
|
|
33
38
|
plugins: [
|
|
34
39
|
{
|
|
35
40
|
name: "wrangler notifier and monitor",
|
|
@@ -87,6 +92,14 @@ export function buildPlugin({
|
|
|
87
92
|
}
|
|
88
93
|
},
|
|
89
94
|
},
|
|
95
|
+
...(nodeCompat
|
|
96
|
+
? [
|
|
97
|
+
NodeGlobalsPolyfills({
|
|
98
|
+
buffer: true,
|
|
99
|
+
}),
|
|
100
|
+
NodeModulesPolyfills(),
|
|
101
|
+
]
|
|
102
|
+
: []),
|
|
90
103
|
],
|
|
91
104
|
});
|
|
92
105
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { access, cp, lstat, rm } from "node:fs/promises";
|
|
2
2
|
import { join, resolve } from "node:path";
|
|
3
|
+
import NodeGlobalsPolyfills from "@esbuild-plugins/node-globals-polyfill";
|
|
4
|
+
import NodeModulesPolyfills from "@esbuild-plugins/node-modules-polyfill";
|
|
3
5
|
import { build } from "esbuild";
|
|
4
6
|
import { nanoid } from "nanoid";
|
|
5
7
|
|
|
@@ -12,6 +14,7 @@ type Options = {
|
|
|
12
14
|
watch?: boolean;
|
|
13
15
|
onEnd?: () => void;
|
|
14
16
|
buildOutputDirectory?: string;
|
|
17
|
+
nodeCompat?: boolean;
|
|
15
18
|
};
|
|
16
19
|
|
|
17
20
|
export function buildWorker({
|
|
@@ -23,6 +26,7 @@ export function buildWorker({
|
|
|
23
26
|
watch = false,
|
|
24
27
|
onEnd = () => {},
|
|
25
28
|
buildOutputDirectory,
|
|
29
|
+
nodeCompat,
|
|
26
30
|
}: Options) {
|
|
27
31
|
return build({
|
|
28
32
|
entryPoints: [resolve(__dirname, "../pages/functions/template-worker.ts")],
|
|
@@ -37,6 +41,7 @@ export function buildWorker({
|
|
|
37
41
|
allowOverwrite: true,
|
|
38
42
|
define: {
|
|
39
43
|
__FALLBACK_SERVICE__: JSON.stringify(fallbackService),
|
|
44
|
+
...(nodeCompat ? { global: "globalThis" } : {}),
|
|
40
45
|
},
|
|
41
46
|
plugins: [
|
|
42
47
|
{
|
|
@@ -133,6 +138,14 @@ export function buildWorker({
|
|
|
133
138
|
);
|
|
134
139
|
},
|
|
135
140
|
},
|
|
141
|
+
...(nodeCompat
|
|
142
|
+
? [
|
|
143
|
+
NodeGlobalsPolyfills({
|
|
144
|
+
buffer: true,
|
|
145
|
+
}),
|
|
146
|
+
NodeModulesPolyfills(),
|
|
147
|
+
]
|
|
148
|
+
: []),
|
|
136
149
|
],
|
|
137
150
|
});
|
|
138
151
|
}
|
|
@@ -677,7 +677,8 @@ describe("normalizeAndValidateConfig()", () => {
|
|
|
677
677
|
expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
|
|
678
678
|
"Processing wrangler configuration:
|
|
679
679
|
- \\"unsafe\\" fields are experimental and may change or break at any time.
|
|
680
|
-
- \\"services\\" fields are experimental and may change or break at any time.
|
|
680
|
+
- \\"services\\" fields are experimental and may change or break at any time.
|
|
681
|
+
- In wrangler.toml, you have configured [durable_objects] exported by this Worker (CLASS1), but no [migrations] for them. This may not work as expected until you add a [migrations] section to your wrangler.toml. Refer to https://developers.cloudflare.com/workers/learning/using-durable-objects/#durable-object-migrations-in-wranglertoml for more details."
|
|
681
682
|
`);
|
|
682
683
|
});
|
|
683
684
|
|
|
@@ -1156,7 +1157,12 @@ describe("normalizeAndValidateConfig()", () => {
|
|
|
1156
1157
|
durable_objects: { bindings: expect.anything },
|
|
1157
1158
|
})
|
|
1158
1159
|
);
|
|
1159
|
-
expect(diagnostics.hasWarnings()).toBe(
|
|
1160
|
+
expect(diagnostics.hasWarnings()).toBe(true);
|
|
1161
|
+
expect(diagnostics.hasErrors()).toBe(true);
|
|
1162
|
+
expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
|
|
1163
|
+
"Processing wrangler configuration:
|
|
1164
|
+
- In wrangler.toml, you have configured [durable_objects] exported by this Worker ((unnamed), (unnamed), 1666, SomeClass, 1883), but no [migrations] for them. This may not work as expected until you add a [migrations] section to your wrangler.toml. Refer to https://developers.cloudflare.com/workers/learning/using-durable-objects/#durable-object-migrations-in-wranglertoml for more details."
|
|
1165
|
+
`);
|
|
1160
1166
|
expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
|
|
1161
1167
|
"Processing wrangler configuration:
|
|
1162
1168
|
|
|
@@ -2468,7 +2474,12 @@ describe("normalizeAndValidateConfig()", () => {
|
|
|
2468
2474
|
durable_objects: { bindings: expect.anything },
|
|
2469
2475
|
})
|
|
2470
2476
|
);
|
|
2471
|
-
expect(diagnostics.hasWarnings()).toBe(
|
|
2477
|
+
expect(diagnostics.hasWarnings()).toBe(true);
|
|
2478
|
+
expect(diagnostics.hasErrors()).toBe(true);
|
|
2479
|
+
expect(diagnostics.renderWarnings()).toMatchInlineSnapshot(`
|
|
2480
|
+
"Processing wrangler configuration:
|
|
2481
|
+
- In wrangler.toml, you have configured [durable_objects] exported by this Worker ((unnamed), (unnamed), 1666), but no [migrations] for them. This may not work as expected until you add a [migrations] section to your wrangler.toml. Refer to https://developers.cloudflare.com/workers/learning/using-durable-objects/#durable-object-migrations-in-wranglertoml for more details."
|
|
2482
|
+
`);
|
|
2472
2483
|
expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
|
|
2473
2484
|
"Processing wrangler configuration:
|
|
2474
2485
|
|
|
@@ -675,7 +675,7 @@ describe("wrangler dev", () => {
|
|
|
675
675
|
});
|
|
676
676
|
|
|
677
677
|
describe("durable_objects", () => {
|
|
678
|
-
it("should warn if there
|
|
678
|
+
it("should warn if there are remote Durable Objects, or missing migrations for local Durable Objects", async () => {
|
|
679
679
|
writeWranglerToml({
|
|
680
680
|
main: "index.js",
|
|
681
681
|
durable_objects: {
|
|
@@ -700,7 +700,16 @@ describe("wrangler dev", () => {
|
|
|
700
700
|
expect((Dev as jest.Mock).mock.calls[0][0].ip).toEqual("localhost");
|
|
701
701
|
expect(std.out).toMatchInlineSnapshot(`""`);
|
|
702
702
|
expect(std.warn).toMatchInlineSnapshot(`
|
|
703
|
-
"[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [
|
|
703
|
+
"[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mProcessing wrangler.toml configuration:[0m
|
|
704
|
+
|
|
705
|
+
- In wrangler.toml, you have configured [durable_objects] exported by this Worker (CLASS_1,
|
|
706
|
+
CLASS_3), but no [migrations] for them. This may not work as expected until you add a [migrations]
|
|
707
|
+
section to your wrangler.toml. Refer to
|
|
708
|
+
[4mhttps://developers.cloudflare.com/workers/learning/using-durable-objects/#durable-object-migrations-in-wranglertoml[0m
|
|
709
|
+
for more details.
|
|
710
|
+
|
|
711
|
+
|
|
712
|
+
[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mWARNING: You have Durable Object bindings that are not defined locally in the worker being developed.[0m
|
|
704
713
|
|
|
705
714
|
Be aware that changes to the data stored in these Durable Objects will be permanent and affect the
|
|
706
715
|
live instances.
|
|
@@ -2,6 +2,8 @@ import { getPackageManager } from "../package-manager";
|
|
|
2
2
|
import { mockConsoleMethods } from "./helpers/mock-console";
|
|
3
3
|
import { runInTempDir } from "./helpers/run-in-tmp";
|
|
4
4
|
import { runWrangler } from "./helpers/run-wrangler";
|
|
5
|
+
import { writeWorkerSource } from "./helpers/write-worker-source";
|
|
6
|
+
import writeWranglerToml from "./helpers/write-wrangler-toml";
|
|
5
7
|
import type { PackageManager } from "../package-manager";
|
|
6
8
|
|
|
7
9
|
describe("wrangler", () => {
|
|
@@ -113,9 +115,6 @@ describe("wrangler", () => {
|
|
|
113
115
|
});
|
|
114
116
|
|
|
115
117
|
describe("subcommand implicit help ran on incomplete command execution", () => {
|
|
116
|
-
function endEventLoop() {
|
|
117
|
-
return new Promise((resolve) => setImmediate(resolve));
|
|
118
|
-
}
|
|
119
118
|
it("no subcommand for 'secret' should display a list of available subcommands", async () => {
|
|
120
119
|
await runWrangler("secret");
|
|
121
120
|
await endEventLoop();
|
|
@@ -195,6 +194,7 @@ describe("wrangler", () => {
|
|
|
195
194
|
-v, --version Show version number [boolean]"
|
|
196
195
|
`);
|
|
197
196
|
});
|
|
197
|
+
|
|
198
198
|
it("no subcommand 'r2' should display a list of available subcommands", async () => {
|
|
199
199
|
await runWrangler("r2");
|
|
200
200
|
await endEventLoop();
|
|
@@ -213,6 +213,7 @@ describe("wrangler", () => {
|
|
|
213
213
|
`);
|
|
214
214
|
});
|
|
215
215
|
});
|
|
216
|
+
|
|
216
217
|
describe("Deprecated commands", () => {
|
|
217
218
|
it("should print a deprecation message for 'generate'", async () => {
|
|
218
219
|
await runWrangler("generate").catch((err) => {
|
|
@@ -229,13 +230,27 @@ describe("wrangler", () => {
|
|
|
229
230
|
`);
|
|
230
231
|
});
|
|
231
232
|
});
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
`);
|
|
238
|
-
});
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
it("should print a deprecation message for 'build' and then try to run `publish --dry-run --outdir`", async () => {
|
|
236
|
+
writeWranglerToml({
|
|
237
|
+
main: "index.js",
|
|
239
238
|
});
|
|
239
|
+
writeWorkerSource();
|
|
240
|
+
await runWrangler("build");
|
|
241
|
+
await endEventLoop();
|
|
242
|
+
expect(std.out).toMatchInlineSnapshot(`
|
|
243
|
+
"[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mDeprecation: \`wrangler build\` has been deprecated.[0m
|
|
244
|
+
|
|
245
|
+
Please refer to [4mhttps://developers.cloudflare.com/workers/wrangler/migration/deprecations/#build[0m for more information.
|
|
246
|
+
Attempting to run \`wrangler publish --dry-run --outdir=dist\` for you instead:
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
--dry-run: exiting now."
|
|
250
|
+
`);
|
|
240
251
|
});
|
|
241
252
|
});
|
|
253
|
+
|
|
254
|
+
function endEventLoop() {
|
|
255
|
+
return new Promise((resolve) => setImmediate(resolve));
|
|
256
|
+
}
|
|
@@ -2,7 +2,7 @@ import * as fs from "node:fs";
|
|
|
2
2
|
import * as fsp from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import * as TOML from "@iarna/toml";
|
|
5
|
-
import { execa } from "execa";
|
|
5
|
+
import { execa, execaSync } from "execa";
|
|
6
6
|
import { parseConfigFileTextToJson } from "typescript";
|
|
7
7
|
import { version as wranglerVersion } from "../../package.json";
|
|
8
8
|
import { getPackageManager } from "../package-manager";
|
|
@@ -46,8 +46,9 @@ describe("init", () => {
|
|
|
46
46
|
"✨ Created wrangler.toml
|
|
47
47
|
✨ Initialized git repository
|
|
48
48
|
✨ Created package.json
|
|
49
|
-
✨ Created tsconfig.json
|
|
49
|
+
✨ Created tsconfig.json
|
|
50
50
|
✨ Created src/index.ts
|
|
51
|
+
✨ Installed @cloudflare/workers-types and typescript into devDependencies
|
|
51
52
|
|
|
52
53
|
To start developing your Worker, run \`npm start\`
|
|
53
54
|
To publish your Worker to the Internet, run \`npm run publish\`"
|
|
@@ -72,8 +73,9 @@ describe("init", () => {
|
|
|
72
73
|
"✨ Created my-worker/wrangler.toml
|
|
73
74
|
✨ Initialized git repository at my-worker
|
|
74
75
|
✨ Created my-worker/package.json
|
|
75
|
-
✨ Created my-worker/tsconfig.json
|
|
76
|
+
✨ Created my-worker/tsconfig.json
|
|
76
77
|
✨ Created my-worker/src/index.ts
|
|
78
|
+
✨ Installed @cloudflare/workers-types and typescript into devDependencies
|
|
77
79
|
|
|
78
80
|
To start developing your Worker, run \`cd my-worker && npm start\`
|
|
79
81
|
To publish your Worker to the Internet, run \`npm run publish\`"
|
|
@@ -97,8 +99,9 @@ describe("init", () => {
|
|
|
97
99
|
"out": "✨ Created wrangler.toml
|
|
98
100
|
✨ Initialized git repository
|
|
99
101
|
✨ Created package.json
|
|
100
|
-
✨ Created tsconfig.json
|
|
102
|
+
✨ Created tsconfig.json
|
|
101
103
|
✨ Created src/index.ts
|
|
104
|
+
✨ Installed @cloudflare/workers-types and typescript into devDependencies
|
|
102
105
|
|
|
103
106
|
To start developing your Worker, run \`npm start\`
|
|
104
107
|
To publish your Worker to the Internet, run \`npm run publish\`",
|
|
@@ -373,8 +376,9 @@ describe("init", () => {
|
|
|
373
376
|
"err": "",
|
|
374
377
|
"out": "✨ Created wrangler.toml
|
|
375
378
|
✨ Created package.json
|
|
376
|
-
✨ Created tsconfig.json
|
|
379
|
+
✨ Created tsconfig.json
|
|
377
380
|
✨ Created src/index.ts
|
|
381
|
+
✨ Installed @cloudflare/workers-types and typescript into devDependencies
|
|
378
382
|
|
|
379
383
|
To start developing your Worker, run \`npm start\`
|
|
380
384
|
To publish your Worker to the Internet, run \`npm run publish\`",
|
|
@@ -397,8 +401,9 @@ describe("init", () => {
|
|
|
397
401
|
"err": "",
|
|
398
402
|
"out": "✨ Created path/to/worker/my-worker/wrangler.toml
|
|
399
403
|
✨ Created path/to/worker/my-worker/package.json
|
|
400
|
-
✨ Created path/to/worker/my-worker/tsconfig.json
|
|
404
|
+
✨ Created path/to/worker/my-worker/tsconfig.json
|
|
401
405
|
✨ Created path/to/worker/my-worker/src/index.ts
|
|
406
|
+
✨ Installed @cloudflare/workers-types and typescript into devDependencies
|
|
402
407
|
|
|
403
408
|
To start developing your Worker, run \`cd path/to/worker/my-worker && npm start\`
|
|
404
409
|
To publish your Worker to the Internet, run \`npm run publish\`",
|
|
@@ -407,10 +412,37 @@ describe("init", () => {
|
|
|
407
412
|
`);
|
|
408
413
|
});
|
|
409
414
|
|
|
415
|
+
// I... don't know how to test this lol
|
|
410
416
|
it.todo(
|
|
411
417
|
"should not offer to initialize a git repo if git is not installed"
|
|
412
418
|
);
|
|
413
|
-
|
|
419
|
+
|
|
420
|
+
it("should initialize git repo with `main` default branch", async () => {
|
|
421
|
+
mockConfirm(
|
|
422
|
+
{
|
|
423
|
+
text: "Would you like to use git to manage this Worker?",
|
|
424
|
+
result: true,
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
text: "No package.json found. Would you like to create one?",
|
|
428
|
+
result: false,
|
|
429
|
+
}
|
|
430
|
+
);
|
|
431
|
+
await runWrangler("init");
|
|
432
|
+
expect(std).toMatchInlineSnapshot(`
|
|
433
|
+
Object {
|
|
434
|
+
"debug": "",
|
|
435
|
+
"err": "",
|
|
436
|
+
"out": "✨ Created wrangler.toml
|
|
437
|
+
✨ Initialized git repository",
|
|
438
|
+
"warn": "",
|
|
439
|
+
}
|
|
440
|
+
`);
|
|
441
|
+
|
|
442
|
+
expect(execaSync("git", ["symbolic-ref", "HEAD"]).stdout).toEqual(
|
|
443
|
+
"refs/heads/main"
|
|
444
|
+
);
|
|
445
|
+
});
|
|
414
446
|
});
|
|
415
447
|
|
|
416
448
|
describe("package.json", () => {
|
|
@@ -616,7 +648,7 @@ describe("init", () => {
|
|
|
616
648
|
"debug": "",
|
|
617
649
|
"err": "",
|
|
618
650
|
"out": "✨ Created wrangler.toml
|
|
619
|
-
✨ Installed wrangler",
|
|
651
|
+
✨ Installed wrangler into devDependencies",
|
|
620
652
|
"warn": "",
|
|
621
653
|
}
|
|
622
654
|
`);
|
|
@@ -664,7 +696,7 @@ describe("init", () => {
|
|
|
664
696
|
"debug": "",
|
|
665
697
|
"err": "",
|
|
666
698
|
"out": "✨ Created path/to/worker/my-worker/wrangler.toml
|
|
667
|
-
✨ Installed wrangler",
|
|
699
|
+
✨ Installed wrangler into devDependencies",
|
|
668
700
|
"warn": "",
|
|
669
701
|
}
|
|
670
702
|
`);
|
|
@@ -801,8 +833,9 @@ describe("init", () => {
|
|
|
801
833
|
"debug": "",
|
|
802
834
|
"err": "",
|
|
803
835
|
"out": "✨ Created wrangler.toml
|
|
804
|
-
✨ Created tsconfig.json
|
|
836
|
+
✨ Created tsconfig.json
|
|
805
837
|
✨ Created src/index.ts
|
|
838
|
+
✨ Installed @cloudflare/workers-types and typescript into devDependencies
|
|
806
839
|
|
|
807
840
|
To start developing your Worker, run \`npx wrangler dev\`
|
|
808
841
|
To publish your Worker to the Internet, run \`npx wrangler publish\`",
|
|
@@ -851,8 +884,9 @@ describe("init", () => {
|
|
|
851
884
|
expect(std.out).toMatchInlineSnapshot(`
|
|
852
885
|
"✨ Created wrangler.toml
|
|
853
886
|
✨ Created package.json
|
|
854
|
-
✨ Created tsconfig.json
|
|
887
|
+
✨ Created tsconfig.json
|
|
855
888
|
✨ Created src/index.ts
|
|
889
|
+
✨ Installed @cloudflare/workers-types and typescript into devDependencies
|
|
856
890
|
|
|
857
891
|
To start developing your Worker, run \`npm start\`
|
|
858
892
|
To publish your Worker to the Internet, run \`npm run publish\`"
|
|
@@ -899,8 +933,9 @@ describe("init", () => {
|
|
|
899
933
|
expect(packageJson.scripts.publish).toBe("test-publish");
|
|
900
934
|
expect(std.out).toMatchInlineSnapshot(`
|
|
901
935
|
"✨ Created wrangler.toml
|
|
902
|
-
✨ Created tsconfig.json
|
|
936
|
+
✨ Created tsconfig.json
|
|
903
937
|
✨ Created src/index.ts
|
|
938
|
+
✨ Installed @cloudflare/workers-types and typescript into devDependencies
|
|
904
939
|
|
|
905
940
|
To start developing your Worker, run \`npx wrangler dev\`
|
|
906
941
|
To publish your Worker to the Internet, run \`npx wrangler publish\`"
|
|
@@ -940,7 +975,8 @@ describe("init", () => {
|
|
|
940
975
|
"debug": "",
|
|
941
976
|
"err": "",
|
|
942
977
|
"out": "✨ Created wrangler.toml
|
|
943
|
-
✨ Created tsconfig.json
|
|
978
|
+
✨ Created tsconfig.json
|
|
979
|
+
✨ Installed @cloudflare/workers-types and typescript into devDependencies",
|
|
944
980
|
"warn": "",
|
|
945
981
|
}
|
|
946
982
|
`);
|
|
@@ -981,7 +1017,8 @@ describe("init", () => {
|
|
|
981
1017
|
"debug": "",
|
|
982
1018
|
"err": "",
|
|
983
1019
|
"out": "✨ Created my-worker/wrangler.toml
|
|
984
|
-
✨ Created my-worker/tsconfig.json
|
|
1020
|
+
✨ Created my-worker/tsconfig.json
|
|
1021
|
+
✨ Installed @cloudflare/workers-types and typescript into devDependencies",
|
|
985
1022
|
"warn": "",
|
|
986
1023
|
}
|
|
987
1024
|
`);
|
|
@@ -1027,7 +1064,8 @@ describe("init", () => {
|
|
|
1027
1064
|
"err": "",
|
|
1028
1065
|
"out": "✨ Created wrangler.toml
|
|
1029
1066
|
✨ Created package.json
|
|
1030
|
-
✨ Created tsconfig.json
|
|
1067
|
+
✨ Created tsconfig.json
|
|
1068
|
+
✨ Installed @cloudflare/workers-types and typescript into devDependencies",
|
|
1031
1069
|
"warn": "",
|
|
1032
1070
|
}
|
|
1033
1071
|
`);
|
|
@@ -1179,8 +1217,8 @@ describe("init", () => {
|
|
|
1179
1217
|
"debug": "",
|
|
1180
1218
|
"err": "",
|
|
1181
1219
|
"out": "✨ Created wrangler.toml
|
|
1182
|
-
✨ Installed @cloudflare/workers-types
|
|
1183
|
-
Please add \\"@cloudflare/workers-types\\" to compilerOptions.types in tsconfig.json",
|
|
1220
|
+
✨ Installed @cloudflare/workers-types into devDependencies
|
|
1221
|
+
🚨 Please add \\"@cloudflare/workers-types\\" to compilerOptions.types in tsconfig.json",
|
|
1184
1222
|
"warn": "",
|
|
1185
1223
|
}
|
|
1186
1224
|
`);
|
|
@@ -1445,8 +1483,9 @@ describe("init", () => {
|
|
|
1445
1483
|
"out": "✨ Created wrangler.toml
|
|
1446
1484
|
✨ Initialized git repository
|
|
1447
1485
|
✨ Created package.json
|
|
1448
|
-
✨ Created tsconfig.json
|
|
1486
|
+
✨ Created tsconfig.json
|
|
1449
1487
|
✨ Created src/index.ts
|
|
1488
|
+
✨ Installed @cloudflare/workers-types and typescript into devDependencies
|
|
1450
1489
|
|
|
1451
1490
|
To start developing your Worker, run \`npm start\`
|
|
1452
1491
|
To publish your Worker to the Internet, run \`npm run publish\`",
|
|
@@ -1473,8 +1512,9 @@ describe("init", () => {
|
|
|
1473
1512
|
"out": "✨ Created path/to/worker/wrangler.toml
|
|
1474
1513
|
✨ Initialized git repository at path/to/worker
|
|
1475
1514
|
✨ Created path/to/worker/package.json
|
|
1476
|
-
✨ Created path/to/worker/tsconfig.json
|
|
1515
|
+
✨ Created path/to/worker/tsconfig.json
|
|
1477
1516
|
✨ Created path/to/worker/src/index.ts
|
|
1517
|
+
✨ Installed @cloudflare/workers-types and typescript into devDependencies
|
|
1478
1518
|
|
|
1479
1519
|
To start developing your Worker, run \`cd path/to/worker && npm start\`
|
|
1480
1520
|
To publish your Worker to the Internet, run \`npm run publish\`",
|
|
@@ -1503,8 +1543,9 @@ describe("init", () => {
|
|
|
1503
1543
|
"out": "✨ Created WEIRD_w0rkr_N4m3.js.tsx.tar.gz/wrangler.toml
|
|
1504
1544
|
✨ Initialized git repository at WEIRD_w0rkr_N4m3.js.tsx.tar.gz
|
|
1505
1545
|
✨ Created WEIRD_w0rkr_N4m3.js.tsx.tar.gz/package.json
|
|
1506
|
-
✨ Created WEIRD_w0rkr_N4m3.js.tsx.tar.gz/tsconfig.json
|
|
1546
|
+
✨ Created WEIRD_w0rkr_N4m3.js.tsx.tar.gz/tsconfig.json
|
|
1507
1547
|
✨ Created WEIRD_w0rkr_N4m3.js.tsx.tar.gz/src/index.ts
|
|
1548
|
+
✨ Installed @cloudflare/workers-types and typescript into devDependencies
|
|
1508
1549
|
|
|
1509
1550
|
To start developing your Worker, run \`cd WEIRD_w0rkr_N4m3.js.tsx.tar.gz && npm start\`
|
|
1510
1551
|
To publish your Worker to the Internet, run \`npm run publish\`",
|
package/src/__tests__/kv.test.ts
CHANGED
|
@@ -1205,10 +1205,10 @@ describe("wrangler", () => {
|
|
|
1205
1205
|
);
|
|
1206
1206
|
expect(requests.count).toEqual(3);
|
|
1207
1207
|
expect(std.out).toMatchInlineSnapshot(`
|
|
1208
|
-
"Uploaded 0 of
|
|
1209
|
-
Uploaded
|
|
1210
|
-
Uploaded
|
|
1211
|
-
Uploaded
|
|
1208
|
+
"Uploaded 0% (0 out of 12,000)
|
|
1209
|
+
Uploaded 41% (5,000 out of 12,000)
|
|
1210
|
+
Uploaded 83% (10,000 out of 12,000)
|
|
1211
|
+
Uploaded 100% (12,000 out of 12,000)
|
|
1212
1212
|
Success!"
|
|
1213
1213
|
`);
|
|
1214
1214
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|
|
@@ -1358,10 +1358,10 @@ describe("wrangler", () => {
|
|
|
1358
1358
|
);
|
|
1359
1359
|
expect(requests.count).toEqual(3);
|
|
1360
1360
|
expect(std.out).toMatchInlineSnapshot(`
|
|
1361
|
-
"Deleted 0 of
|
|
1362
|
-
Deleted
|
|
1363
|
-
Deleted
|
|
1364
|
-
Deleted
|
|
1361
|
+
"Deleted 0% (0 out of 12,000)
|
|
1362
|
+
Deleted 41% (5,000 out of 12,000)
|
|
1363
|
+
Deleted 83% (10,000 out of 12,000)
|
|
1364
|
+
Deleted 100% (12,000 out of 12,000)
|
|
1365
1365
|
Success!"
|
|
1366
1366
|
`);
|
|
1367
1367
|
expect(std.warn).toMatchInlineSnapshot(`""`);
|