-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add new preferences module #9115
Conversation
🦋 Changeset detectedLatest commit: fb9e046 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is blocked because it contains a minor
changeset. A reviewer will merge this at the next release if approved.
I could definitely see this in a separate package, I notable can very easily see
No particular thoughts, but I assume we don't want users to confuse it with
Since the dev overlay is stable in like two weeks, maybe we just yolo it? I don't see us relying on this module for othe rthings soon anyway. |
If we're bikeshedding on command name/API:
|
36a0a86
to
df098c6
Compare
I firmly believe that we shouldn't provide a |
I don't really understand how the global config is related to installing Astro globally, what's the relation? |
Thank you for the feedback @FredKSchott! I believe I've addressed all of that now.
|
@ematipico I understand where you're coming from, but the ability to set a preference for all Astro projects is one of the explicit goals. I don't think users will confuse a For some additional context: the |
Having a local and a global configuration is a very risky business, because a single change in the configuration, even the addition of a new property, would mean that a previous version wouldn't be able to understand it. If this single change goes into the global configuration, the rest of the projects won't work anymore, unless they are upgraded. It would make DX a living hell. I'm not sure we should allow a global configuration. |
I'm still not sure I understand your specific concerns. The intention for this feature is to support global user preferences that impact every Astro project. Telemetry already works this way—if a user opts out of telemetry, every Astro project needs to respect that preference. Semver and backwards-compatibility are a requirement with the global preferences as they are with any feature. |
To handle versioning of config file changes I've seen done by having a "version" field in the config file. Since this file is edited by a CLI and not by hand, I think that handles the concern well. @ematipico The UX here of "I want this disabled in all projects" seems perfectly valid as a goal. Would you agree? If so, is there any other way to achieve that goal than something like this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs look great for the changeset, Nate! We'll just need something added to the CLI reference page in docs itself!
I don't know how much we plan to rely on global settings in the future, so please take my takes with a grain of salt.
I am aware of it, but this won't fix our issues. Here's a practical example. You add a global
Upon revisiting the file, we discovered the issue and published a patch in
Now all projects with version Also, imagine these issues on minor releases or major releases of The way I see it, the only way to land this feature without repercussions, is to make sure that Astro can understand ALL the versions of |
To @ematipico's concern, if Nate committed to long-term full backwards compatibility, would that address your concern? Ex: in your scenario above, the "fixed" version of Astro would write to both For context, this is not a module that we should expect a lot of usage and changes in. To look at its history, you could say that we introduced the first preference for telemetry in Astro 1.0, and now the second preference for the dev overlay in 4.0. I don't think there's any reason to think that this will accelerate, and if it did I imagine we could revisit this system in the future without being too blocked. My main point would be that if your concern is with the larger concept of global configuration, that's probably a larger conversation given that we already have the concept of global configuration in Astro today powering the global telemetry opt-out. |
Thanks for the elaboration @ematipico and for chiming in @FredKSchott! I understand the concern and agree that backwards-compatibility is essential for this feature. Changes to the configuration options would be handled with the same concern for proper semantic versioning as the rest of |
c42c2ac
to
2d5c21b
Compare
7e52830
to
6026a51
Compare
7a8b40a
to
9f74d11
Compare
Changes
experimental.devOverlay
astro.config.mjs
file manages configuration for a specific project on any machine, user preferences manage configuration for a specific user (machine)..astro/settings.json
file..gitignore
the.astro/
directory, this is a natural place to put settings for an individual user.astro preferences
CLI command, designed to mirror thepnpm config
command.Open Questions
astro
or a separate package? I could see this module being used in@astrojs/telemetry
andcreate-astro
to configure certain default behavior.astro config
? I can see that being hard to document. I consideredastro prefs
orastro settings
but both felt weird.astro preferences
it is!config
would have been confusing to users because of theastro.config.mjs
file andsettings
would have been confusing for maintainers because there is an existingAstroSettings
that means something else.astro experimental-config
?Testing
Tested manually because I'm not sure how pipe the mocked
fs
through the system just yetDocs
#5512 and added to the Astro 4.0 breaking changes tracker