diff --git a/packages/wrangler/e2e/versions.test.ts b/packages/wrangler/e2e/versions.test.ts index 67a460d60ce5..aeb13330714f 100644 --- a/packages/wrangler/e2e/versions.test.ts +++ b/packages/wrangler/e2e/versions.test.ts @@ -56,7 +56,7 @@ describe("versions deploy", { timeout: TIMEOUT }, () => { it("should upload 1st Worker version", async () => { const upload = await helper.run( - `wrangler versions upload --message "Upload via e2e test" --tag "e2e-upload" --x-versions` + `wrangler versions upload --message "Upload via e2e test" --tag "e2e-upload"` ); versionId1 = matchVersionId(upload.stdout); @@ -74,7 +74,7 @@ describe("versions deploy", { timeout: TIMEOUT }, () => { }); it("should list 1 version", async () => { - const list = await helper.run(`wrangler versions list --x-versions`); + const list = await helper.run(`wrangler versions list`); expect(normalize(list.stdout)).toMatchInlineSnapshot(` "Version ID: 00000000-0000-0000-0000-000000000000 @@ -97,7 +97,7 @@ describe("versions deploy", { timeout: TIMEOUT }, () => { it("should deploy 1st Worker version", async () => { const deploy = await helper.run( - `wrangler versions deploy ${versionId1}@100% --message "Deploy via e2e test" --yes --x-versions` + `wrangler versions deploy ${versionId1}@100% --message "Deploy via e2e test" --yes` ); expect(normalize(deploy.stdout)).toMatchInlineSnapshot(` @@ -137,7 +137,7 @@ describe("versions deploy", { timeout: TIMEOUT }, () => { }); it("should list 1 deployment", async () => { - const list = await helper.run(`wrangler deployments list --x-versions`); + const list = await helper.run(`wrangler deployments list`); expect(normalize(list.stdout)).toMatchInlineSnapshot(` "Created: TIMESTAMP @@ -172,7 +172,7 @@ describe("versions deploy", { timeout: TIMEOUT }, () => { }); const upload = await helper.run( - `wrangler versions upload --message "Upload AGAIN via e2e test" --tag "e2e-upload-AGAIN" --x-versions` + `wrangler versions upload --message "Upload AGAIN via e2e test" --tag "e2e-upload-AGAIN"` ); versionId2 = matchVersionId(upload.stdout); @@ -188,9 +188,7 @@ describe("versions deploy", { timeout: TIMEOUT }, () => { Changes to triggers (routes, custom domains, cron schedules, etc) must be applied with the command wrangler triggers deploy" `); - const versionsList = await helper.run( - `wrangler versions list --x-versions` - ); + const versionsList = await helper.run(`wrangler versions list`); expect(normalize(versionsList.stdout)).toMatchInlineSnapshot(` "Version ID: 00000000-0000-0000-0000-000000000000 @@ -219,12 +217,10 @@ describe("versions deploy", { timeout: TIMEOUT }, () => { it("should deploy 2nd Worker version", async () => { const deploy = await helper.run( - `wrangler versions deploy ${versionId2}@100% --message "Deploy AGAIN via e2e test" --yes --x-versions` + `wrangler versions deploy ${versionId2}@100% --message "Deploy AGAIN via e2e test" --yes` ); - const deploymentsList = await helper.run( - `wrangler deployments list --x-versions` - ); + const deploymentsList = await helper.run(`wrangler deployments list`); expect(normalize(deploy.stdout)).toMatchInlineSnapshot(` "╭ Deploy Worker Versions by splitting traffic between multiple versions @@ -296,16 +292,12 @@ describe("versions deploy", { timeout: TIMEOUT }, () => { it("should rollback to implicit Worker version (1st version)", async () => { const rollback = await helper.run( - `wrangler rollback --message "Rollback via e2e test" --yes --x-versions` + `wrangler rollback --message "Rollback via e2e test" --yes` ); - const versionsList = await helper.run( - `wrangler versions list --x-versions` - ); + const versionsList = await helper.run(`wrangler versions list`); - const deploymentsList = await helper.run( - `wrangler deployments list --x-versions` - ); + const deploymentsList = await helper.run(`wrangler deployments list`); expect(normalize(rollback.stdout)).toMatchInlineSnapshot(` "├ Fetching latest deployment @@ -410,16 +402,12 @@ describe("versions deploy", { timeout: TIMEOUT }, () => { it("should rollback to specific Worker version (0th version)", async () => { const rollback = await helper.run( - `wrangler rollback ${versionId0} --message "Rollback to old version" --yes --x-versions` + `wrangler rollback ${versionId0} --message "Rollback to old version" --yes` ); - const versionsList = await helper.run( - `wrangler versions list --x-versions` - ); + const versionsList = await helper.run(`wrangler versions list`); - const deploymentsList = await helper.run( - `wrangler deployments list --x-versions` - ); + const deploymentsList = await helper.run(`wrangler deployments list`); expect(normalize(rollback.stdout)).toMatchInlineSnapshot(` "├ Fetching latest deployment @@ -551,7 +539,7 @@ describe("versions deploy", { timeout: TIMEOUT }, () => { }); const upload = await helper.run( - `wrangler versions upload --legacy-assets='./public' --x-versions` + `wrangler versions upload --legacy-assets='./public'` ); expect(normalize(upload.output)).toMatchInlineSnapshot(` @@ -586,7 +574,7 @@ describe("versions deploy", { timeout: TIMEOUT }, () => { `, }); - const upload = await helper.run(`wrangler versions upload --x-versions`); + const upload = await helper.run(`wrangler versions upload`); expect(normalize(upload.output)).toMatchInlineSnapshot(` "X [ERROR] Workers Sites does not support uploading versions through \`wrangler versions upload\`. You must use \`wrangler deploy\` instead. @@ -614,7 +602,7 @@ describe("versions deploy", { timeout: TIMEOUT }, () => { }); const upload = await helper.run( - `wrangler versions upload --message "Upload via e2e test" --tag "e2e-upload-assets" --x-versions` + `wrangler versions upload --message "Upload via e2e test" --tag "e2e-upload-assets"` ); expect(normalize(upload.stdout)).toMatchInlineSnapshot(` diff --git a/packages/wrangler/src/__tests__/deployments.test.ts b/packages/wrangler/src/__tests__/deployments.test.ts index 4590d0c8bcca..36df00ee7429 100644 --- a/packages/wrangler/src/__tests__/deployments.test.ts +++ b/packages/wrangler/src/__tests__/deployments.test.ts @@ -7,6 +7,7 @@ import { useMockIsTTY } from "./helpers/mock-istty"; import { createFetchResult, msw, + mswListNewDeployments, mswSuccessDeploymentDetails, mswSuccessDeployments, mswSuccessDeploymentScriptMetadata, @@ -37,6 +38,7 @@ describe("deployments", () => { beforeEach(() => { msw.use( + mswListNewDeployments, ...mswSuccessDeployments, ...mswSuccessOauthHandlers, ...mswSuccessUserHandlers, @@ -74,82 +76,8 @@ describe("deployments", () => { }); describe("deployments subcommands", () => { - describe("deployments list", () => { - it("should log deployments", async () => { - writeWranglerConfig(); - - await runWrangler("deployments list --no-x-versions"); - expect(std.out).toMatchInlineSnapshot(` - " - Version ID: Constitution-Class-tag:test-name - Created on: 2021-01-01T00:00:00.000000Z - Author: Jean-Luc-Picard@federation.org - Source: Upload from Wrangler 🤠 - - Version ID: Intrepid-Class-tag:test-name - Created on: 2021-02-02T00:00:00.000000Z - Author: Kathryn-Janeway@federation.org - Source: Rollback from Wrangler 🤠 - Rollback from: MOCK-DEPLOYMENT-ID-1111 - Message: Rolled back for this version - - Version ID: 3mEgaU1T-Intrepid-someThing-tag:test-name - Created on: 2021-02-03T00:00:00.000000Z - Author: Kathryn-Janeway@federation.org - Source: Wrangler 🤠 - - Version ID: Galaxy-Class-tag:test-name - Created on: 2021-01-04T00:00:00.000000Z - Author: Jean-Luc-Picard@federation.org - Source: Rollback from Wrangler 🤠 - Rollback from: MOCK-DEPLOYMENT-ID-2222 - 🟩 Active" - `); - }); - - it("should log deployments for script with passed in name option", async () => { - await runWrangler( - "deployments list --name something-else --no-x-versions" - ); - expect(std.out).toMatchInlineSnapshot(` - " - Version ID: Constitution-Class-tag:something-else - Created on: 2021-01-01T00:00:00.000000Z - Author: Jean-Luc-Picard@federation.org - Source: Upload from Wrangler 🤠 - - Version ID: Intrepid-Class-tag:something-else - Created on: 2021-02-02T00:00:00.000000Z - Author: Kathryn-Janeway@federation.org - Source: Rollback from Wrangler 🤠 - Rollback from: MOCK-DEPLOYMENT-ID-1111 - Message: Rolled back for this version - - Version ID: 3mEgaU1T-Intrepid-someThing-tag:something-else - Created on: 2021-02-03T00:00:00.000000Z - Author: Kathryn-Janeway@federation.org - Source: Wrangler 🤠 - - Version ID: Galaxy-Class-tag:something-else - Created on: 2021-01-04T00:00:00.000000Z - Author: Jean-Luc-Picard@federation.org - Source: Rollback from Wrangler 🤠 - Rollback from: MOCK-DEPLOYMENT-ID-2222 - 🟩 Active" - `); - }); - - it("should error on missing script name", async () => { - await expect( - runWrangler("deployments list --no-x-versions") - ).rejects.toMatchInlineSnapshot( - `[Error: Required Worker name missing. Please specify the Worker name in your Wrangler configuration file, or pass it as an argument with \`--name\`]` - ); - }); - }); - describe("deployment view", () => { - it("should error with no --no-x-versions flag", async () => { + it("should error with no flag", async () => { writeWranglerConfig(); await expect( @@ -158,257 +86,6 @@ describe("deployments", () => { `[Error: \`wrangler deployments view \` has been renamed \`wrangler versions view [version-id]\`. Please use that command instead.]` ); }); - - it("should log deployment details", async () => { - writeWranglerConfig(); - - await runWrangler("deployments view 1701-E --no-x-versions"); - - expect(std.out).toMatchInlineSnapshot(` - " - Version ID: 1701-E - Created on: 2021-01-01T00:00:00.000000Z - Author: Jean-Luc-Picard@federation.org - Source: Wrangler 🤠 - ------------------------------------------------------------ - Author ID: Picard-Gamma-6-0-7-3 - Usage Model: bundled - Handlers: fetch - --------------------------bindings-------------------------- - None - " - `); - }); - - it("should log deployment details with bindings", async () => { - writeWranglerConfig(); - - await runWrangler("deployments view bindings-tag --no-x-versions"); - - expect(std.out).toMatchInlineSnapshot(` - " - Version ID: 1701-E - Created on: 2021-01-01T00:00:00.000000Z - Author: Jean-Luc-Picard@federation.org - Source: Wrangler 🤠 - ------------------------------------------------------------ - Author ID: Picard-Gamma-6-0-7-3 - Usage Model: bundled - Handlers: fetch - --------------------------bindings-------------------------- - [[r2_buckets]] - binding = \\"MY_BUCKET\\" - bucket_name = \\"testr2\\" - - " - `); - }); - - it("should automatically log latest deployment details", async () => { - writeWranglerConfig(); - - await runWrangler("deployments view --no-x-versions"); - - expect(std.out).toMatchInlineSnapshot(` - " - Version ID: 1701-E - Created on: 2021-01-01T00:00:00.000000Z - Author: Jean-Luc-Picard@federation.org - Source: Wrangler 🤠 - ------------------------------------------------------------ - Author ID: Picard-Gamma-6-0-7-3 - Usage Model: bundled - Handlers: fetch - --------------------------bindings-------------------------- - None - " - `); - }); - }); - - describe("rollback", () => { - const { setIsTTY } = useMockIsTTY(); - const requests = { count: 0 }; - beforeEach(() => { - setIsTTY(true); - requests.count = 0; - msw.use( - http.put( - "*/accounts/:accountID/workers/scripts/:scriptName", - ({ request }) => { - const url = new URL(request.url); - - expect(url.searchParams.get("rollback_to")).toMatch( - /^3mEgaU1T-Intrepid-someThing-tag:/ - ); - - requests.count++; - - return HttpResponse.json( - createFetchResult({ - created_on: "2222-11-18T16:40:48.50545Z", - modified_on: "2222-01-20T18:08:47.464024Z", - id: "space_craft_1", - tag: "alien_tech_001", - tags: ["hyperdrive", "laser_cannons", "shields"], - deployment_id: "galactic_mission_alpha", - logpush: true, - etag: "13a3240e8fb414561b0366813b0b8f42b3e6cfa0d9e70e99835dae83d0d8a794", - handlers: [ - "interstellar_communication", - "hyperspace_navigation", - ], - last_deployed_from: "spaceport_alpha", - usage_model: "intergalactic", - script: `addEventListener('interstellar_communication', event =\u003e - { event.respondWith(transmit(event.request)) } - )`, - size: "1 light-year", - }) - ); - }, - { once: true } - ) - ); - }); - - it("should successfully rollback and output a success message", async () => { - mockConfirm({ - text: "This deployment 3mEgaU1T will immediately replace the current deployment and become the active deployment across all your deployed routes and domains. However, your local development environment will not be affected by this rollback. Note: Rolling back to a previous deployment will not rollback any of the bound resources (Durable Object, D1, R2, KV, etc).", - result: true, - }); - - mockPrompt({ - text: "Please provide a message for this rollback (120 characters max)", - result: "", - }); - - writeWranglerConfig(); - await runWrangler( - "rollback 3mEgaU1T-Intrepid-someThing-tag:test-name --no-x-versions" - ); - expect(std.out).toMatchInlineSnapshot(` - " - Successfully rolled back to Deployment ID: 3mEgaU1T-Intrepid-someThing-tag:test-name - Current Version ID: galactic_mission_alpha" - `); - - expect(requests.count).toEqual(1); - }); - - it("should early exit from rollback if user denies continuing", async () => { - mockConfirm({ - text: "This deployment 3mEgaU1T will immediately replace the current deployment and become the active deployment across all your deployed routes and domains. However, your local development environment will not be affected by this rollback. Note: Rolling back to a previous deployment will not rollback any of the bound resources (Durable Object, D1, R2, KV, etc).", - result: false, - }); - - writeWranglerConfig(); - await runWrangler( - "rollback 3mEgaU1T-Intrpid-someThing-tag:test-name --no-x-versions" - ); - expect(std.out).toMatchInlineSnapshot(`""`); - - expect(requests.count).toEqual(0); - }); - - it("should skip prompt automatically in rollback if in a non-TTY environment", async () => { - setIsTTY(false); - - writeWranglerConfig(); - await runWrangler( - "rollback 3mEgaU1T-Intrepid-someThing-tag:test-name --no-x-versions" - ); - expect(std.out).toMatchInlineSnapshot(` - "? This deployment 3mEgaU1T will immediately replace the current deployment and become the active deployment across all your deployed routes and domains. However, your local development environment will not be affected by this rollback. Note: Rolling back to a previous deployment will not rollback any of the bound resources (Durable Object, D1, R2, KV, etc). - 🤖 Using fallback value in non-interactive context: yes - ? Please provide a message for this rollback (120 characters max) - 🤖 Using default value in non-interactive context: - - Successfully rolled back to Deployment ID: 3mEgaU1T-Intrepid-someThing-tag:test-name - Current Version ID: galactic_mission_alpha" - `); - - expect(requests.count).toEqual(1); - }); - - it("should skip prompt automatically in rollback if message flag is provided", async () => { - writeWranglerConfig(); - await runWrangler( - `rollback 3mEgaU1T-Intrepid-someThing-tag:test-name --message "test" --no-x-versions` - ); - expect(std.out).toMatchInlineSnapshot(` - " - Successfully rolled back to Deployment ID: 3mEgaU1T-Intrepid-someThing-tag:test-name - Current Version ID: galactic_mission_alpha" - `); - - expect(requests.count).toEqual(1); - }); - - it("should skip prompt automatically in rollback with empty message", async () => { - writeWranglerConfig(); - await runWrangler( - `rollback 3mEgaU1T-Intrepid-someThing-tag:test-name --message "test" --no-x-versions` - ); - expect(std.out).toMatchInlineSnapshot(` - " - Successfully rolled back to Deployment ID: 3mEgaU1T-Intrepid-someThing-tag:test-name - Current Version ID: galactic_mission_alpha" - `); - - expect(requests.count).toEqual(1); - }); - - it("should automatically rollback to previous deployment when id is not specified", async () => { - mockConfirm({ - text: "This deployment 3mEgaU1T will immediately replace the current deployment and become the active deployment across all your deployed routes and domains. However, your local development environment will not be affected by this rollback. Note: Rolling back to a previous deployment will not rollback any of the bound resources (Durable Object, D1, R2, KV, etc).", - result: true, - }); - - mockPrompt({ - text: "Please provide a message for this rollback (120 characters max)", - result: "", - }); - - writeWranglerConfig(); - await runWrangler("rollback --no-x-versions"); - expect(std.out).toMatchInlineSnapshot(` - " - Successfully rolled back to Deployment ID: 3mEgaU1T-Intrepid-someThing-tag:test-name - Current Version ID: galactic_mission_alpha" - `); - - expect(requests.count).toEqual(1); - }); - - it("should require a worker name", async () => { - await expect(runWrangler("rollback")).rejects.toMatchInlineSnapshot( - `[Error: You need to provide a name for your Worker. Either pass it as a cli arg with \`--name \` or in your configuration file as \`name = ""\`]` - ); - - expect(requests.count).toEqual(0); - }); - - it("should automatically rollback to previous deployment with specified name", async () => { - mockConfirm({ - text: "This deployment 3mEgaU1T will immediately replace the current deployment and become the active deployment across all your deployed routes and domains. However, your local development environment will not be affected by this rollback. Note: Rolling back to a previous deployment will not rollback any of the bound resources (Durable Object, D1, R2, KV, etc).", - result: true, - }); - - mockPrompt({ - text: "Please provide a message for this rollback (120 characters max)", - result: "", - }); - - await runWrangler("rollback --name something-else --no-x-versions"); - expect(std.out).toMatchInlineSnapshot(` - " - Successfully rolled back to Deployment ID: 3mEgaU1T-Intrepid-someThing-tag:something-else - Current Version ID: galactic_mission_alpha" - `); - - expect(requests.count).toEqual(1); - }); }); }); }); diff --git a/packages/wrangler/src/__tests__/rollback.test.ts b/packages/wrangler/src/__tests__/rollback.test.ts index f3702c098770..3ceed3f5c8e6 100644 --- a/packages/wrangler/src/__tests__/rollback.test.ts +++ b/packages/wrangler/src/__tests__/rollback.test.ts @@ -131,7 +131,7 @@ describe("rollback", () => { }); await runWrangler( - "rollback --name script-name --version-id rollback-version --x-versions" + "rollback --name script-name --version-id rollback-version" ); // Unable to test stdout as the output has weird whitespace. Causing lint to fail with "no-irregular-whitespace" @@ -188,7 +188,7 @@ describe("rollback", () => { }); await runWrangler( - "rollback --name script-name --version-id rollback-version --x-versions" + "rollback --name script-name --version-id rollback-version" ); // Unable to test stdout as the output has weird whitespace. Causing lint to fail with "no-irregular-whitespace" @@ -228,7 +228,7 @@ describe("rollback", () => { mockPostDeployment(true); await runWrangler( - "rollback --name script-name --version-id rollback-version --x-versions" + "rollback --name script-name --version-id rollback-version" ); // Unable to test stdout as the output has weird whitespace. Causing lint to fail with "no-irregular-whitespace" diff --git a/packages/wrangler/src/__tests__/versions/deployments/deployments.list.test.ts b/packages/wrangler/src/__tests__/versions/deployments/deployments.list.test.ts index d79c96ecec91..637982b763df 100644 --- a/packages/wrangler/src/__tests__/versions/deployments/deployments.list.test.ts +++ b/packages/wrangler/src/__tests__/versions/deployments/deployments.list.test.ts @@ -20,7 +20,7 @@ describe("deployments list", () => { describe("without wrangler.toml", () => { test("fails with no args", async () => { - const result = runWrangler("deployments list --experimental-versions"); + const result = runWrangler("deployments list"); await expect(result).rejects.toMatchInlineSnapshot( `[Error: You need to provide a name for your Worker. Either pass it as a cli arg with \`--name \` or in your configuration file as \`name = ""\`]` @@ -32,9 +32,7 @@ describe("deployments list", () => { }); test("prints deployments to stdout", async () => { - const result = runWrangler( - "deployments list --name test-name --experimental-versions" - ); + const result = runWrangler("deployments list --name test-name"); await expect(result).resolves.toBeUndefined(); @@ -101,9 +99,7 @@ describe("deployments list", () => { }); test("prints deployments to stdout as --json", async () => { - const result = runWrangler( - "deployments list --name test-name --json --experimental-versions" - ); + const result = runWrangler("deployments list --name test-name --json"); await expect(result).resolves.toBeUndefined(); @@ -199,7 +195,7 @@ describe("deployments list", () => { beforeEach(() => writeWranglerConfig()); test("prints deployments to stdout", async () => { - const result = runWrangler("deployments list --experimental-versions"); + const result = runWrangler("deployments list"); await expect(result).resolves.toBeUndefined(); @@ -266,9 +262,7 @@ describe("deployments list", () => { }); test("prints deployments to stdout as --json", async () => { - const result = runWrangler( - "deployments list --json --experimental-versions" - ); + const result = runWrangler("deployments list --json"); await expect(result).resolves.toBeUndefined(); diff --git a/packages/wrangler/src/__tests__/versions/deployments/deployments.status.test.ts b/packages/wrangler/src/__tests__/versions/deployments/deployments.status.test.ts index ec4564fb93fd..8fe477c2caf3 100644 --- a/packages/wrangler/src/__tests__/versions/deployments/deployments.status.test.ts +++ b/packages/wrangler/src/__tests__/versions/deployments/deployments.status.test.ts @@ -20,9 +20,7 @@ describe("deployments list", () => { describe("without wrangler.toml", () => { test("fails with no args", async () => { - const result = runWrangler( - "deployments status --experimental-gradual-rollouts" - ); + const result = runWrangler("deployments status"); await expect(result).rejects.toMatchInlineSnapshot( `[Error: You need to provide a name for your Worker. Either pass it as a cli arg with \`--name \` or in your configuration file as \`name = ""\`]` @@ -34,9 +32,7 @@ describe("deployments list", () => { }); test("prints latest deployment to stdout", async () => { - const result = runWrangler( - "deployments status --name test-name --experimental-gradual-rollouts" - ); + const result = runWrangler("deployments status --name test-name"); await expect(result).resolves.toBeUndefined(); @@ -61,9 +57,7 @@ describe("deployments list", () => { }); test("prints latest deployment to stdout as --json", async () => { - const result = runWrangler( - "deployments status --name test-name --json --experimental-versions" - ); + const result = runWrangler("deployments status --name test-name --json"); await expect(result).resolves.toBeUndefined(); @@ -98,9 +92,7 @@ describe("deployments list", () => { beforeEach(() => writeWranglerConfig()); test("prints latest deployment to stdout", async () => { - const result = runWrangler( - "deployments status --experimental-gradual-rollouts" - ); + const result = runWrangler("deployments status"); await expect(result).resolves.toBeUndefined(); @@ -125,9 +117,7 @@ describe("deployments list", () => { }); test("prints latest deployment to stdout as --json", async () => { - const result = runWrangler( - "deployments status --json --experimental-versions" - ); + const result = runWrangler("deployments status --json"); await expect(result).resolves.toBeUndefined(); diff --git a/packages/wrangler/src/__tests__/versions/deployments/deployments.view.test.ts b/packages/wrangler/src/__tests__/versions/deployments/deployments.view.test.ts index eb3f28ab27da..e136b10e0dbd 100644 --- a/packages/wrangler/src/__tests__/versions/deployments/deployments.view.test.ts +++ b/packages/wrangler/src/__tests__/versions/deployments/deployments.view.test.ts @@ -6,7 +6,7 @@ describe("deployments view", () => { mockConsoleMethods(); test("error when run with no args", async () => { - const result = runWrangler("deployments view --x-versions"); + const result = runWrangler("deployments view"); await expect(result).rejects.toMatchInlineSnapshot( `[Error: \`wrangler deployments view\` has been renamed \`wrangler deployments status\`. Please use that command instead.]` @@ -15,7 +15,7 @@ describe("deployments view", () => { }); test("error when run with positional arg", async () => { - const result = runWrangler("deployments view dummy-id --x-versions"); + const result = runWrangler("deployments view dummy-id"); await expect(result).rejects.toMatchInlineSnapshot( `[Error: \`wrangler deployments view \` has been renamed \`wrangler versions view [version-id]\`. Please use that command instead.]` diff --git a/packages/wrangler/src/__tests__/versions/secrets/bulk.test.ts b/packages/wrangler/src/__tests__/versions/secrets/bulk.test.ts index 8444cd96fb1c..659268bdc4dc 100644 --- a/packages/wrangler/src/__tests__/versions/secrets/bulk.test.ts +++ b/packages/wrangler/src/__tests__/versions/secrets/bulk.test.ts @@ -22,7 +22,7 @@ describe("versions secret bulk", () => { vi.spyOn(readline, "createInterface").mockImplementation( () => null as unknown as Interface ); - await runWrangler(`versions secret bulk --name script-name --x-versions`); + await runWrangler(`versions secret bulk --name script-name`); expect(std.out).toMatchInlineSnapshot( `"🌀 Creating the secrets for the Worker \\"script-name\\" "` ); @@ -59,9 +59,7 @@ describe("versions secret bulk", () => { expect(metadata.keep_assets).toBeTruthy(); }); - await runWrangler( - `versions secret bulk secrets.json --name script-name --x-versions` - ); + await runWrangler(`versions secret bulk secrets.json --name script-name`); expect(std.out).toMatchInlineSnapshot( ` "🌀 Creating the secrets for the Worker \\"script-name\\" @@ -80,9 +78,7 @@ describe("versions secret bulk", () => { await writeFile("wrangler.json", JSON.stringify({ invalid_field: true })); mockSetupApiCalls(); mockPostVersion(); - await runWrangler( - `versions secret bulk secrets.json --name script-name --x-versions` - ); + await runWrangler(`versions secret bulk secrets.json --name script-name`); expect(std.warn).toMatchInlineSnapshot(`""`); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -112,7 +108,7 @@ describe("versions secret bulk", () => { expect(metadata.keep_assets).toBeTruthy(); }); - await runWrangler(`versions secret bulk --name script-name --x-versions`); + await runWrangler(`versions secret bulk --name script-name`); expect(std.out).toMatchInlineSnapshot( ` "🌀 Creating the secrets for the Worker \\"script-name\\" @@ -129,9 +125,7 @@ describe("versions secret bulk", () => { test("should error on invalid json file", async () => { await writeFile("secrets.json", "not valid json :(", { encoding: "utf8" }); - await runWrangler( - `versions secret bulk secrets.json --name script-name --x-versions` - ); + await runWrangler(`versions secret bulk secrets.json --name script-name`); expect(std.out).toMatchInlineSnapshot( `"🌀 Creating the secrets for the Worker \\"script-name\\" "` ); @@ -163,7 +157,7 @@ describe("versions secret bulk", () => { expect(metadata.keep_assets).toBeTruthy(); }); - await runWrangler(`versions secret bulk --name script-name --x-versions`); + await runWrangler(`versions secret bulk --name script-name`); expect(std.out).toMatchInlineSnapshot( `"🌀 Creating the secrets for the Worker \\"script-name\\" "` ); diff --git a/packages/wrangler/src/__tests__/versions/secrets/delete.test.ts b/packages/wrangler/src/__tests__/versions/secrets/delete.test.ts index dd063c3c8fca..53a6b3d60d21 100644 --- a/packages/wrangler/src/__tests__/versions/secrets/delete.test.ts +++ b/packages/wrangler/src/__tests__/versions/secrets/delete.test.ts @@ -38,9 +38,7 @@ describe("versions secret delete", () => { // We will not be inherting secret_text as that would bring back SECRET expect(metadata.keep_bindings).toStrictEqual(["secret_key"]); }); - await runWrangler( - "versions secret delete SECRET --name script-name --x-versions" - ); + await runWrangler("versions secret delete SECRET --name script-name"); expect(std.out).toMatchInlineSnapshot(` "🌀 Deleting the secret SECRET on the Worker script-name @@ -64,9 +62,7 @@ describe("versions secret delete", () => { expect(metadata.keep_bindings).toStrictEqual(["secret_key"]); }); - await runWrangler( - "versions secret delete SECRET --name script-name --x-versions" - ); + await runWrangler("versions secret delete SECRET --name script-name"); expect(std.out).toMatchInlineSnapshot(` "? Are you sure you want to permanently delete the secret SECRET on the Worker script-name? @@ -93,7 +89,7 @@ describe("versions secret delete", () => { expect(metadata.keep_bindings).toStrictEqual(["secret_key"]); }); - await runWrangler("versions secret delete SECRET --x-versions"); + await runWrangler("versions secret delete SECRET"); expect(std.out).toMatchInlineSnapshot(` "? Are you sure you want to permanently delete the secret SECRET on the Worker script-name? @@ -113,9 +109,7 @@ describe("versions secret delete", () => { mockGetVersion(); mockPostVersion(); - await runWrangler( - "versions secret delete SECRET --name script-name --x-versions" - ); + await runWrangler("versions secret delete SECRET --name script-name"); expect(std.warn).toMatchInlineSnapshot(`""`); expect(std.err).toMatchInlineSnapshot(`""`); diff --git a/packages/wrangler/src/__tests__/versions/secrets/list.test.ts b/packages/wrangler/src/__tests__/versions/secrets/list.test.ts index bda2e6150550..dea533321dec 100644 --- a/packages/wrangler/src/__tests__/versions/secrets/list.test.ts +++ b/packages/wrangler/src/__tests__/versions/secrets/list.test.ts @@ -101,7 +101,7 @@ describe("versions secret list", () => { mockGetDeployments(); mockGetVersion("version-id-1"); - await runWrangler("versions secret list --name script-name --x-versions"); + await runWrangler("versions secret list --name script-name"); expect(std.out).toMatchInlineSnapshot(` "-- Version version-id-1 (100%) secrets -- @@ -118,7 +118,7 @@ describe("versions secret list", () => { mockGetVersion("version-id-1"); mockGetVersion("version-id-2"); - await runWrangler("versions secret list --name script-name --x-versions"); + await runWrangler("versions secret list --name script-name"); expect(std.out).toMatchInlineSnapshot(` "-- Version version-id-1 (50%) secrets -- @@ -141,7 +141,7 @@ describe("versions secret list", () => { mockGetDeployments(); mockGetVersion("version-id-1"); - await runWrangler("versions secret list --x-versions"); + await runWrangler("versions secret list"); expect(std.out).toMatchInlineSnapshot(` "-- Version version-id-1 (100%) secrets -- @@ -245,7 +245,7 @@ describe("versions secret list", () => { mockGetDeployments(); mockGetVersion("version-id-1"); - await runWrangler("versions secret list --latest-version --x-versions"); + await runWrangler("versions secret list --latest-version"); expect(std.out).toMatchInlineSnapshot(` "-- Version version-id-3 (0%) secrets -- @@ -262,7 +262,7 @@ describe("versions secret list", () => { mockGetDeployments(); mockGetVersion("version-id-1"); - await runWrangler("versions secret list --name script-name --x-versions"); + await runWrangler("versions secret list --name script-name"); expect(std.warn).toMatchInlineSnapshot(`""`); expect(std.err).toMatchInlineSnapshot(`""`); diff --git a/packages/wrangler/src/__tests__/versions/secrets/put.test.ts b/packages/wrangler/src/__tests__/versions/secrets/put.test.ts index 7682c0113d2e..eca243dfa91e 100644 --- a/packages/wrangler/src/__tests__/versions/secrets/put.test.ts +++ b/packages/wrangler/src/__tests__/versions/secrets/put.test.ts @@ -43,9 +43,7 @@ describe("versions secret put", () => { ]); expect(metadata.keep_assets).toBeTruthy(); }); - await runWrangler( - "versions secret put NEW_SECRET --name script-name --x-versions" - ); + await runWrangler("versions secret put NEW_SECRET --name script-name"); expect(std.out).toMatchInlineSnapshot(` "🌀 Creating the secret for the Worker \\"script-name\\" @@ -67,10 +65,7 @@ describe("versions secret put", () => { mockSetupApiCalls(); mockPostVersion(); - await runWrangler( - "versions secret put NEW_SECRET --name script-name --x-versions" - ); - + await runWrangler("versions secret put NEW_SECRET --name script-name"); expect(std.warn).toMatchInlineSnapshot(`""`); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -96,9 +91,7 @@ describe("versions secret put", () => { `secret ` // whitespace & newline being removed ); - await runWrangler( - "versions secret put NEW_SECRET --name script-name --x-versions" - ); + await runWrangler("versions secret put NEW_SECRET --name script-name"); expect(std.out).toMatchInlineSnapshot(` "🌀 Creating the secret for the Worker \\"script-name\\" @@ -131,7 +124,7 @@ describe("versions secret put", () => { ]); expect(metadata.keep_assets).toBeTruthy(); }); - await runWrangler("versions secret put NEW_SECRET --x-versions"); + await runWrangler("versions secret put NEW_SECRET"); expect(std.out).toMatchInlineSnapshot(` "🌀 Creating the secret for the Worker \\"script-name\\" @@ -167,7 +160,7 @@ describe("versions secret put", () => { ).toBe("Deploy a new secret"); }); await runWrangler( - "versions secret put NEW_SECRET --name script-name --message 'Deploy a new secret' --x-versions" + "versions secret put NEW_SECRET --name script-name --message 'Deploy a new secret'" ); expect(std.out).toMatchInlineSnapshot(` @@ -207,7 +200,7 @@ describe("versions secret put", () => { ).toBe("v1"); }); await runWrangler( - "versions secret put NEW_SECRET --name script-name --message 'Deploy a new secret' --tag v1 --x-versions" + "versions secret put NEW_SECRET --name script-name --message 'Deploy a new secret' --tag v1" ); expect(std.out).toMatchInlineSnapshot(` @@ -244,7 +237,7 @@ describe("versions secret put", () => { ).toBe("Deploy a new secret"); }); await runWrangler( - "versions secret put SECRET --name script-name --message 'Deploy a new secret' --x-versions" + "versions secret put SECRET --name script-name --message 'Deploy a new secret'" ); expect(std.out).toMatchInlineSnapshot(` @@ -320,7 +313,7 @@ describe("versions secret put", () => { ).toBe("Deploy a new secret"); }); await runWrangler( - "versions secret put SECRET --name script-name --message 'Deploy a new secret' --x-versions" + "versions secret put SECRET --name script-name --message 'Deploy a new secret'" ); expect(std.out).toMatchInlineSnapshot(` diff --git a/packages/wrangler/src/__tests__/versions/versions.deploy.test.ts b/packages/wrangler/src/__tests__/versions/versions.deploy.test.ts index 29f93f21c26c..1da5f4b14c16 100644 --- a/packages/wrangler/src/__tests__/versions/versions.deploy.test.ts +++ b/packages/wrangler/src/__tests__/versions/versions.deploy.test.ts @@ -89,7 +89,7 @@ describe("versions deploy", () => { describe("without wrangler.toml", () => { test("succeeds with --name arg", async () => { const result = runWrangler( - "versions deploy 10000000-0000-0000-0000-000000000000 --name named-worker --yes --experimental-gradual-rollouts" + "versions deploy 10000000-0000-0000-0000-000000000000 --name named-worker --yes" ); await expect(result).resolves.toMatchInlineSnapshot(`undefined`); @@ -140,7 +140,7 @@ describe("versions deploy", () => { test("fails without --name arg", async () => { const result = runWrangler( - "versions deploy 10000000-0000-0000-0000-000000000000 --yes --experimental-gradual-rollouts" + "versions deploy 10000000-0000-0000-0000-000000000000 --yes" ); await expect(result).rejects.toMatchInlineSnapshot( @@ -153,9 +153,7 @@ describe("versions deploy", () => { beforeEach(() => writeWranglerConfig()); test("no args", async () => { - const result = runWrangler( - "versions deploy --yes --experimental-gradual-rollouts" - ); + const result = runWrangler("versions deploy --yes"); await expect(result).rejects.toMatchInlineSnapshot( `[Error: You must select at least 1 version to deploy.]` @@ -188,7 +186,7 @@ describe("versions deploy", () => { test("1 version @ (implicit) 100%", async () => { const result = runWrangler( - "versions deploy 10000000-0000-0000-0000-000000000000 --yes --experimental-gradual-rollouts" + "versions deploy 10000000-0000-0000-0000-000000000000 --yes" ); await expect(result).resolves.toBeUndefined(); @@ -235,7 +233,7 @@ describe("versions deploy", () => { test("1 version @ (explicit) 100%", async () => { const result = runWrangler( - "versions deploy 10000000-0000-0000-0000-000000000000@100% --yes --experimental-gradual-rollouts" + "versions deploy 10000000-0000-0000-0000-000000000000@100% --yes" ); await expect(result).resolves.toBeUndefined(); @@ -282,7 +280,7 @@ describe("versions deploy", () => { test("2 versions @ (implicit) 50% each", async () => { const result = runWrangler( - "versions deploy 10000000-0000-0000-0000-000000000000 20000000-0000-0000-0000-000000000000 --yes --experimental-gradual-rollouts" + "versions deploy 10000000-0000-0000-0000-000000000000 20000000-0000-0000-0000-000000000000 --yes" ); await expect(result).resolves.toBeUndefined(); @@ -337,7 +335,7 @@ describe("versions deploy", () => { test("1 version @ (explicit) 100%", async () => { const result = runWrangler( - "versions deploy 10000000-0000-0000-0000-000000000000@100% --yes --experimental-gradual-rollouts" + "versions deploy 10000000-0000-0000-0000-000000000000@100% --yes" ); await expect(result).resolves.toBeUndefined(); @@ -384,7 +382,7 @@ describe("versions deploy", () => { test("2 versions @ (explicit) 30% + (implicit) 70%", async () => { const result = runWrangler( - "versions deploy 10000000-0000-0000-0000-000000000000@30% 20000000-0000-0000-0000-000000000000 --yes --experimental-gradual-rollouts" + "versions deploy 10000000-0000-0000-0000-000000000000@30% 20000000-0000-0000-0000-000000000000 --yes" ); await expect(result).resolves.toBeUndefined(); @@ -439,7 +437,7 @@ describe("versions deploy", () => { test("2 versions @ (explicit) 40% + (explicit) 60%", async () => { const result = runWrangler( - "versions deploy 10000000-0000-0000-0000-000000000000@40% 20000000-0000-0000-0000-000000000000@60% --yes --experimental-gradual-rollouts" + "versions deploy 10000000-0000-0000-0000-000000000000@40% 20000000-0000-0000-0000-000000000000@60% --yes" ); await expect(result).resolves.toBeUndefined(); @@ -495,7 +493,7 @@ describe("versions deploy", () => { describe("max versions restrictions (temp)", () => { test("2+ versions fails", async () => { const result = runWrangler( - "versions deploy 10000000-0000-0000-0000-000000000000 20000000-0000-0000-0000-000000000000 30000000-0000-0000-0000-000000000000 --yes --experimental-gradual-rollouts" + "versions deploy 10000000-0000-0000-0000-000000000000 20000000-0000-0000-0000-000000000000 30000000-0000-0000-0000-000000000000 --yes" ); await expect(result).rejects.toMatchInlineSnapshot( @@ -544,7 +542,7 @@ describe("versions deploy", () => { test("--max-versions allows > 2 versions", async () => { const result = runWrangler( - "versions deploy 10000000-0000-0000-0000-000000000000 20000000-0000-0000-0000-000000000000 30000000-0000-0000-0000-000000000000 --max-versions=3 --yes --experimental-gradual-rollouts" + "versions deploy 10000000-0000-0000-0000-000000000000 20000000-0000-0000-0000-000000000000 30000000-0000-0000-0000-000000000000 --max-versions=3 --yes" ); await expect(result).resolves.toBeUndefined(); @@ -610,7 +608,7 @@ describe("versions deploy", () => { test("with a message", async () => { const result = runWrangler( - "versions deploy 10000000-0000-0000-0000-000000000000 --message 'My versioned deployment message' --yes --experimental-gradual-rollouts" + "versions deploy 10000000-0000-0000-0000-000000000000 --message 'My versioned deployment message' --yes" ); await expect(result).resolves.toBeUndefined(); @@ -662,7 +660,7 @@ describe("versions deploy", () => { }); const result = runWrangler( - "versions deploy 10000000-0000-0000-0000-000000000000 --yes --experimental-gradual-rollouts" + "versions deploy 10000000-0000-0000-0000-000000000000 --yes" ); await expect(result).resolves.toBeUndefined(); @@ -720,7 +718,7 @@ describe("versions deploy", () => { }); const result = runWrangler( - "versions deploy 10000000-0000-0000-0000-000000000000 --yes --experimental-gradual-rollouts" + "versions deploy 10000000-0000-0000-0000-000000000000 --yes" ); await expect(result).resolves.toBeUndefined(); @@ -785,7 +783,7 @@ describe("versions deploy", () => { }); const result = runWrangler( - "versions deploy 10000000-0000-0000-0000-000000000000 --yes --experimental-gradual-rollouts" + "versions deploy 10000000-0000-0000-0000-000000000000 --yes" ); await expect(result).resolves.toBeUndefined(); @@ -840,7 +838,7 @@ describe("versions deploy", () => { test("fails for non-existent versionId", async () => { const result = runWrangler( - "versions deploy ffffffff-ffff-ffff-ffff-ffffffffffff --yes --experimental-gradual-rollouts" + "versions deploy ffffffff-ffff-ffff-ffff-ffffffffffff --yes" ); // TODO: could do with a better error message but this will suffice for now (this error isn't possible in the interactive flow) @@ -872,7 +870,7 @@ describe("versions deploy", () => { test("fails if --percentage > 100", async () => { const result = runWrangler( - "versions deploy 10000000-0000-0000-0000-000000000000 --percentage 101 --yes --experimental-gradual-rollouts" + "versions deploy 10000000-0000-0000-0000-000000000000 --percentage 101 --yes" ); await expect(result).rejects.toMatchInlineSnapshot( @@ -884,7 +882,7 @@ describe("versions deploy", () => { test("fails if --percentage < 0", async () => { const result = runWrangler( - "versions deploy 10000000-0000-0000-0000-000000000000 --percentage -1 --yes --experimental-gradual-rollouts" + "versions deploy 10000000-0000-0000-0000-000000000000 --percentage -1 --yes" ); await expect(result).rejects.toMatchInlineSnapshot( @@ -896,7 +894,7 @@ describe("versions deploy", () => { test("fails if version-spec percentage > 100", async () => { const result = runWrangler( - "versions deploy 10000000-0000-0000-0000-000000000000 --percentage 101 --yes --experimental-gradual-rollouts" + "versions deploy 10000000-0000-0000-0000-000000000000 --percentage 101 --yes" ); await expect(result).rejects.toMatchInlineSnapshot( @@ -908,7 +906,7 @@ describe("versions deploy", () => { test("fails if version-spec percentage < 0", async () => { const result = runWrangler( - "versions deploy 10000000-0000-0000-0000-000000000000 --percentage -1 --yes --experimental-gradual-rollouts" + "versions deploy 10000000-0000-0000-0000-000000000000 --percentage -1 --yes" ); await expect(result).rejects.toMatchInlineSnapshot( diff --git a/packages/wrangler/src/__tests__/versions/versions.help.test.ts b/packages/wrangler/src/__tests__/versions/versions.help.test.ts index 8734ad8ea633..e77a90c88c61 100644 --- a/packages/wrangler/src/__tests__/versions/versions.help.test.ts +++ b/packages/wrangler/src/__tests__/versions/versions.help.test.ts @@ -5,78 +5,6 @@ import { runWrangler } from "../helpers/run-wrangler"; describe("versions --help", () => { const std = mockConsoleMethods(); - test("shows generic help w/ --help flag and --no-experimental-versions flag", async () => { - const result = runWrangler("versions --help --no-experimental-versions"); - - await expect(result).resolves.toBeUndefined(); - - expect(std.out).toMatchInlineSnapshot(` - "wrangler - - COMMANDS - wrangler docs [search..] 📚 Open Wrangler's command documentation in your browser - - wrangler init [name] 📥 Initialize a basic Worker - wrangler dev [script] 👂 Start a local server for developing your Worker - wrangler deploy [script] 🆙 Deploy a Worker to Cloudflare [aliases: publish] - wrangler deployments 🚢 List and view the current and past deployments for your Worker - wrangler rollback [deployment-id] 🔙 Rollback a deployment for a Worker - wrangler delete [script] 🗑 Delete a Worker from Cloudflare - wrangler tail [worker] 🦚 Start a log tailing session for a Worker - wrangler secret 🤫 Generate a secret that can be referenced in a Worker - wrangler types [path] 📝 Generate types from bindings and module rules in configuration - - wrangler kv 🗂️ Manage Workers KV Namespaces - wrangler queues 🇶 Manage Workers Queues - wrangler r2 📦 Manage R2 buckets & objects - wrangler d1 🗄 Manage Workers D1 databases - wrangler vectorize 🧮 Manage Vectorize indexes [open beta] - wrangler hyperdrive 🚀 Manage Hyperdrive databases - wrangler pages ⚡️ Configure Cloudflare Pages - wrangler mtls-certificate 🪪 Manage certificates used for mTLS connections - wrangler pubsub 📮 Manage Pub/Sub brokers [private beta] - wrangler dispatch-namespace 🏗️ Manage dispatch namespaces - wrangler ai 🤖 Manage AI models - wrangler workflows 🔁 Manage Workflows [open-beta] - wrangler login 🔓 Login to Cloudflare - wrangler logout 🚪 Logout from Cloudflare - wrangler whoami 🕵️ Retrieve your user information - - GLOBAL FLAGS - -c, --config Path to Wrangler configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] - - Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose" - `); - }); - - test("shows versions help w/ --help and --experimental-versions flag", async () => { - const result = runWrangler("versions --help --experimental-versions"); - - await expect(result).resolves.toBeUndefined(); - - expect(std.out).toMatchInlineSnapshot(` - "wrangler versions - - 🫧 List, view, upload and deploy Versions of your Worker to Cloudflare - - COMMANDS - wrangler versions view View the details of a specific version of your Worker - wrangler versions list List the 10 most recent Versions of your Worker - wrangler versions upload Uploads your Worker code and config as a new Version - wrangler versions deploy [version-specs..] Safely roll out new Versions of your Worker by splitting traffic between multiple Versions - wrangler versions secret Generate a secret that can be referenced in a Worker - - GLOBAL FLAGS - -c, --config Path to Wrangler configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); - }); - test("shows versions help w/ --help", async () => { const result = runWrangler("versions --help"); @@ -106,14 +34,6 @@ describe("versions --help", () => { describe("versions subhelp", () => { const std = mockConsoleMethods(); - test("fails with --no-experimental-versions flag", async () => { - const result = runWrangler("versions --no-experimental-versions"); - - await expect(result).rejects.toMatchInlineSnapshot( - `[Error: Unknown argument: versions]` - ); - }); - test("shows implicit subhelp", async () => { const result = runWrangler("versions"); @@ -139,82 +59,4 @@ describe("versions subhelp", () => { -v, --version Show version number [boolean]" `); }); - - test("shows implicit subhelp with --experimental-versions flag", async () => { - const result = runWrangler("versions --experimental-versions"); - - await expect(result).resolves.toBeUndefined(); - await setImmediate(); // wait for subhelp - - expect(std.out).toMatchInlineSnapshot(` - "wrangler versions - - 🫧 List, view, upload and deploy Versions of your Worker to Cloudflare - - COMMANDS - wrangler versions view View the details of a specific version of your Worker - wrangler versions list List the 10 most recent Versions of your Worker - wrangler versions upload Uploads your Worker code and config as a new Version - wrangler versions deploy [version-specs..] Safely roll out new Versions of your Worker by splitting traffic between multiple Versions - wrangler versions secret Generate a secret that can be referenced in a Worker - - GLOBAL FLAGS - -c, --config Path to Wrangler configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); - }); - - test("shows implicit subhelp with --x-versions flag", async () => { - const result = runWrangler("versions --x-versions"); - - await expect(result).resolves.toBeUndefined(); - await setImmediate(); // wait for subhelp - - expect(std.out).toMatchInlineSnapshot(` - "wrangler versions - - 🫧 List, view, upload and deploy Versions of your Worker to Cloudflare - - COMMANDS - wrangler versions view View the details of a specific version of your Worker - wrangler versions list List the 10 most recent Versions of your Worker - wrangler versions upload Uploads your Worker code and config as a new Version - wrangler versions deploy [version-specs..] Safely roll out new Versions of your Worker by splitting traffic between multiple Versions - wrangler versions secret Generate a secret that can be referenced in a Worker - - GLOBAL FLAGS - -c, --config Path to Wrangler configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); - }); - - test("shows implicit subhelp with --experimental-gradual-rollouts flag", async () => { - const result = runWrangler("versions --experimental-gradual-rollouts"); - - await expect(result).resolves.toBeUndefined(); - await setImmediate(); // wait for subhelp - - expect(std.out).toMatchInlineSnapshot(` - "wrangler versions - - 🫧 List, view, upload and deploy Versions of your Worker to Cloudflare - - COMMANDS - wrangler versions view View the details of a specific version of your Worker - wrangler versions list List the 10 most recent Versions of your Worker - wrangler versions upload Uploads your Worker code and config as a new Version - wrangler versions deploy [version-specs..] Safely roll out new Versions of your Worker by splitting traffic between multiple Versions - wrangler versions secret Generate a secret that can be referenced in a Worker - - GLOBAL FLAGS - -c, --config Path to Wrangler configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); - }); }); diff --git a/packages/wrangler/src/__tests__/versions/versions.list.test.ts b/packages/wrangler/src/__tests__/versions/versions.list.test.ts index e10009ed5107..056d966156cb 100644 --- a/packages/wrangler/src/__tests__/versions/versions.list.test.ts +++ b/packages/wrangler/src/__tests__/versions/versions.list.test.ts @@ -24,9 +24,7 @@ describe("versions list", () => { describe("without wrangler.toml", () => { test("fails with no args", async () => { - const result = runWrangler( - "versions list --json --experimental-versions" - ); + const result = runWrangler("versions list --json"); await expect(result).rejects.toMatchInlineSnapshot( `[Error: You need to provide a name of your worker. Either pass it as a cli arg with \`--name \` or in your config file as \`name = ""\`]` @@ -38,9 +36,7 @@ describe("versions list", () => { }); test("prints versions to stdout", async () => { - const result = runWrangler( - "versions list --name test-name --experimental-versions" - ); + const result = runWrangler("versions list --name test-name"); await expect(result).resolves.toBeUndefined(); @@ -82,9 +78,7 @@ describe("versions list", () => { }); test("prints versions to stdout as --json", async () => { - const result = runWrangler( - "versions list --name test-name --json --experimental-versions" - ); + const result = runWrangler("versions list --name test-name --json"); await expect(result).resolves.toBeUndefined(); @@ -164,7 +158,7 @@ describe("versions list", () => { beforeEach(() => writeWranglerConfig()); test("prints versions to stdout", async () => { - const result = runWrangler("versions list --experimental-versions"); + const result = runWrangler("versions list"); await expect(result).resolves.toBeUndefined(); @@ -204,9 +198,7 @@ describe("versions list", () => { }); test("prints versions to as --json", async () => { - const result = runWrangler( - "versions list --json --experimental-versions" - ); + const result = runWrangler("versions list --json"); await expect(result).resolves.toBeUndefined(); diff --git a/packages/wrangler/src/__tests__/versions/versions.upload.test.ts b/packages/wrangler/src/__tests__/versions/versions.upload.test.ts index 8a2e46fd12c9..1cdeefa362ac 100644 --- a/packages/wrangler/src/__tests__/versions/versions.upload.test.ts +++ b/packages/wrangler/src/__tests__/versions/versions.upload.test.ts @@ -86,7 +86,7 @@ describe("versions upload", () => { writeWorkerSource(); setIsTTY(false); - const result = runWrangler("versions upload --x-versions"); + const result = runWrangler("versions upload"); await expect(result).resolves.toBeUndefined(); @@ -124,7 +124,7 @@ describe("versions upload", () => { writeWorkerSource(); setIsTTY(false); - const result = runWrangler("versions upload --x-versions"); + const result = runWrangler("versions upload"); await expect(result).resolves.toBeUndefined(); @@ -156,7 +156,7 @@ describe("versions upload", () => { writeWorkerSource(); setIsTTY(false); - const result = runWrangler("versions upload --x-versions"); + const result = runWrangler("versions upload"); await expect(result).resolves.toBeUndefined(); diff --git a/packages/wrangler/src/__tests__/versions/versions.view.test.ts b/packages/wrangler/src/__tests__/versions/versions.view.test.ts index 9213e9672de8..145145185dbf 100644 --- a/packages/wrangler/src/__tests__/versions/versions.view.test.ts +++ b/packages/wrangler/src/__tests__/versions/versions.view.test.ts @@ -20,9 +20,7 @@ describe("versions view", () => { beforeEach(() => msw.use(mswGetVersion())); test("fails with no args", async () => { - const result = runWrangler( - "versions view --experimental-gradual-rollouts" - ); + const result = runWrangler("versions view"); await expect(result).rejects.toMatchInlineSnapshot( `[Error: Not enough non-option arguments: got 0, need at least 1]` @@ -34,9 +32,7 @@ describe("versions view", () => { }); test("fails with --name arg only", async () => { - const result = runWrangler( - "versions view --name test-name --experimental-gradual-rollouts" - ); + const result = runWrangler("versions view --name test-name"); await expect(result).rejects.toMatchInlineSnapshot( `[Error: Not enough non-option arguments: got 0, need at least 1]` @@ -49,7 +45,7 @@ describe("versions view", () => { test("fails with positional version-id arg only", async () => { const result = runWrangler( - "versions view 10000000-0000-0000-0000-000000000000 --experimental-gradual-rollouts" + "versions view 10000000-0000-0000-0000-000000000000" ); await expect(result).rejects.toMatchInlineSnapshot( @@ -63,7 +59,7 @@ describe("versions view", () => { test("succeeds with positional version-id arg and --name arg", async () => { const result = runWrangler( - "versions view 10000000-0000-0000-0000-000000000000 --name test-name --experimental-gradual-rollouts" + "versions view 10000000-0000-0000-0000-000000000000 --name test-name" ); await expect(result).resolves.toBeUndefined(); @@ -98,7 +94,7 @@ describe("versions view", () => { test("prints version to stdout as --json", async () => { const result = runWrangler( - "versions view 10000000-0000-0000-0000-000000000000 --name test-name --json --experimental-versions" + "versions view 10000000-0000-0000-0000-000000000000 --name test-name --json" ); await expect(result).resolves.toBeUndefined(); @@ -165,9 +161,7 @@ describe("versions view", () => { }); test("fails with no args", async () => { - const result = runWrangler( - "versions view --experimental-gradual-rollouts" - ); + const result = runWrangler("versions view"); await expect(result).rejects.toMatchInlineSnapshot( `[Error: Not enough non-option arguments: got 0, need at least 1]` @@ -180,7 +174,7 @@ describe("versions view", () => { test("succeeds with positional version-id arg only", async () => { const result = runWrangler( - "versions view 10000000-0000-0000-0000-000000000000 --experimental-gradual-rollouts" + "versions view 10000000-0000-0000-0000-000000000000" ); await expect(result).resolves.toBeUndefined(); @@ -213,7 +207,7 @@ describe("versions view", () => { test("fails with non-existent version-id", async () => { const result = runWrangler( - "versions view ffffffff-ffff-ffff-ffff-ffffffffffff --experimental-gradual-rollouts" + "versions view ffffffff-ffff-ffff-ffff-ffffffffffff" ); await expect(result).rejects.toMatchInlineSnapshot( @@ -227,7 +221,7 @@ describe("versions view", () => { test("prints version to stdout as --json", async () => { const result = runWrangler( - "versions view 10000000-0000-0000-0000-000000000000 --json --experimental-versions" + "versions view 10000000-0000-0000-0000-000000000000 --json" ); await expect(result).resolves.toBeUndefined(); @@ -314,7 +308,7 @@ describe("versions view", () => { ); const result = runWrangler( - "versions view 10000000-0000-0000-0000-000000000000 --name test --experimental-versions" + "versions view 10000000-0000-0000-0000-000000000000 --name test" ); await expect(result).resolves.toBeUndefined(); @@ -361,7 +355,7 @@ describe("versions view", () => { ); const result = runWrangler( - "versions view 10000000-0000-0000-0000-000000000000 --name test --experimental-versions" + "versions view 10000000-0000-0000-0000-000000000000 --name test" ); await expect(result).resolves.toBeUndefined(); @@ -410,7 +404,7 @@ describe("versions view", () => { ); const result = runWrangler( - "versions view 10000000-0000-0000-0000-000000000000 --name test --experimental-versions" + "versions view 10000000-0000-0000-0000-000000000000 --name test" ); await expect(result).resolves.toBeUndefined(); @@ -463,7 +457,7 @@ describe("versions view", () => { ); const result = runWrangler( - "versions view 10000000-0000-0000-0000-000000000000 --name test --experimental-versions" + "versions view 10000000-0000-0000-0000-000000000000 --name test" ); await expect(result).resolves.toBeUndefined(); @@ -519,7 +513,7 @@ describe("versions view", () => { ); const result = runWrangler( - "versions view 10000000-0000-0000-0000-000000000000 --name test --experimental-versions" + "versions view 10000000-0000-0000-0000-000000000000 --name test" ); await expect(result).resolves.toBeUndefined(); @@ -651,7 +645,7 @@ describe("versions view", () => { ); const result = runWrangler( - "versions view 10000000-0000-0000-0000-000000000000 --name test --experimental-versions" + "versions view 10000000-0000-0000-0000-000000000000 --name test" ); await expect(result).resolves.toBeUndefined(); diff --git a/packages/wrangler/src/api/dev.ts b/packages/wrangler/src/api/dev.ts index 96ab85891087..78d658a0fb98 100644 --- a/packages/wrangler/src/api/dev.ts +++ b/packages/wrangler/src/api/dev.ts @@ -218,7 +218,6 @@ export async function unstable_dev( logLevel: options?.logLevel ?? defaultLogLevel, port: options?.port ?? 0, experimentalProvision: undefined, - experimentalVersions: undefined, experimentalDevEnv: undefined, experimentalRegistry: fileBasedRegistry, experimentalVectorizeBindToProd: vectorizeBindToProd ?? false, diff --git a/packages/wrangler/src/deploy/deploy.ts b/packages/wrangler/src/deploy/deploy.ts index a7c343b4c1fd..8bb9bb9a9fb4 100644 --- a/packages/wrangler/src/deploy/deploy.ts +++ b/packages/wrangler/src/deploy/deploy.ts @@ -107,7 +107,6 @@ type Props = { oldAssetTtl: number | undefined; projectRoot: string | undefined; dispatchNamespace: string | undefined; - experimentalVersions: boolean | undefined; experimentalAutoCreate: boolean; }; @@ -781,7 +780,6 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m } // We can use the new versions/deployments APIs if we: - // * have --x-versions enabled (default, but can be disabled with --no-x-versions) // * are uploading a worker that already exists // * aren't a dispatch namespace deploy // * aren't a service env deploy @@ -789,7 +787,6 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m // * we don't have DO migrations // * we aren't an fpw const canUseNewVersionsDeploymentsApi = - props.experimentalVersions && workerExists && props.dispatchNamespace === undefined && prod && diff --git a/packages/wrangler/src/deploy/index.ts b/packages/wrangler/src/deploy/index.ts index fa8a391815d8..d1c0979bcc9f 100644 --- a/packages/wrangler/src/deploy/index.ts +++ b/packages/wrangler/src/deploy/index.ts @@ -386,7 +386,6 @@ async function deployWorker(args: DeployArgs) { oldAssetTtl: args.oldAssetTtl, projectRoot, dispatchNamespace: args.dispatchNamespace, - experimentalVersions: args.experimentalVersions, experimentalAutoCreate: args.experimentalAutoCreate, }); diff --git a/packages/wrangler/src/deprecated/index.ts b/packages/wrangler/src/deprecated/index.ts index a2baf0f28281..ae0991669dfe 100644 --- a/packages/wrangler/src/deprecated/index.ts +++ b/packages/wrangler/src/deprecated/index.ts @@ -36,7 +36,6 @@ export async function buildHandler(buildArgs: BuildArgs) { "--outdir=dist", ...(buildArgs.env ? ["--env", buildArgs.env] : []), ...(buildArgs.config ? ["--config", buildArgs.config] : []), - ...(buildArgs.experimentalVersions ? ["--experimental-versions"] : []), ]).parse(); } diff --git a/packages/wrangler/src/generate/index.ts b/packages/wrangler/src/generate/index.ts index b2d9331f6261..849930aaf528 100644 --- a/packages/wrangler/src/generate/index.ts +++ b/packages/wrangler/src/generate/index.ts @@ -57,7 +57,6 @@ export async function generateHandler(args: GenerateArgs) { type: undefined, _: args._, $0: args.$0, - experimentalVersions: args.experimentalVersions, experimentalProvision: args.experimentalProvision, }); } diff --git a/packages/wrangler/src/index.ts b/packages/wrangler/src/index.ts index 0a8f6e8d894c..fbdf287b787d 100644 --- a/packages/wrangler/src/index.ts +++ b/packages/wrangler/src/index.ts @@ -25,12 +25,6 @@ import { isBuildFailure, isBuildFailureFromCause, } from "./deployment-bundle/build-failures"; -import { - commonDeploymentCMDSetup, - deployments, - rollbackDeployment, - viewDeployment, -} from "./deployments"; import { buildHandler, buildOptions, @@ -273,14 +267,6 @@ export function getLegacyScriptName( } export function createCLIParser(argv: string[]) { - const experimentalGradualRollouts = - // original flag -- using internal product name (Gradual Rollouts) -- kept for temp back-compat - !argv.includes("--no-experimental-gradual-rollouts") && - // new flag -- using external product name (Versions) - !argv.includes("--no-experimental-versions") && - // new flag -- shorthand - !argv.includes("--no-x-versions"); - // Type check result against CommonYargsOptions to make sure we've included // all common options const wrangler: CommonYargsArgv = makeCLI(argv) @@ -340,13 +326,6 @@ export function createCLIParser(argv: string[]) { } return true; }) - .option("experimental-versions", { - describe: `Experimental: support Worker Versions`, - type: "boolean", - default: true, - hidden: true, - alias: ["x-versions", "experimental-gradual-rollouts"], - }) .check((args) => { // Grab locally specified env params from `.env` file const loaded = loadDotEnv(".env", args.env); @@ -479,170 +458,79 @@ export function createCLIParser(argv: string[]) { deployHandler ); - if (experimentalGradualRollouts) { - registry.define([ - { command: "wrangler deployments", definition: deploymentsNamespace }, - { - command: "wrangler deployments list", - definition: deploymentsListCommand, - }, - { - command: "wrangler deployments status", - definition: deploymentsStatusCommand, - }, - { - command: "wrangler deployments view", - definition: deploymentsViewCommand, - }, - ]); - registry.registerNamespace("deployments"); - } else { - wrangler.command( - "deployments", - "🚢 List and view the current and past deployments for your Worker", - (yargs) => - yargs - .option("name", { - describe: "The name of your Worker", - type: "string", - }) - .command( - "list", - "Displays the 10 most recent deployments for a Worker", - async (listYargs) => listYargs, - async (listYargs) => { - const { accountId, scriptName, config } = - await commonDeploymentCMDSetup(listYargs); - await deployments(accountId, scriptName, config); - } - ) - .command( - "view [deployment-id]", - "View a deployment", - async (viewYargs) => - viewYargs.positional("deployment-id", { - describe: "The ID of the deployment you want to inspect", - type: "string", - demandOption: false, - }), - async (viewYargs) => { - const { accountId, scriptName, config } = - await commonDeploymentCMDSetup(viewYargs); - - await viewDeployment( - accountId, - scriptName, - config, - viewYargs.deploymentId - ); - } - ) - .command(subHelp) - ); - } + registry.define([ + { command: "wrangler deployments", definition: deploymentsNamespace }, + { + command: "wrangler deployments list", + definition: deploymentsListCommand, + }, + { + command: "wrangler deployments status", + definition: deploymentsStatusCommand, + }, + { + command: "wrangler deployments view", + definition: deploymentsViewCommand, + }, + ]); + registry.registerNamespace("deployments"); - // rollback - const rollbackDescription = "🔙 Rollback a deployment for a Worker"; - - if (experimentalGradualRollouts) { - registry.define([ - { command: "wrangler rollback", definition: versionsRollbackCommand }, - ]); - registry.registerNamespace("rollback"); - } else { - wrangler.command( - "rollback [deployment-id]", - rollbackDescription, - (rollbackYargs) => - rollbackYargs - .positional("deployment-id", { - describe: "The ID of the deployment to rollback to", - type: "string", - demandOption: false, - }) - .option("message", { - alias: "m", - describe: - "Skip confirmation and message prompts, uses provided argument as message", - type: "string", - default: undefined, - }) - .option("name", { - describe: "The name of your Worker", - type: "string", - }), - async (rollbackYargs) => { - const { accountId, scriptName, config } = - await commonDeploymentCMDSetup(rollbackYargs); - - await rollbackDeployment( - accountId, - scriptName, - config, - rollbackYargs.deploymentId, - rollbackYargs.message - ); - } - ); - } + registry.define([ + { command: "wrangler rollback", definition: versionsRollbackCommand }, + ]); + registry.registerNamespace("rollback"); - // versions - if (experimentalGradualRollouts) { - registry.define([ - { - command: "wrangler versions", - definition: versionsNamespace, - }, - { - command: "wrangler versions view", - definition: versionsViewCommand, - }, - { - command: "wrangler versions list", - definition: versionsListCommand, - }, - { - command: "wrangler versions upload", - definition: versionsUploadCommand, - }, - { - command: "wrangler versions deploy", - definition: versionsDeployCommand, - }, - { - command: "wrangler versions secret", - definition: versionsSecretNamespace, - }, - { - command: "wrangler versions secret put", - definition: versionsSecretPutCommand, - }, - { - command: "wrangler versions secret bulk", - definition: versionsSecretBulkCommand, - }, - { - command: "wrangler versions secret delete", - definition: versionsSecretDeleteCommand, - }, - { - command: "wrangler versions secret list", - definition: versionsSecretsListCommand, - }, - ]); - registry.registerNamespace("versions"); - } + registry.define([ + { + command: "wrangler versions", + definition: versionsNamespace, + }, + { + command: "wrangler versions view", + definition: versionsViewCommand, + }, + { + command: "wrangler versions list", + definition: versionsListCommand, + }, + { + command: "wrangler versions upload", + definition: versionsUploadCommand, + }, + { + command: "wrangler versions deploy", + definition: versionsDeployCommand, + }, + { + command: "wrangler versions secret", + definition: versionsSecretNamespace, + }, + { + command: "wrangler versions secret put", + definition: versionsSecretPutCommand, + }, + { + command: "wrangler versions secret bulk", + definition: versionsSecretBulkCommand, + }, + { + command: "wrangler versions secret delete", + definition: versionsSecretDeleteCommand, + }, + { + command: "wrangler versions secret list", + definition: versionsSecretsListCommand, + }, + ]); + registry.registerNamespace("versions"); - // triggers - if (experimentalGradualRollouts) { - wrangler.command( - "triggers", - "🎯 Updates the triggers of your current deployment", - (yargs) => { - return registerTriggersSubcommands(yargs.command(subHelp)); - } - ); - } + wrangler.command( + "triggers", + "🎯 Updates the triggers of your current deployment", + (yargs) => { + return registerTriggersSubcommands(yargs.command(subHelp)); + } + ); // delete wrangler.command( diff --git a/packages/wrangler/src/triggers/deploy.ts b/packages/wrangler/src/triggers/deploy.ts index 946a9d4c74c7..a8e4c06e0ce9 100644 --- a/packages/wrangler/src/triggers/deploy.ts +++ b/packages/wrangler/src/triggers/deploy.ts @@ -28,7 +28,6 @@ type Props = { routes: string[] | undefined; legacyEnv: boolean | undefined; dryRun: boolean | undefined; - experimentalVersions: boolean | undefined; assetsOptions: AssetsOptions | undefined; }; @@ -276,10 +275,7 @@ export default async function triggersDeploy( const deployMs = Date.now() - start - uploadMs; if (deployments.length > 0) { - const msg = props.experimentalVersions - ? `Deployed ${workerName} triggers` - : `Published ${workerName}`; - logger.log(msg, formatTime(deployMs)); + logger.log(`Deployed ${workerName} triggers`, formatTime(deployMs)); const flatTargets = targets.flat().map( // Append protocol only on workers.dev domains diff --git a/packages/wrangler/src/triggers/index.ts b/packages/wrangler/src/triggers/index.ts index d19ed35f5af9..50093a60020c 100644 --- a/packages/wrangler/src/triggers/index.ts +++ b/packages/wrangler/src/triggers/index.ts @@ -78,7 +78,6 @@ async function triggersDeployHandler( routes: args.routes, legacyEnv: isLegacyEnv(config), dryRun: args.dryRun, - experimentalVersions: args.experimentalVersions, assetsOptions, }); } diff --git a/packages/wrangler/src/yargs-types.ts b/packages/wrangler/src/yargs-types.ts index 9397389323c7..edb7b63e51c3 100644 --- a/packages/wrangler/src/yargs-types.ts +++ b/packages/wrangler/src/yargs-types.ts @@ -8,7 +8,6 @@ export interface CommonYargsOptions { v: boolean | undefined; config: string | undefined; env: string | undefined; - "experimental-versions": boolean | undefined; "experimental-provision": boolean | undefined; }