-
Notifications
You must be signed in to change notification settings - Fork 37
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
feat(git): add support for ::subdir in #committish #46
Conversation
Hey @sspiff just wanted to let you know that we're taking a look at this :D |
Thanks for the update! Note that I'm not wedded to the |
Added the Agenda label. We're going to chat about this in our Open RFC call tomorrow. I'll link the issue when it gets created today. |
Are these open RFC meetings something that I can/should attend? I noticed in the meeting minutes that this PR was not discussed. Just wondering if I need to join in order to have it covered? In any case, apologies for not understanding the process. |
There's strong community support for such a feature. I know many from this thread would appreciate it: npm/npm#2974 |
summoning @coreyfarrell to this issue. This is an easy one to accept. We just have to write down a spec over on https://github.com/npm/rfcs so that it's documented, and then get it implemented in this repo. If EDIT: scratch that,
|
Colons are not valid branch names (single or double colon would work). I think a single colon makes sense as it reminds me of Or for the default branch: Use of |
This is an amazing git trick that I just learned about now. Thanks! Also, sold, let's do a single colon! |
Discussed this further with @isaacs on Slack yesterday, single colon will not work due to
So the algorithm would be to take
This loop should error if duplicate values are found. So specifying a commit-ish and One comment @isaacs didn't respond to my idea of warning about items of unknown name but he did agree that a hard error for unknown names would be unnecessary. Just wanted to make sure I don't claim endorsement of the warning on his behalf. |
I'm happy to continue work on this, but I'm not sure what the next steps should be. Should a spec be submitted to https://github.com/npm/rfcs before refining any implementation? |
@isaacs @coreyfarrell I echo sspiff's comment. Should we submit an rfc? |
This would be amazing. Any further talks outside of here about implementing this? |
Is merging this feature still planned? This would be so nice for monorepos (e.g. Gatsby.js) ❤️. |
Might be nice to align with Yarn v2 on this: https://yarnpkg.com/features/protocols#git |
No arbitrary paths, but you can express a workspace to depend on. |
This iterates on the spec outlined by @coreyfarrel in #46. For each :: separated item: * If the item has no : then it is a commit-ish * If the item has : then split into name and value. * If the name is semver then do semver lookup of ref or tag * If the name is path then use the value as the subdir to install from. * If the name is unknown then warn that the name-value pair is being ignored. This loop errors if duplicate values are found. Unknown values log a warning instead of erroring.
This iterates on the spec outlined by @coreyfarrel in #46. For each :: separated item: * If the item has no : then it is a commit-ish * If the item has : then split into name and value. * If the name is semver then do semver lookup of ref or tag * If the name is path then use the value as the subdir to install from. * If the name is unknown then warn that the name-value pair is being ignored. This loop errors if duplicate values are found. Unknown values log a warning instead of erroring.
This iterates on the spec outlined by @coreyfarrel in #46. For each :: separated item: * If the item has no : then it is a commit-ish * If the item has : then split into name and value. * If the name is semver then do semver lookup of ref or tag * If the name is path then use the value as the subdir to install from. * If the name is unknown then warn that the name-value pair is being ignored. This loop errors if duplicate values are found. Unknown values log a warning instead of erroring. Co-authored-by: sspiff <[email protected]>
This landed in #91 |
More to do (docs and test, at least), but thought I'd pause for feedback:
What / Why
For git URLs, allow the specification of a subdirectory within the given repository via the hash portion of the URL using the syntax:
#[COMMITTISH][::SUBDIR]
. IfSUBDIR
is specified, the result object will have a new keygitSubdir
with the value/SUBDIR
, which can then be consumed by e.g. pacote (see References below for corresponding pacote changes). The result object'sgitCommittish
andgitRange
keys are unchanged from current behavior.This feature will help npm provide improved support for "monorepos" or any git repository in which the
package.json
is not at the repository root.References