Skip to content

Commit

Permalink
fix: pages "command" can consist of multiple words (#1057)
Browse files Browse the repository at this point in the history
On Windows, the following command `wrangler pages dev -- foo bar` would error
saying that `bar` was not a known argument. This is because `foo` and `bar` are
passed to Yargs as separate arguments.

A workaround is to put the command in quotes: `wrangler pages dev -- "foo bar"`.
But this fix makes the `command` argument variadic, which also solves the problem.

Fixes [#965](#965)
  • Loading branch information
petebacondarwin authored May 19, 2022
1 parent 8eeef9a commit 608dcd9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
14 changes: 14 additions & 0 deletions .changeset/tame-tigers-impress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
"wrangler": patch
---

fix: pages "command" can consist of multiple words

On Windows, the following command `wrangler pages dev -- foo bar` would error
saying that `bar` was not a known argument. This is because `foo` and `bar` are
passed to Yargs as separate arguments.

A workaround is to put the command in quotes: `wrangler pages dev -- "foo bar"`.
But this fix makes the `command` argument variadic, which also solves the problem.

Fixes [#965](https://github.com/cloudflare/wrangler2/issues/965)
8 changes: 4 additions & 4 deletions packages/wrangler/src/__tests__/pages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ describe("pages", () => {
⚡️ Configure Cloudflare Pages
Commands:
wrangler pages dev [directory] [-- command] 🧑‍💻 Develop your full-stack Pages application locally
wrangler pages project ⚡️ Interact with your Pages projects
wrangler pages deployment 🚀 Interact with the deployments of a project
wrangler pages publish [directory] 🆙 Publish a directory of static assets as a Pages deployment
wrangler pages dev [directory] [-- command..] 🧑‍💻 Develop your full-stack Pages application locally
wrangler pages project ⚡️ Interact with your Pages projects
wrangler pages deployment 🚀 Interact with the deployments of a project
wrangler pages publish [directory] 🆙 Publish a directory of static assets as a Pages deployment
Flags:
-c, --config Path to .toml configuration file [string]
Expand Down
2 changes: 1 addition & 1 deletion packages/wrangler/src/pages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,7 @@ const createDeployment: CommandModule<
export const pages: BuilderCallback<unknown, unknown> = (yargs) => {
return yargs
.command(
"dev [directory] [-- command]",
"dev [directory] [-- command..]",
"🧑‍💻 Develop your full-stack Pages application locally",
(yargs) => {
return yargs
Expand Down

0 comments on commit 608dcd9

Please sign in to comment.