Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrangler v4 #7334

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
32b5102
ci: setup next branch with prereleases to next tag
penalosa Nov 20, 2024
7fbb44f
chore: remove deprecated `getBindingsProxy` (#5005)
dario-piotrowicz Mar 7, 2024
4af0d79
Require Node v18 in Wrangler v4 (#7338)
penalosa Nov 29, 2024
e40c66f
Remove node_compat in Wrangler & Miniflare v4 (#7336)
penalosa Feb 18, 2025
fbf6feb
Remove v2 warning (#7228)
penalosa Dec 2, 2024
0e95d46
chore: update esbuild (#6884)
penalosa Feb 18, 2025
08f84db
`--local` by default for `wrangler kv` & `wrangler r2` (#7392)
penalosa Dec 6, 2024
cb6f3c9
deprecate unused D1 commands/options (#7471)
rozenmd Dec 10, 2024
c5175e3
Remove deprecated commands & config (#7352)
penalosa Dec 2, 2024
f6bce8a
various test fixes after rebase
penalosa Feb 18, 2025
1551c69
fixup! chore: update esbuild (#6884)
penalosa Feb 18, 2025
5cb917d
fixup! Remove node_compat in Wrangler & Miniflare v4 (#7336)
penalosa Feb 18, 2025
d702a2f
feat(wrangler): Drop worker prefix when creating KV namespaces (#7759)
pmiguel Feb 19, 2025
435f155
Include node version in name
penalosa Feb 19, 2025
74bde06
Ignore kv-asset-handler tests on Node 22
penalosa Feb 19, 2025
c7bfef9
rename tests
penalosa Feb 19, 2025
9ce1df6
Rename positional `json` args. Fixes #7688
penalosa Feb 19, 2025
389cc9e
unescape
penalosa Feb 19, 2025
edb32e3
fix tests
penalosa Feb 19, 2025
24cbc22
Update .changeset/funny-pets-punch.md
penalosa Feb 19, 2025
f0f1d26
Add system requirements to the README
penalosa Feb 19, 2025
6307025
fix formatting
penalosa Feb 19, 2025
f6ca096
fix formatting
penalosa Feb 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/funny-pets-punch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": major
---

Use `--local` by default for KV & R2
7 changes: 3 additions & 4 deletions packages/wrangler/e2e/dev-with-resources.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,7 @@ describe.sequential.each(RUNTIMES)("Core: $flags", ({ runtime, flags }) => {

describe.sequential.each(RUNTIMES)("Bindings: $flags", ({ runtime, flags }) => {
const isLocal = runtime === "local";
const resourceFlags = isLocal ? "--local" : "";
const d1ResourceFlags = isLocal ? "" : "--remote";
const resourceFlags = isLocal ? "" : "--remote";

let helper: WranglerE2ETestHelper;
beforeEach(() => {
Expand Down Expand Up @@ -497,7 +496,7 @@ describe.sequential.each(RUNTIMES)("Bindings: $flags", ({ runtime, flags }) => {
});

const result = await helper.run(
`wrangler d1 execute ${d1ResourceFlags} DB --file schema.sql`
`wrangler d1 execute ${resourceFlags} DB --file schema.sql`
);
// D1 defaults to `--local`, so we deliberately use `flags`, not `resourceFlags`
const worker = helper.runLongLived(
Expand All @@ -511,7 +510,7 @@ describe.sequential.each(RUNTIMES)("Bindings: $flags", ({ runtime, flags }) => {
}

const result2 = await helper.run(
`wrangler d1 execute ${d1ResourceFlags} DB --command "SELECT * FROM entries WHERE key = 'key2'"`
`wrangler d1 execute ${resourceFlags} DB --command "SELECT * FROM entries WHERE key = 'key2'"`
);
expect(result2.stdout).toContain("value2");
if (isLocal) {
Expand Down
10 changes: 5 additions & 5 deletions packages/wrangler/e2e/r2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe("r2", () => {
"test-r2.txt": fileContents,
});
const output = await helper.run(
`wrangler r2 object put ${bucketName}/testr2 --file test-r2.txt --content-type text/html`
`wrangler r2 object put ${bucketName}/testr2 --file test-r2.txt --content-type text/html --remote`
);
expect(normalize(output.stdout)).toMatchInlineSnapshot(`
"Creating object "testr2" in bucket "tmp-e2e-r2-00000000-0000-0000-0000-000000000000".
Expand All @@ -49,7 +49,7 @@ describe("r2", () => {

it("download object", async () => {
const output = await helper.run(
`wrangler r2 object get ${bucketName}/testr2 --file test-r2o.txt`
`wrangler r2 object get ${bucketName}/testr2 --file test-r2o.txt --remote`
);
expect(normalize(output.stdout)).toMatchInlineSnapshot(`
"Downloading "testr2" from "tmp-e2e-r2-00000000-0000-0000-0000-000000000000".
Expand All @@ -64,7 +64,7 @@ describe("r2", () => {

it("delete object", async () => {
const output = await helper.run(
`wrangler r2 object delete ${bucketName}/testr2`
`wrangler r2 object delete ${bucketName}/testr2 --remote`
);
expect(normalize(output.stdout)).toMatchInlineSnapshot(`
"Deleting object "testr2" from bucket "tmp-e2e-r2-00000000-0000-0000-0000-000000000000".
Expand All @@ -74,7 +74,7 @@ describe("r2", () => {

it("check object deleted", async () => {
const output = await helper.run(
`wrangler r2 object get ${bucketName}/testr2 --file test-r2o.txt`
`wrangler r2 object get ${bucketName}/testr2 --file test-r2o.txt --remote`
);
expect(output.stderr).toContain("The specified key does not exist");
});
Expand All @@ -92,7 +92,7 @@ describe("r2", () => {
"test-r2.txt": fileContents,
});
const output = await helper.run(
`wrangler r2 object put ${bucketName}/testr2 --file test-r2.txt --content-type text/html`
`wrangler r2 object put ${bucketName}/testr2 --file test-r2.txt --content-type text/html --remote`
);
expect(output.stderr).toContain("The specified bucket does not exist");
});
Expand Down
62 changes: 30 additions & 32 deletions packages/wrangler/src/__tests__/kv.local.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ describe("wrangler", () => {
describe("local", () => {
it("should put local kv storage", async () => {
await runWrangler(
`kv:key get val --namespace-id some-namespace-id --local --text`
`kv key get val --namespace-id some-namespace-id --text`
);
expect(std.out).toMatchInlineSnapshot(`"Value not found"`);

await runWrangler(
`kv:key put val value --namespace-id some-namespace-id --local`
`kv key put val value --namespace-id some-namespace-id `
);
expect(std.out).toMatchInlineSnapshot(`
"Value not found
Writing the value \\"value\\" to key \\"val\\" on namespace some-namespace-id."
`);

await runWrangler(
`kv:key get val --namespace-id some-namespace-id --local --text`
`kv key get val --namespace-id some-namespace-id --text`
);
expect(std.out).toMatchInlineSnapshot(`
"Value not found
Expand All @@ -36,7 +36,7 @@ describe("wrangler", () => {
});

it("should list local kv storage", async () => {
await runWrangler(`kv:key list --namespace-id some-namespace-id --local`);
await runWrangler(`kv key list --namespace-id some-namespace-id`);
expect(std.out).toMatchInlineSnapshot(`"[]"`);
const keyValues = [
{
Expand All @@ -58,10 +58,10 @@ describe("wrangler", () => {
];
writeFileSync("./keys.json", JSON.stringify(keyValues));
await runWrangler(
`kv:bulk put keys.json --namespace-id some-namespace-id --local`
`kv bulk put keys.json --namespace-id some-namespace-id`
);

await runWrangler(`kv:key list --namespace-id some-namespace-id --local`);
await runWrangler(`kv key list --namespace-id some-namespace-id`);
expect(std.out).toMatchInlineSnapshot(`
"[]
Success!
Expand All @@ -82,13 +82,13 @@ describe("wrangler", () => {
`);

await runWrangler(
`kv:key list --namespace-id some-namespace-id --local --prefix a`
`kv key list --namespace-id some-namespace-id --prefix a`
);
await runWrangler(
`kv:key list --namespace-id some-namespace-id --local --prefix a/b`
`kv key list --namespace-id some-namespace-id --prefix a/b`
);
await runWrangler(
`kv:key list --namespace-id some-namespace-id --local --prefix abc`
`kv key list --namespace-id some-namespace-id --prefix abc`
);

expect(std.out).toMatchInlineSnapshot(`
Expand Down Expand Up @@ -130,26 +130,24 @@ describe("wrangler", () => {

it("should delete local kv storage", async () => {
await runWrangler(
`kv:key put val value --namespace-id some-namespace-id --local`
`kv key put val value --namespace-id some-namespace-id`
);
await runWrangler(
`kv:key get val --namespace-id some-namespace-id --local --text`
`kv key get val --namespace-id some-namespace-id --text`
);
expect(std.out).toMatchInlineSnapshot(`
"Writing the value \\"value\\" to key \\"val\\" on namespace some-namespace-id.
value"
`);
await runWrangler(
`kv:key delete val --namespace-id some-namespace-id --local`
);
await runWrangler(`kv key delete val --namespace-id some-namespace-id`);
expect(std.out).toMatchInlineSnapshot(`
"Writing the value \\"value\\" to key \\"val\\" on namespace some-namespace-id.
value
Deleting the key \\"val\\" on namespace some-namespace-id."
`);

await runWrangler(
`kv:key get val --namespace-id some-namespace-id --local --text`
`kv key get val --namespace-id some-namespace-id --text`
);
expect(std.out).toMatchInlineSnapshot(`
"Writing the value \\"value\\" to key \\"val\\" on namespace some-namespace-id.
Expand All @@ -160,7 +158,7 @@ describe("wrangler", () => {
});

it("should put local bulk kv storage", async () => {
await runWrangler(`kv:key list --namespace-id bulk-namespace-id --local`);
await runWrangler(`kv key list --namespace-id bulk-namespace-id`);
expect(std.out).toMatchInlineSnapshot(`"[]"`);

const keyValues = [
Expand All @@ -175,23 +173,23 @@ describe("wrangler", () => {
];
writeFileSync("./keys.json", JSON.stringify(keyValues));
await runWrangler(
`kv:bulk put keys.json --namespace-id bulk-namespace-id --local`
`kv bulk put keys.json --namespace-id bulk-namespace-id`
);
expect(std.out).toMatchInlineSnapshot(`
"[]
Success!"
`);

await runWrangler(
`kv:key get test --namespace-id bulk-namespace-id --local --text`
`kv key get test --namespace-id bulk-namespace-id --text`
);
expect(std.out).toMatchInlineSnapshot(`
"[]
Success!
value"
`);

await runWrangler(`kv:key list --namespace-id bulk-namespace-id --local`);
await runWrangler(`kv key list --namespace-id bulk-namespace-id`);
expect(std.out).toMatchInlineSnapshot(`
"[]
Success!
Expand All @@ -207,7 +205,7 @@ describe("wrangler", () => {
`);
});

it("should delete local bulk kv storage (string)", async () => {
it("should delete local bulk kv storage", async () => {
const keyValues = [
{
key: "hello",
Expand All @@ -220,9 +218,9 @@ describe("wrangler", () => {
];
writeFileSync("./keys.json", JSON.stringify(keyValues));
await runWrangler(
`kv:bulk put keys.json --namespace-id bulk-namespace-id --local`
`kv bulk put keys.json --namespace-id bulk-namespace-id`
);
await runWrangler(`kv:key list --namespace-id bulk-namespace-id --local`);
await runWrangler(`kv key list --namespace-id bulk-namespace-id`);
expect(std.out).toMatchInlineSnapshot(`
"Success!
[
Expand All @@ -237,7 +235,7 @@ describe("wrangler", () => {
const keys = ["hello", "test"];
writeFileSync("./keys.json", JSON.stringify(keys));
await runWrangler(
`kv:bulk delete keys.json --namespace-id bulk-namespace-id --local --force`
`kv bulk delete keys.json --namespace-id bulk-namespace-id --force`
);
expect(std.out).toMatchInlineSnapshot(`
"Success!
Expand All @@ -252,7 +250,7 @@ describe("wrangler", () => {
Success!"
`);

await runWrangler(`kv:key list --namespace-id bulk-namespace-id --local`);
await runWrangler(`kv key list --namespace-id bulk-namespace-id`);
expect(std.out).toMatchInlineSnapshot(`
"Success!
[
Expand Down Expand Up @@ -281,9 +279,9 @@ describe("wrangler", () => {
];
writeFileSync("./keys.json", JSON.stringify(keyValues));
await runWrangler(
`kv bulk put keys.json --namespace-id bulk-namespace-id --local`
`kv bulk put keys.json --namespace-id bulk-namespace-id`
);
await runWrangler(`kv key list --namespace-id bulk-namespace-id --local`);
await runWrangler(`kv key list --namespace-id bulk-namespace-id`);
expect(std.out).toMatchInlineSnapshot(`
"Success!
[
Expand All @@ -305,7 +303,7 @@ describe("wrangler", () => {
];
writeFileSync("./keys.json", JSON.stringify(keys));
await runWrangler(
`kv bulk delete keys.json --namespace-id bulk-namespace-id --local --force`
`kv bulk delete keys.json --namespace-id bulk-namespace-id --force`
);
expect(std.out).toMatchInlineSnapshot(`
"Success!
Expand All @@ -320,7 +318,7 @@ describe("wrangler", () => {
Success!"
`);

await runWrangler(`kv key list --namespace-id bulk-namespace-id --local`);
await runWrangler(`kv key list --namespace-id bulk-namespace-id`);
expect(std.out).toMatchInlineSnapshot(`
"Success!
[
Expand All @@ -338,19 +336,19 @@ describe("wrangler", () => {

it("should follow persist-to for local kv storage", async () => {
await runWrangler(
`kv:key put val value --namespace-id some-namespace-id --local`
`kv key put val value --namespace-id some-namespace-id`
);

await runWrangler(
`kv:key put val persistValue --namespace-id some-namespace-id --local --persist-to ./persistdir`
`kv key put val persistValue --namespace-id some-namespace-id --persist-to ./persistdir`
);
expect(std.out).toMatchInlineSnapshot(`
"Writing the value \\"value\\" to key \\"val\\" on namespace some-namespace-id.
Writing the value \\"persistValue\\" to key \\"val\\" on namespace some-namespace-id."
`);

await runWrangler(
`kv:key get val --namespace-id some-namespace-id --local --text`
`kv key get val --namespace-id some-namespace-id --text`
);
expect(std.out).toMatchInlineSnapshot(`
"Writing the value \\"value\\" to key \\"val\\" on namespace some-namespace-id.
Expand All @@ -359,7 +357,7 @@ describe("wrangler", () => {
`);

await runWrangler(
`kv:key get val --namespace-id some-namespace-id --local --text --persist-to ./persistdir`
`kv key get val --namespace-id some-namespace-id --text --persist-to ./persistdir`
);
expect(std.out).toMatchInlineSnapshot(`
"Writing the value \\"value\\" to key \\"val\\" on namespace some-namespace-id.
Expand Down
Loading