-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
RFC: Make conventional directories for config and data the default #5343
base: master
Are you sure you want to change the base?
Conversation
This change will decrease the build size from 10.45 MB to 10.45 MB, a decrease of 1.25 KB (0%)
|
@wbinnssmith, so in current implementation it does not handle migration? |
yeah right now it doesn't. I just opened this up with the content of the initial version of the last PR so we can get a discussion going. The simplest thing which would preserve the current behavior of having these values available at export time would be to synchronously stat the old locations and conditionally synchronously move it at startup time, then synchronously place a symlink to the new location. There's likely a performance hit doing this on every invocation of yarn, but assuming the common case is a single stat, it may not be so bad. How about I prototype that and report back with some benchmarks? Note that after a number of releases we can remove the symlink, and then a number of releases after that we can remove the check all-together. |
@yarnpkg/core, this looks like a PR for major version bump. Opinions? |
I personally like the change, I think we should do a similar check like Lines 251 to 253 in b2d3e1a
I.e. with Yarn 2.0.0 onwards the directory will change to xyz, to avoid any conflicts in the future and remove this warning message you can type in `mv abc xyz` or re-add your global packages
|
I like the idea of soft warning. |
I also think it's an elegant solution to warn the user, prompting them to run something manually rather than automatically moving things from underneath them. Something like Unfortunately determining whether to display this warning will involve another fs stat (specifically a synchronous one if we want to remain compatible with the way constants work right now). I'll push something up in the coming days that explores this. Looking forward to more thoughts! |
@wbinnssmith I think you're right that it'll no longer have to be a constant and have to be determined during runtime like we do for cache folder Lines 298 to 316 in ce47045
So I was thinking that if the previous directory does exist, we'd just fallback to existing directory and emit the warning message, then we actually replace the fallback and warning in 2.0. Wdyt? |
and, awesome job, thanks for the PR ❤️ 🎉 |
@kaylie-alexa That approach sounds pretty reasonable to me. @wbinnssmith are you still interested in working on this? Let us know if you'd like to hand this off to someone else. |
@Gudahtt I would propose to use
Where |
@Gudahtt @wbinnssmith thoughts? |
Following from yarnpkg#5336, this makes the typical directories for XDG and Windows conventions the default. This RFC is really carried over from yarnpkg#5336, where we continued to use the existing locations inside ~/.config and punted on migrating users to these new locations. A suggestion from the prior PR include moving the contents of the existing directories (should they exist), leaving a symlink in place. I really like this approach, however there will be a cost to checking to see if these directories exist and leaving symlinks behind in a synchronous way to maintain compatibility with how we expose constants synchronously from a module. Please chime in!
@Siilwyn I've been thinking of taking this up again given Yarn v2 is approaching (or is at least planned). Happy to work together, or if you'd prefer to tackle this yourself that's fine too. @Siilwyn I like that Given the typescript change and the upcoming plans for v2, is there anything we should keep in mind @kaylie-alexa and @arcanis? Sorry for the delay. |
2d4f35c
to
54fd782
Compare
@wbinnssmith yeah would be happy to collab! I actually took a stab at this last week but got stuck at trying to write tests for both situations where: the old location should be used and when the new one should be used. I'll push the code, was looking into either dependency injection or using a Sinon sandbox. Using Would be good to know what is planned for version two, but remember this won't be breaking change if we fallback to the old location! |
Not to speak for them, but I don't think the plans for v2 change anything about how we should proceed with this issue. This can be accomplished without a breaking change, and clearly is desired by a lot of people. It would be great to get this in v1. Yarn v1 will continue to be maintained for the foreseeable future.
Interesting. This point was raised by @Siilwyn in the Using MacOS standards might be safer, as that's the option most likely to "just work". As alluded to by the Though perhaps the permissions problems were overstated, or are no longer common? I don't have any recent experience with MacOS either, so I'd be interested to hear others perspectives on this. Edit: Oh, I see what you mean now about not changing the path again. I had forgotten that Yarn already uses |
Pushed my code so far at my fork on the The tests are mostly skipped, need to work on those and add tests to check if the fallback strategy works, I guess by mocking (also I have no experience with flow so added |
I have some concerns about putting this in the v1 - the problem I see is that if we change the directory paths, it will affect currently existing setups. For example Yarn will start looking for links in different directories than before, which could unexpectedly break installs. Same things for global installs, etc. It's definitely something that we should do going forward, but I feel like the cons outweigh the cons to ship this without a major bump (especially when a major is so close). Opinions? |
@arcanis it won't affect existing setups since it will first use the 'old' paths. So only on new setups the change will have an effect. |
I have tested my branch by building the dist and switching to the binary in my day-to-day usage. One thing I noticed is that |
@Siilwyn Just checking how this feature is going, did you get to fully functional and it just needs to be merged? |
Hi @quintrino no I didn't, feel free to pick up this issue. |
any progress? |
@soredake no, feel free to pick this up. I dropped it because I couldn't find the time. With Berry coming up / released I also have no idea how this will be done. |
I think this is supported now? 2d454b5 |
Following from #5336, this makes the typical directories for XDG and Windows conventions the default.
This RFC is really carried over from #5336, where we continued to use the existing locations inside ~/.config and punted on migrating users to these new locations.
A suggestion from the prior PR include moving the contents of the existing directories (should they exist), leaving a symlink in place.
I really like this approach, however there will be a cost to checking to see if these directories exist and leaving symlinks behind in a synchronous way to maintain compatibility with how we expose constants synchronously from a module.
Please chime in!