wrangler 2.0.5 → 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.
@@ -48,10 +48,7 @@ describe("wrangler", () => {
48
48
  );
49
49
  expect(std.out).toMatchInlineSnapshot(`
50
50
  "
51
- "
52
- `);
53
- expect(std.err).toMatchInlineSnapshot(`
54
- "wrangler kv:namespace create <namespace>
51
+ wrangler kv:namespace create <namespace>
55
52
 
56
53
  Create a new namespace
57
54
 
@@ -65,8 +62,10 @@ describe("wrangler", () => {
65
62
 
66
63
  Options:
67
64
  -e, --env Perform on a specific environment [string]
68
- --preview Interact with a preview namespace [boolean]
69
- X [ERROR] Not enough non-option arguments: got 0, need at least 1
65
+ --preview Interact with a preview namespace [boolean]"
66
+ `);
67
+ expect(std.err).toMatchInlineSnapshot(`
68
+ "X [ERROR] Not enough non-option arguments: got 0, need at least 1
70
69
 
71
70
  "
72
71
  `);
@@ -80,10 +79,7 @@ describe("wrangler", () => {
80
79
  );
81
80
  expect(std.out).toMatchInlineSnapshot(`
82
81
  "
83
- "
84
- `);
85
- expect(std.err).toMatchInlineSnapshot(`
86
- "wrangler kv:namespace create <namespace>
82
+ wrangler kv:namespace create <namespace>
87
83
 
88
84
  Create a new namespace
89
85
 
@@ -97,8 +93,10 @@ describe("wrangler", () => {
97
93
 
98
94
  Options:
99
95
  -e, --env Perform on a specific environment [string]
100
- --preview Interact with a preview namespace [boolean]
101
- X [ERROR] Unknown arguments: def, ghi
96
+ --preview Interact with a preview namespace [boolean]"
97
+ `);
98
+ expect(std.err).toMatchInlineSnapshot(`
99
+ "X [ERROR] Unknown arguments: def, ghi
102
100
 
103
101
  "
104
102
  `);
@@ -113,10 +111,7 @@ describe("wrangler", () => {
113
111
 
114
112
  expect(std.out).toMatchInlineSnapshot(`
115
113
  "
116
- "
117
- `);
118
- expect(std.err).toMatchInlineSnapshot(`
119
- "wrangler kv:namespace create <namespace>
114
+ wrangler kv:namespace create <namespace>
120
115
 
121
116
  Create a new namespace
122
117
 
@@ -130,8 +125,10 @@ describe("wrangler", () => {
130
125
 
131
126
  Options:
132
127
  -e, --env Perform on a specific environment [string]
133
- --preview Interact with a preview namespace [boolean]
134
- X [ERROR] The namespace binding name \\"abc-def\\" is invalid. It can only have alphanumeric and _ characters, and cannot begin with a number.
128
+ --preview Interact with a preview namespace [boolean]"
129
+ `);
130
+ expect(std.err).toMatchInlineSnapshot(`
131
+ "X [ERROR] The namespace binding name \\"abc-def\\" is invalid. It can only have alphanumeric and _ characters, and cannot begin with a number.
135
132
 
136
133
  "
137
134
  `);
@@ -283,21 +280,7 @@ describe("wrangler", () => {
283
280
  A namespace with binding name \\"otherBinding\\" was not found in the configured \\"kv_namespaces\\"."
284
281
  `);
285
282
  expect(std.err).toMatchInlineSnapshot(`
286
- "wrangler kv:namespace delete
287
-
288
- Deletes a given namespace.
289
-
290
- Flags:
291
- -c, --config Path to .toml configuration file [string]
292
- -h, --help Show help [boolean]
293
- -v, --version Show version number [boolean]
294
-
295
- Options:
296
- --binding The name of the namespace to delete [string]
297
- --namespace-id The id of the namespace to delete [string]
298
- -e, --env Perform on a specific environment [string]
299
- --preview Interact with a preview namespace [boolean]
300
- X [ERROR] Not able to delete namespace.
283
+ "X [ERROR] Not able to delete namespace.
301
284
 
302
285
  A namespace with binding name \\"otherBinding\\" was not found in the configured \\"kv_namespaces\\".
303
286
 
@@ -489,10 +472,7 @@ describe("wrangler", () => {
489
472
 
490
473
  expect(std.out).toMatchInlineSnapshot(`
491
474
  "
492
- "
493
- `);
494
- expect(std.err).toMatchInlineSnapshot(`
495
- "wrangler kv:key put <key> [value]
475
+ wrangler kv:key put <key> [value]
496
476
 
497
477
  Writes a single key/value pair to the given namespace.
498
478
 
@@ -512,8 +492,10 @@ describe("wrangler", () => {
512
492
  --preview Interact with a preview namespace [boolean]
513
493
  --ttl Time for which the entries should be visible [number]
514
494
  --expiration Time since the UNIX epoch after which the entry expires [number]
515
- --path Read value from the file at a given path [string]
516
- X [ERROR] Not enough non-option arguments: got 0, need at least 1
495
+ --path Read value from the file at a given path [string]"
496
+ `);
497
+ expect(std.err).toMatchInlineSnapshot(`
498
+ "X [ERROR] Not enough non-option arguments: got 0, need at least 1
517
499
 
518
500
  "
519
501
  `);
@@ -528,10 +510,7 @@ describe("wrangler", () => {
528
510
 
529
511
  expect(std.out).toMatchInlineSnapshot(`
530
512
  "
531
- "
532
- `);
533
- expect(std.err).toMatchInlineSnapshot(`
534
- "wrangler kv:key put <key> [value]
513
+ wrangler kv:key put <key> [value]
535
514
 
536
515
  Writes a single key/value pair to the given namespace.
537
516
 
@@ -551,8 +530,10 @@ describe("wrangler", () => {
551
530
  --preview Interact with a preview namespace [boolean]
552
531
  --ttl Time for which the entries should be visible [number]
553
532
  --expiration Time since the UNIX epoch after which the entry expires [number]
554
- --path Read value from the file at a given path [string]
555
- X [ERROR] Exactly one of the arguments binding and namespace-id is required
533
+ --path Read value from the file at a given path [string]"
534
+ `);
535
+ expect(std.err).toMatchInlineSnapshot(`
536
+ "X [ERROR] Exactly one of the arguments binding and namespace-id is required
556
537
 
557
538
  "
558
539
  `);
@@ -567,10 +548,7 @@ describe("wrangler", () => {
567
548
 
568
549
  expect(std.out).toMatchInlineSnapshot(`
569
550
  "
570
- "
571
- `);
572
- expect(std.err).toMatchInlineSnapshot(`
573
- "wrangler kv:key put <key> [value]
551
+ wrangler kv:key put <key> [value]
574
552
 
575
553
  Writes a single key/value pair to the given namespace.
576
554
 
@@ -590,8 +568,10 @@ describe("wrangler", () => {
590
568
  --preview Interact with a preview namespace [boolean]
591
569
  --ttl Time for which the entries should be visible [number]
592
570
  --expiration Time since the UNIX epoch after which the entry expires [number]
593
- --path Read value from the file at a given path [string]
594
- X [ERROR] Arguments binding and namespace-id are mutually exclusive
571
+ --path Read value from the file at a given path [string]"
572
+ `);
573
+ expect(std.err).toMatchInlineSnapshot(`
574
+ "X [ERROR] Arguments binding and namespace-id are mutually exclusive
595
575
 
596
576
  "
597
577
  `);
@@ -606,10 +586,7 @@ describe("wrangler", () => {
606
586
 
607
587
  expect(std.out).toMatchInlineSnapshot(`
608
588
  "
609
- "
610
- `);
611
- expect(std.err).toMatchInlineSnapshot(`
612
- "wrangler kv:key put <key> [value]
589
+ wrangler kv:key put <key> [value]
613
590
 
614
591
  Writes a single key/value pair to the given namespace.
615
592
 
@@ -629,8 +606,10 @@ describe("wrangler", () => {
629
606
  --preview Interact with a preview namespace [boolean]
630
607
  --ttl Time for which the entries should be visible [number]
631
608
  --expiration Time since the UNIX epoch after which the entry expires [number]
632
- --path Read value from the file at a given path [string]
633
- X [ERROR] Exactly one of the arguments value and path is required
609
+ --path Read value from the file at a given path [string]"
610
+ `);
611
+ expect(std.err).toMatchInlineSnapshot(`
612
+ "X [ERROR] Exactly one of the arguments value and path is required
634
613
 
635
614
  "
636
615
  `);
@@ -645,10 +624,7 @@ describe("wrangler", () => {
645
624
 
646
625
  expect(std.out).toMatchInlineSnapshot(`
647
626
  "
648
- "
649
- `);
650
- expect(std.err).toMatchInlineSnapshot(`
651
- "wrangler kv:key put <key> [value]
627
+ wrangler kv:key put <key> [value]
652
628
 
653
629
  Writes a single key/value pair to the given namespace.
654
630
 
@@ -668,8 +644,10 @@ describe("wrangler", () => {
668
644
  --preview Interact with a preview namespace [boolean]
669
645
  --ttl Time for which the entries should be visible [number]
670
646
  --expiration Time since the UNIX epoch after which the entry expires [number]
671
- --path Read value from the file at a given path [string]
672
- X [ERROR] Arguments value and path are mutually exclusive
647
+ --path Read value from the file at a given path [string]"
648
+ `);
649
+ expect(std.err).toMatchInlineSnapshot(`
650
+ "X [ERROR] Arguments value and path are mutually exclusive
673
651
 
674
652
  "
675
653
  `);
@@ -965,10 +943,7 @@ describe("wrangler", () => {
965
943
  );
966
944
  expect(std.out).toMatchInlineSnapshot(`
967
945
  "
968
- "
969
- `);
970
- expect(std.err).toMatchInlineSnapshot(`
971
- "wrangler kv:key get <key>
946
+ wrangler kv:key get <key>
972
947
 
973
948
  Reads a single value by key from the given namespace.
974
949
 
@@ -984,8 +959,10 @@ describe("wrangler", () => {
984
959
  --binding The name of the namespace to get from [string]
985
960
  --namespace-id The id of the namespace to get from [string]
986
961
  -e, --env Perform on a specific environment [string]
987
- --preview Interact with a preview namespace [boolean] [default: false]
988
- X [ERROR] Not enough non-option arguments: got 0, need at least 1
962
+ --preview Interact with a preview namespace [boolean] [default: false]"
963
+ `);
964
+ expect(std.err).toMatchInlineSnapshot(`
965
+ "X [ERROR] Not enough non-option arguments: got 0, need at least 1
989
966
 
990
967
  "
991
968
  `);
@@ -999,10 +976,7 @@ describe("wrangler", () => {
999
976
  );
1000
977
  expect(std.out).toMatchInlineSnapshot(`
1001
978
  "
1002
- "
1003
- `);
1004
- expect(std.err).toMatchInlineSnapshot(`
1005
- "wrangler kv:key get <key>
979
+ wrangler kv:key get <key>
1006
980
 
1007
981
  Reads a single value by key from the given namespace.
1008
982
 
@@ -1018,8 +992,10 @@ describe("wrangler", () => {
1018
992
  --binding The name of the namespace to get from [string]
1019
993
  --namespace-id The id of the namespace to get from [string]
1020
994
  -e, --env Perform on a specific environment [string]
1021
- --preview Interact with a preview namespace [boolean] [default: false]
1022
- X [ERROR] Exactly one of the arguments binding and namespace-id is required
995
+ --preview Interact with a preview namespace [boolean] [default: false]"
996
+ `);
997
+ expect(std.err).toMatchInlineSnapshot(`
998
+ "X [ERROR] Exactly one of the arguments binding and namespace-id is required
1023
999
 
1024
1000
  "
1025
1001
  `);
@@ -1034,10 +1010,7 @@ describe("wrangler", () => {
1034
1010
 
1035
1011
  expect(std.out).toMatchInlineSnapshot(`
1036
1012
  "
1037
- "
1038
- `);
1039
- expect(std.err).toMatchInlineSnapshot(`
1040
- "wrangler kv:key get <key>
1013
+ wrangler kv:key get <key>
1041
1014
 
1042
1015
  Reads a single value by key from the given namespace.
1043
1016
 
@@ -1053,8 +1026,10 @@ describe("wrangler", () => {
1053
1026
  --binding The name of the namespace to get from [string]
1054
1027
  --namespace-id The id of the namespace to get from [string]
1055
1028
  -e, --env Perform on a specific environment [string]
1056
- --preview Interact with a preview namespace [boolean] [default: false]
1057
- X [ERROR] Arguments binding and namespace-id are mutually exclusive
1029
+ --preview Interact with a preview namespace [boolean] [default: false]"
1030
+ `);
1031
+ expect(std.err).toMatchInlineSnapshot(`
1032
+ "X [ERROR] Arguments binding and namespace-id are mutually exclusive
1058
1033
 
1059
1034
  "
1060
1035
  `);
@@ -1262,7 +1237,25 @@ describe("wrangler", () => {
1262
1237
  "a string",
1263
1238
  { key: "someKey" },
1264
1239
  { value: "someValue" },
1240
+ // add a valid object here to make sure it's not included
1241
+ { key: "someKey1", value: "someValue1" },
1242
+ // this one will only add a warning
1265
1243
  { key: "someKey1", value: "someValue1", invalid: true },
1244
+ // back to the invalid ones
1245
+ { key: 123, value: "somevalue" },
1246
+ { key: "somekey", value: 123 },
1247
+ { key: "someKey1", value: "someValue1", expiration: "string" },
1248
+ { key: "someKey1", value: "someValue1", expiration_ttl: "string" },
1249
+ {
1250
+ key: 123,
1251
+ value: {
1252
+ a: {
1253
+ nested: "object",
1254
+ },
1255
+ },
1256
+ },
1257
+ { key: "someKey1", value: "someValue1", metadata: 123 },
1258
+ { key: "someKey1", value: "someValue1", base64: "string" },
1266
1259
  ];
1267
1260
  writeFileSync("./keys.json", JSON.stringify(keyValues));
1268
1261
  await expect(
@@ -1280,10 +1273,17 @@ describe("wrangler", () => {
1280
1273
  base64?: boolean;
1281
1274
  }
1282
1275
 
1283
- The item at index 0 is type: \\"number\\" - 123
1284
- The item at index 1 is type: \\"string\\" - \\"a string\\"
1276
+ The item at index 0 is 123
1277
+ The item at index 1 is \\"a string\\"
1285
1278
  The item at index 2 is {\\"key\\":\\"someKey\\"}
1286
- The item at index 3 is {\\"value\\":\\"someValue\\"}"
1279
+ The item at index 3 is {\\"value\\":\\"someValue\\"}
1280
+ The item at index 6 is {\\"key\\":123,\\"value\\":\\"somevalue\\"}
1281
+ The item at index 7 is {\\"key\\":\\"somekey\\",\\"value\\":123}
1282
+ The item at index 8 is {\\"key\\":\\"someKey1\\",\\"value\\":\\"someValue1\\",\\"expiration\\":\\"string\\"}
1283
+ The item at index 9 is {\\"key\\":\\"someKey1\\",\\"value\\":\\"someValue1\\",\\"expiration_ttl\\":\\"string\\"}
1284
+ The item at index 10 is {\\"key\\":123,\\"value\\":{\\"a\\":{\\"nested\\":\\"object\\"}}}
1285
+ The item at index 11 is {\\"key\\":\\"someKey1\\",\\"value\\":\\"someValue1\\",\\"metadata\\":123}
1286
+ The item at index 12 is {\\"key\\":\\"someKey1\\",\\"value\\":\\"someValue1\\",\\"base64\\":\\"string\\"}"
1287
1287
  `);
1288
1288
 
1289
1289
  expect(std.out).toMatchInlineSnapshot(`
@@ -1293,7 +1293,7 @@ describe("wrangler", () => {
1293
1293
  expect(std.warn).toMatchInlineSnapshot(`
1294
1294
  "▲ [WARNING] Unexpected key-value properties in \\"keys.json\\".
1295
1295
 
1296
- The item at index 4 contains unexpected properties: [\\"invalid\\"].
1296
+ The item at index 5 contains unexpected properties: [\\"invalid\\"].
1297
1297
 
1298
1298
  "
1299
1299
  `);
@@ -1,4 +1,4 @@
1
- import { writeFileSync } from "node:fs";
1
+ import { mkdirSync, writeFileSync } from "node:fs";
2
2
  import { mockAccountId, mockApiToken } from "./helpers/mock-account-id";
3
3
  import { setMockResponse, unsetAllMocks } from "./helpers/mock-cfetch";
4
4
  import { mockConsoleMethods } from "./helpers/mock-console";
@@ -24,10 +24,10 @@ describe("pages", () => {
24
24
  ⚡️ Configure Cloudflare Pages
25
25
 
26
26
  Commands:
27
- wrangler pages dev [directory] [-- command] 🧑‍💻 Develop your full-stack Pages application locally
28
- wrangler pages project ⚡️ Interact with your Pages projects
29
- wrangler pages deployment 🚀 Interact with the deployments of a project
30
- wrangler pages publish [directory] 🆙 Publish a directory of static assets as a Pages deployment
27
+ wrangler pages dev [directory] [-- command..] 🧑‍💻 Develop your full-stack Pages application locally
28
+ wrangler pages project ⚡️ Interact with your Pages projects
29
+ wrangler pages deployment 🚀 Interact with the deployments of a project
30
+ wrangler pages publish [directory] 🆙 Publish a directory of static assets as a Pages deployment
31
31
 
32
32
  Flags:
33
33
  -c, --config Path to .toml configuration file [string]
@@ -323,5 +323,28 @@ describe("pages", () => {
323
323
  // ✨ Deployment complete! Take a peek over at https://abcxyz.foo.pages.dev/"
324
324
  // `);
325
325
  });
326
+
327
+ it("should not error when directory names contain periods and houses a extensionless file", async () => {
328
+ mkdirSync(".well-known");
329
+ writeFileSync(".well-known/foobar", "foobar");
330
+
331
+ setMockResponse(
332
+ "/accounts/:accountId/pages/projects/foo/file",
333
+ async () => ({
334
+ id: "7b764dacfd211bebd8077828a7ddefd7",
335
+ })
336
+ );
337
+
338
+ setMockResponse(
339
+ "/accounts/:accountId/pages/projects/foo/deployments",
340
+ async () => ({
341
+ url: "https://abcxyz.foo.pages.dev/",
342
+ })
343
+ );
344
+
345
+ await runWrangler("pages publish . --project-name=foo");
346
+
347
+ expect(std.err).toMatchInlineSnapshot(`""`);
348
+ });
326
349
  });
327
350
  });