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

Fix: Allow setting build dir when running a task from cli. #2219

Closed

Conversation

hareland
Copy link

@hareland hareland commented Mar 4, 2024

This is useful to allow usage in Nuxt.

πŸ”— Linked issue

Related to: #1974

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Allow to set the build directory - this allows usage within Nuxt for example.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

I am not sure if i forgot anything for this to be appreciated, also i am not sure about the naming convention.
Feedback would be appreciated.

@hareland
Copy link
Author

hareland commented Mar 4, 2024

Would be great if anyone has an idea of how this possibly can be set using the config, because otherwise it needs to be added in package.json or in the call every time.

@pi0
Copy link
Member

pi0 commented Mar 5, 2024

Thanks for this PR. yes, we need to specify build-dir but I'm afraid 1) it is too early to expand experiment and 2) we might need to use programmatic API exports of Nitro for Nuxi CLI instead of depending on nitro CLI. (I'm have it on plan ~> nuxt/cli#353)

Nitro CLI itself can load nitro.config to respect the buildDir (PR welcome for this) but it won't be useful for Nuxt. Nitro will never involve in reading downstream configs (#2196 (comment))

For clarity I'm closing this PR for now.

@pi0 pi0 closed this Mar 5, 2024
@hareland
Copy link
Author

hareland commented Mar 6, 2024

@pi0, thanks for your reply!

Thanks for this PR. yes, we need to specify build-dir but I'm afraid 1) it is too early to expand experiment and 2) we might need to use programmatic API exports of Nitro for Nuxi CLI instead of depending on nitro CLI. (I'm have it on plan ~> nuxt/cli#353)

I see, and get that.

Nitro CLI itself can load nitro.config to respect the buildDir (PR welcome for this) but it won't be useful for Nuxt. Nitro will never involve in reading downstream configs (#2196 (comment))

Could you please point me in the right direction as to how i can read the nitro config from the cli? Should i load this myself or is a there a useNitroConfig type of utility?

Also, how is nitro reading config from when you set it upstream then...? When you define a preset from nuxt.config.ts for example, it is propagated, but how does this happen, and would this not be a good place to set it by default in the case of nuxt?

Thanks in advance!

@pi0
Copy link
Member

pi0 commented Mar 6, 2024

When nitro used in other meta frameworks (Nuxt), it won't read config itself and Nuxt provides the config after reading nitro key in nuxt.config.ts that why we cannot have this logic in Nitro but should be in Nuxt.

Options loading mechanism is here btw: https://github.com/unjs/nitro/blob/main/src/options.ts#L144

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants