Skip to content

🚀 Feature Request: Support argument for wrangler to run in different working directory #7993

@pi0

Description

@pi0

Describe the solution

With the introduction of the generated wrangler config (#7442), some commands like wrangler pages dev|deploy require to be running in the correct working directory to be working as intended and reading generated wrangler config (or user config).

A global option like -C, --cwd in wrangler CLI can guarantee we can reliably run all commands in the project working directory without depending on the package manager monorepo features (which is not always possible).


Context: Nitro (and Nuxt) generates command hints after building for cloudflare pages. These commands are meant to be directly running in the user CLI and relative to where the build was issued for example:

$ <pm> nitro build path/to/project
✔ You can preview this build using npx wrangler pages dev path/to/project                              
✔ You can deploy this build using npx wrangler pages deploy path/to/project

Working on nitrojs/nitro#2949, noticed the above hint is not reliable because it won't use any of the wrangler configs from path/to/project

It is possible to manually point to the config path with -c, --config for modules in the example above but for pages, the only way is to somehow change CWD we need to show something like cd path/to/project && npx wrangler pages dev.

Quickly discussed with @petebacondarwin if we could make it a better DX from Wrangler CLI itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions