Skip to content

Commit

Permalink
Deprecate version command (#5069)
Browse files Browse the repository at this point in the history
* deprecate `wrangler version` command

`wrangler --version` is already supported and recommended instead
  • Loading branch information
RamIdeas committed Mar 15, 2024
1 parent 0c535e7 commit 8f79981
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .changeset/twelve-penguins-guess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"wrangler": patch
---

chore: deprecate `wrangler version` command

`wrangler version` is an undocumented alias for `wrangler --version`. It is being deprecated in favour of the more conventional flag syntax to avoid confusion with a new (upcoming) `wrangler versions` command.
18 changes: 16 additions & 2 deletions packages/wrangler/src/__tests__/version.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,32 @@ describe("version", () => {
// `);
// });

it("should output current version if !isTTY calling -v", async () => {
it("should output current version if !isTTY calling with `-v` flag", async () => {
setIsTTY(false);

await runWrangler("-v");
expect(std.out).toMatch(version);
expect(std.warn).toBe("");
});

// This run separately as command handling is different
it("should output current version if !isTTY calling --version", async () => {
it("should output current version if !isTTY calling with `--version` flag", async () => {
setIsTTY(false);

await runWrangler("--version");
expect(std.out).toMatch(version);
expect(std.warn).toBe("");
});

it("should output current version if !isTTY calling (deprecated) `version` command", async () => {
setIsTTY(false);

await runWrangler("version");
expect(std.out).toMatch(version);
expect(std.warn).toMatchInlineSnapshot(`
"▲ [WARNING] \`wrangler version\` is deprecated and will be removed in a future major version. Please use \`wrangler --version\` instead.
"
`);
});
});
6 changes: 5 additions & 1 deletion packages/wrangler/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ export function createCLIParser(argv: string[]) {
// This set to false to allow overwrite of default behaviour
wrangler.version(false);

// version
// version (DEPRECATED)
wrangler.command(
"version",
false,
Expand All @@ -714,6 +714,10 @@ export function createCLIParser(argv: string[]) {
} else {
logger.log(wranglerVersion);
}

logger.warn(
"`wrangler version` is deprecated and will be removed in a future major version. Please use `wrangler --version` instead."
);
}
);

Expand Down

0 comments on commit 8f79981

Please sign in to comment.