wrangler 2.0.2 → 2.0.6
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/Cloudflare_CA.pem +18 -0
- package/bin/wrangler.js +23 -3
- package/package.json +4 -2
- package/pages/functions/buildWorker.ts +1 -1
- package/pages/functions/template-plugin.ts +3 -2
- package/src/__tests__/configuration.test.ts +205 -28
- package/src/__tests__/dev.test.tsx +137 -17
- package/src/__tests__/index.test.ts +55 -63
- package/src/__tests__/jest.setup.ts +8 -0
- package/src/__tests__/kv.test.ts +157 -130
- package/src/__tests__/pages.test.ts +34 -13
- package/src/__tests__/publish.test.ts +362 -14
- package/src/__tests__/r2.test.ts +55 -36
- package/src/__tests__/secret.test.ts +35 -0
- package/src/bundle.ts +32 -1
- package/src/cfetch/internal.ts +3 -0
- package/src/config/config.ts +1 -1
- package/src/config/environment.ts +40 -14
- package/src/config/validation.ts +103 -36
- package/src/create-worker-upload-form.ts +22 -8
- package/src/dev/dev.tsx +5 -2
- package/src/dev/local.tsx +6 -0
- package/src/entry.ts +64 -9
- package/src/index.tsx +119 -68
- package/src/kv.ts +55 -15
- package/src/pages.tsx +11 -5
- package/src/publish.ts +210 -21
- package/src/sites.tsx +13 -11
- package/src/user.tsx +11 -1
- package/src/worker.ts +8 -0
- package/wrangler-dist/cli.js +1430 -1004
|
@@ -44,10 +44,9 @@ describe("wrangler", () => {
|
|
|
44
44
|
wrangler whoami 🕵️ Retrieve your user info and test your auth config
|
|
45
45
|
|
|
46
46
|
Flags:
|
|
47
|
-
-c, --config
|
|
48
|
-
-h, --help
|
|
49
|
-
-v, --version
|
|
50
|
-
--legacy-env Use legacy environments [boolean]"
|
|
47
|
+
-c, --config Path to .toml configuration file [string]
|
|
48
|
+
-h, --help Show help [boolean]
|
|
49
|
+
-v, --version Show version number [boolean]"
|
|
51
50
|
`);
|
|
52
51
|
|
|
53
52
|
expect(std.err).toMatchInlineSnapshot(`""`);
|
|
@@ -64,10 +63,7 @@ describe("wrangler", () => {
|
|
|
64
63
|
|
|
65
64
|
expect(std.out).toMatchInlineSnapshot(`
|
|
66
65
|
"
|
|
67
|
-
|
|
68
|
-
`);
|
|
69
|
-
expect(std.err).toMatchInlineSnapshot(`
|
|
70
|
-
"wrangler
|
|
66
|
+
wrangler
|
|
71
67
|
|
|
72
68
|
Commands:
|
|
73
69
|
wrangler init [name] 📥 Create a wrangler.toml configuration file
|
|
@@ -85,11 +81,12 @@ describe("wrangler", () => {
|
|
|
85
81
|
wrangler whoami 🕵️ Retrieve your user info and test your auth config
|
|
86
82
|
|
|
87
83
|
Flags:
|
|
88
|
-
-c, --config
|
|
89
|
-
-h, --help
|
|
90
|
-
-v, --version
|
|
91
|
-
|
|
92
|
-
|
|
84
|
+
-c, --config Path to .toml configuration file [string]
|
|
85
|
+
-h, --help Show help [boolean]
|
|
86
|
+
-v, --version Show version number [boolean]"
|
|
87
|
+
`);
|
|
88
|
+
expect(std.err).toMatchInlineSnapshot(`
|
|
89
|
+
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1mUnknown argument: invalid-command[0m
|
|
93
90
|
|
|
94
91
|
"
|
|
95
92
|
`);
|
|
@@ -133,10 +130,9 @@ describe("wrangler", () => {
|
|
|
133
130
|
wrangler secret list List all secrets for a script
|
|
134
131
|
|
|
135
132
|
Flags:
|
|
136
|
-
-c, --config
|
|
137
|
-
-h, --help
|
|
138
|
-
-v, --version
|
|
139
|
-
--legacy-env Use legacy environments [boolean]"
|
|
133
|
+
-c, --config Path to .toml configuration file [string]
|
|
134
|
+
-h, --help Show help [boolean]
|
|
135
|
+
-v, --version Show version number [boolean]"
|
|
140
136
|
`);
|
|
141
137
|
});
|
|
142
138
|
|
|
@@ -144,20 +140,19 @@ describe("wrangler", () => {
|
|
|
144
140
|
await runWrangler("kv:namespace");
|
|
145
141
|
await endEventLoop();
|
|
146
142
|
expect(std.out).toMatchInlineSnapshot(`
|
|
147
|
-
|
|
143
|
+
"wrangler kv:namespace
|
|
148
144
|
|
|
149
|
-
|
|
145
|
+
🗂️ Interact with your Workers KV Namespaces
|
|
150
146
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
147
|
+
Commands:
|
|
148
|
+
wrangler kv:namespace create <namespace> Create a new namespace
|
|
149
|
+
wrangler kv:namespace list Outputs a list of all KV namespaces associated with your account id.
|
|
150
|
+
wrangler kv:namespace delete Deletes a given namespace.
|
|
155
151
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
--legacy-env Use legacy environments [boolean]"
|
|
152
|
+
Flags:
|
|
153
|
+
-c, --config Path to .toml configuration file [string]
|
|
154
|
+
-h, --help Show help [boolean]
|
|
155
|
+
-v, --version Show version number [boolean]"
|
|
161
156
|
`);
|
|
162
157
|
});
|
|
163
158
|
|
|
@@ -165,60 +160,57 @@ describe("wrangler", () => {
|
|
|
165
160
|
await runWrangler("kv:key");
|
|
166
161
|
await endEventLoop();
|
|
167
162
|
expect(std.out).toMatchInlineSnapshot(`
|
|
168
|
-
|
|
163
|
+
"wrangler kv:key
|
|
169
164
|
|
|
170
|
-
|
|
165
|
+
🔑 Individually manage Workers KV key-value pairs
|
|
171
166
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
167
|
+
Commands:
|
|
168
|
+
wrangler kv:key put <key> [value] Writes a single key/value pair to the given namespace.
|
|
169
|
+
wrangler kv:key list Outputs a list of all keys in a given namespace.
|
|
170
|
+
wrangler kv:key get <key> Reads a single value by key from the given namespace.
|
|
171
|
+
wrangler kv:key delete <key> Removes a single key value pair from the given namespace.
|
|
177
172
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
`);
|
|
173
|
+
Flags:
|
|
174
|
+
-c, --config Path to .toml configuration file [string]
|
|
175
|
+
-h, --help Show help [boolean]
|
|
176
|
+
-v, --version Show version number [boolean]"
|
|
177
|
+
`);
|
|
184
178
|
});
|
|
185
179
|
|
|
186
180
|
it("no subcommand 'kv:bulk' should display a list of available subcommands", async () => {
|
|
187
181
|
await runWrangler("kv:bulk");
|
|
188
182
|
await endEventLoop();
|
|
189
183
|
expect(std.out).toMatchInlineSnapshot(`
|
|
190
|
-
|
|
184
|
+
"wrangler kv:bulk
|
|
191
185
|
|
|
192
|
-
|
|
186
|
+
💪 Interact with multiple Workers KV key-value pairs at once
|
|
193
187
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
188
|
+
Commands:
|
|
189
|
+
wrangler kv:bulk put <filename> Upload multiple key-value pairs to a namespace
|
|
190
|
+
wrangler kv:bulk delete <filename> Delete multiple key-value pairs from a namespace
|
|
197
191
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
`);
|
|
192
|
+
Flags:
|
|
193
|
+
-c, --config Path to .toml configuration file [string]
|
|
194
|
+
-h, --help Show help [boolean]
|
|
195
|
+
-v, --version Show version number [boolean]"
|
|
196
|
+
`);
|
|
204
197
|
});
|
|
205
198
|
it("no subcommand 'r2' should display a list of available subcommands", async () => {
|
|
206
199
|
await runWrangler("r2");
|
|
207
200
|
await endEventLoop();
|
|
208
201
|
expect(std.out).toMatchInlineSnapshot(`
|
|
209
|
-
|
|
202
|
+
"wrangler r2
|
|
210
203
|
|
|
211
|
-
|
|
204
|
+
📦 Interact with an R2 store
|
|
212
205
|
|
|
213
|
-
|
|
214
|
-
|
|
206
|
+
Commands:
|
|
207
|
+
wrangler r2 bucket Manage R2 buckets
|
|
215
208
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
`);
|
|
209
|
+
Flags:
|
|
210
|
+
-c, --config Path to .toml configuration file [string]
|
|
211
|
+
-h, --help Show help [boolean]
|
|
212
|
+
-v, --version Show version number [boolean]"
|
|
213
|
+
`);
|
|
222
214
|
});
|
|
223
215
|
});
|
|
224
216
|
describe("Deprecated commands", () => {
|
|
@@ -241,7 +233,7 @@ describe("wrangler", () => {
|
|
|
241
233
|
await runWrangler("build").catch((err) => {
|
|
242
234
|
expect(err.message).toMatchInlineSnapshot(`
|
|
243
235
|
"Deprecation:
|
|
244
|
-
\`wrangler build\` has been deprecated, please refer to https://
|
|
236
|
+
\`wrangler build\` has been deprecated, please refer to https://developers.cloudflare.com/workers/wrangler/migration/deprecations/#build for alternatives"
|
|
245
237
|
`);
|
|
246
238
|
});
|
|
247
239
|
});
|
|
@@ -8,6 +8,14 @@ import { confirm, prompt } from "../dialogs";
|
|
|
8
8
|
import { mockFetchInternal, mockFetchKVGetValue } from "./helpers/mock-cfetch";
|
|
9
9
|
import { MockWebSocket } from "./helpers/mock-web-socket";
|
|
10
10
|
|
|
11
|
+
// Mock out getPort since we don't actually care about what ports are open in unit tests.
|
|
12
|
+
jest.mock("get-port", () => {
|
|
13
|
+
return {
|
|
14
|
+
__esModule: true,
|
|
15
|
+
default: jest.fn().mockImplementation(async (options) => options.port),
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
|
|
11
19
|
jest.mock("ws", () => {
|
|
12
20
|
return {
|
|
13
21
|
__esModule: true,
|