-
Notifications
You must be signed in to change notification settings - Fork 18
feat: nupm registry
subcommand
#122
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
base: main
Are you sure you want to change the base?
Conversation
Seems like you're adding a new concept of "registry index" file that replaces the
|
@kubouch thanks for the feedback, do note this is a draft PR so
I could use some feedback here but I see three usecases when dealing with registries that aren't covered yet:
|
I'd say for consistency, if we initialize something, let's call it
|
I think we should prefer environment variables over filesystem items for configuration of nupm, for these reason:
Since we may collect a few more variables, a nested record like this could simply be added to the end of or sourced by one of the existing config files:
|
@Rydwxz are you suggesting registries to be added manually? I think doing programmatic addition/removal of registries could reduce some UX friction as well as allow for some sanitisation of what goes into the record. |
I want to be able to have a fully declarative configuration that uses |
@Rydwxz @kubouch this is ready for review. Since there's already a lot to review I would like to defer commands to initialize registries and packages into a separate PR: Lines 241 to 251 in baaf4f4
|
Hi @mkatychev, first of all thank you for making all those changes to accomodate what I asked! The declarative configuration that I was worried about can be achieved without it, so I am worried that I accidentally added too much to the scope of this PR when I mentioned changing to a nested environment variable. I think it's the most sensible/scalable way to organize things, but it might be a breaking change for people who are manually setting those variables right now. |
@Rydwxz I can revert the nested config structure in this PR. |
@Rydwxz I've reverted the requested changes, this should be ready for review once more |
@@ -1,8 +1,8 @@ | |||
# Design of `nupm` :warning: Work In Progress :warning: |
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.
General typos also to a separate file, please, otherwise the commit history becomes a mess.
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.
Apologies, thought this was a squash merge repo, I will reword
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.
Sorry, I meant, could you move the .md files into a separate PRs? These changes are unrelated to adding the nupm registry
subcommand. Yes, we squash, which would result in these typos being labeled as "nupm registry subcommand" -- this can be annoying eg. when using Git blame.
Sorry for the late reply, I'm not available as much as I used to be. I think some of these would be better moved to a separate PR. Also left some misc comments. I would also leave out About the registries, I think having only the index file should be fine. With the A big part of future nupm is virtual environments using overlays, similar to what I sketched in https://github.com/kubouch/nuun. Overlay would define NUPM_HOME and all the stuff derived from it, such as PATH, the registry index file, etc. Here is an example overlay-creation code (very bare-bones). Some things are better left global, like cache -- the point of cache is to reuse stuff between virtual environments. But I think each virtual environment should have its own registry index, and handling them via overlays lets you set it from I hope it's a bit clearer now. Otherwise, seems good, the registry subcommands can be expanded/tweaked as necessary in future PRs. |
Agreed, my mistake on not removing it, realized it was there to largely test private registries.
Would probably be good to get an overlay test at some point. |
typos reworded pretty print name
54754cb
to
4c55581
Compare
@kubouch hopefully this should address most of the issues. |
} | ||
|
||
let registry_url = $env.NUPM_REGISTRIES | get $registry | ||
let registry_cache_dir = cache-dir --ensure | path join $registry |
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.
I think you're missing the registry
subdirectory here. It now dumps the files into $env.NUPM_CACHE/<registry-name>
instead of $env.NUPM_CACHE/registry/<registry-name>
.
|
||
mkdir ($reg_file | path dirname) | ||
$reg | save --force $reg_file | ||
let registry_cache_dir = cache-dir --ensure | path join $name |
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.
Here too, I think, missing registry
subdirectory.
init-index | ||
return | ||
} | ||
# TODO initialize registry index here |
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.
Here it should print something like "nupm registry init without --index is not implemented yet".
$env.NUPM_REGISTRIES | save --force $env.NUPM_INDEX_PATH | ||
} | ||
|
||
print $"Registry '($name)' added successfully." |
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.
Here (and other commands with the --save
flag), the print should reflect what happened depending on the --save
flag, for example:
- $"Registry '($name)' added successfully. To make the change permanent by saving it to the registry index, use the --save flag."
- $"Registry '($name)' added successfully and saved to ($env.NUPM_INDEX_PATH)."
OK, I think it's good, except a few minor comments. We can merge it with the NUPM_REGISTRIES and refactor the system as we implement the overlays. I originally thought that it would be better to defer implementing overlays until the base features work reliably well, but given how central overlays are to the overall design, I'm thinking that should be the next step to implement. |
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.
If you could fix the last few comments, we can merge it then.
This PR introduces the
registry
subcommand for nupm to allow registry management and support multiple registries: