Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using different environments -- command is erroneous #10935

Open
AdamWientek opened this issue Feb 10, 2025 · 1 comment
Open

Using different environments -- command is erroneous #10935

AdamWientek opened this issue Feb 10, 2025 · 1 comment
Labels
help wanted Issues looking for someone to run with them! improve or update documentation Enhance / update existing documentation (e.g. add example, improve description, update for changes)

Comments

@AdamWientek
Copy link

📚 Subject area/topic

environment variables

📋 Page(s) affected (or suggested, for new content)

https://docs.astro.build/en/guides/environment-variables/#setting-environment-variables

📋 Description of content that is out-of-date or incorrect

In order to use different env-files, current documentation states the following command
"astro dev --mode staging"
where 'staging' refers to an env-file '.env.staging'.

This command does not work. Imho the reason for that bug is the command is not complete.
When changed to
"astro dev -- --mode staging" [in my case prefixed with an "npm run " i now can switch between different env-files via the mode-option.

In Discord you find the same error, see https://discord.com/channels/830184174198718474/1306650092886954107

🖥️ Reproduction in StackBlitz (if reporting incorrect content or code samples)

No response

@ArmandPhilippot
Copy link
Member

Thanks for reporting this issue! It is correct for pnpm and yarn, but you're right for npm we need -- before the flag. This matches the syntax used for the other flags (e.g https://docs.astro.build/en/reference/cli-reference/#packagejson-scripts).

So to display a correct version for each package manager what we could do here is use the PackageManagerTabs component for this example (as we already do here https://docs.astro.build/en/guides/environment-variables/#using-the-cli for example).

I will add the help wanted label here so someone can update the example to fix this issue, but feel free to create the PR yourself if you want!

@ArmandPhilippot ArmandPhilippot added improve or update documentation Enhance / update existing documentation (e.g. add example, improve description, update for changes) help wanted Issues looking for someone to run with them! labels Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Issues looking for someone to run with them! improve or update documentation Enhance / update existing documentation (e.g. add example, improve description, update for changes)
Projects
None yet
Development

No branches or pull requests

2 participants