A command field in astro:config:setup returns build value while running check command #10876
Closed
1 task done
Labels
- P2: nice to have
Not breaking anything but nice to have (priority)
feat: integration api
related to the public integration APIs (scope)
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
Let's assume an Astro config like below:
While running
astro check
the console outputsbuild
string. This can be confusing, especially when running the command in the default pipeline:astro check & astro build
. In this case, theastro:config:setup
hook is called twice withcommand === 'build'
, unexpectedly triggering certain code twice during the build.Also, this behavior isn't documented: https://docs.astro.build/en/reference/integrations-reference/#command-option
It appears to be caused by a hardcoded 'build' value in the mentioned line:https://github.com/withastro/astro/blob/main/packages/astro/src/core/sync/index.ts#L62
What's the expected result?
I suggest three possible solutions:
command
while runningastro check
hascheck
valueastro check
command is integrated withastro build
always, soastro:config:setup
calls once only (I think it's the worst option)Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-yfhwgr?file=astro.config.mjs
Participation
The text was updated successfully, but these errors were encountered: