Skip to content

Improve CLI arguments for the wrangler deploy command by adding a new generic --path option and making the --script option explicit - #11371

Closed
dario-piotrowicz wants to merge 1 commit into
mainfrom
dario/DEVX-2333/wrangler-deploy-positional-path-arg
Closed

Improve CLI arguments for the wrangler deploy command by adding a new generic --path option and making the --script option explicit#11371
dario-piotrowicz wants to merge 1 commit into
mainfrom
dario/DEVX-2333/wrangler-deploy-positional-path-arg

Conversation

@dario-piotrowicz

@dario-piotrowicz dario-piotrowicz commented Nov 20, 2025

Copy link
Copy Markdown
Member

Fixes https://jira.cfdata.org/browse/DEVX-2333

Before:
Screenshot 2025-11-20 at 23 38 40

After:
Screenshot 2025-11-20 at 23 39 40

Describe your change...


  • Tests
    • Tests included
    • Tests not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: this will be automatically(?) documented
  • Wrangler V3 Backport
    • Wrangler PR:
    • Not necessary because: Providing an assets directory to wrangler deploy has been added as a new v4-only functionality (see #10016)

@changeset-bot

changeset-bot Bot commented Nov 20, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 755914e

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Nov 20, 2025

Copy link
Copy Markdown
create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@11371

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@11371

miniflare

npm i https://pkg.pr.new/miniflare@11371

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@11371

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@11371

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@11371

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@11371

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@11371

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@11371

wrangler

npm i https://pkg.pr.new/wrangler@11371

commit: 755914e

@dario-piotrowicz
dario-piotrowicz force-pushed the dario/DEVX-2333/wrangler-deploy-positional-path-arg branch from b1f7d70 to e17c520 Compare November 24, 2025 18:32
@dario-piotrowicz
dario-piotrowicz marked this pull request as ready for review November 25, 2025 12:35
@dario-piotrowicz
dario-piotrowicz requested a review from a team as a code owner November 25, 2025 12:35
@dario-piotrowicz
dario-piotrowicz force-pushed the dario/DEVX-2333/wrangler-deploy-positional-path-arg branch 2 times, most recently from 1820fbd to 0918042 Compare November 26, 2025 18:25
…ew generic `--path` option and making the `--script` option explicit
@dario-piotrowicz
dario-piotrowicz force-pushed the dario/DEVX-2333/wrangler-deploy-positional-path-arg branch from 0918042 to 755914e Compare November 27, 2025 11:22

@petebacondarwin petebacondarwin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should validate that an explicit --script arg points to a file (and not a directory).

Comment on lines +291 to +292
// TODO: In the next Wrangler major change this logic to treat the path arg as an assets directory while
// using the script arg as the entrypoint path (e.g. just as `wrangler deploy --assets <ASSETS_PATH> --script <SCRIPT_PATH>`)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this really be a breaking change?
The use must have opted in to providing the --script arg, so they can expect different behaviour, no?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this really be a breaking change? The use must have opted in to providing the --script arg, so they can expect different behaviour, no?

mh.... sorry I am not sure I follow...

Let's say that the user has a CI job or script or anything that automatically runs wrangler deploy --script <PATH>, if we caused this to behave differently here, wouldn't that constitute as a breaking change?

@github-project-automation github-project-automation Bot moved this from Untriaged to In Review in workers-sdk Nov 28, 2025
@dario-piotrowicz

Copy link
Copy Markdown
Member Author

I think we should validate that an explicit --script arg points to a file (and not a directory).

Mh.... as I mentioned I think that --script needs to be able to point to a directory, that is how things work today (wrangler deploy --script <ASSETS_DIR> works totally fine), changing such behavior would be a breaking change, wouldn't it? 😕

@petebacondarwin

Copy link
Copy Markdown
Contributor

I think we should validate that an explicit --script arg points to a file (and not a directory).

Mh.... as I mentioned I think that --script needs to be able to point to a directory, that is how things work today (wrangler deploy --script <ASSETS_DIR> works totally fine), changing such behavior would be a breaking change, wouldn't it? 😕

Oh gosh! Can you actually do --script right now, even though in the definition it is a positional arg? I didn't realise things worked like that. Shame.

What if we make script hidden and have a new positional called --main or something? So that we can define the behaviour of that accurately?

@petebacondarwin

Copy link
Copy Markdown
Contributor

Then we would have path (which has a hidden alias of script), --assets and --main.

@penalosa

Copy link
Copy Markdown
Contributor

Oh gosh! Can you actually do --script right now, even though in the definition it is a positional arg? I didn't realise things worked like that. Shame.

Yeah, it's super weird behaviour from yargs

@dario-piotrowicz

Copy link
Copy Markdown
Member Author

What if we make script hidden and have a new positional called --main or something? So that we can define the behaviour of that accurately?

Closing this PR since introducing a new main option and hide script would need to be done across the board I believe (having some commands accept --script and some --main would in my opinion provide a very confusing and unclear UX) and for that most of this PR would be changed anyways.

Also the scope and risks involved would be significantly higher (I am not even completely sure if that'd be worth the effort?).

I'll try to come back to this when I'll have some bandwidth.

@github-project-automation github-project-automation Bot moved this from In Review to Done in workers-sdk Nov 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants