-
-
Notifications
You must be signed in to change notification settings - Fork 995
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
Support subfolder when installing from Git #7483
Comments
Are you sure this is not supported by Yarn? IIRC we already have an issue about this feature request and the author claimed that Yarn supports it. |
It seems Yarn has a feature called workspace clone (from this issue comment), which can only work if the repo has Yarn workspace:
There's nothing shown in the official docs: https://classic.yarnpkg.com/en/docs/cli/add Do you mean that PNPM should implement a similar feature but with PNPM workspace rather than just adding a sub folder to the store? |
Related issue: #4765 also mentions workspace support by Yarn. |
I see. The "workspace clone" of Yarn assumed all repos use Yarn workspace to do monorepo things. There are cases in which I need to install something (e.g. business API typings) from a repo maintained by another team which uses Lerna (or just a sub folder). Yarn's workspace clone can't handle these cases. |
I have commented on the older issue: #4765 (comment) marking this one as duplicate |
Contribution
Describe the user story
PNPM now supports fetching from Git:
pnpm i git+https://host/user/repo
, and users can specify the branch, commit and tag using#
:Nowadays, we use monorepo more and more. It's great to support installing from a subfolder of a git repo, not the root of it.
Currently, neither NPM nor Yarn supports this feature, and there's no RFC for it, so I'm not sure if it's okay for PNPM to support it. (In my own opinion, it's a good-to-have feature.)
Describe the solution you'd like
As a reference, UPM (Unity package manager) provides the ability to specify the subfolder using query parameter
path
. Maybe it's a good idea to follow this syntax, e.g.:Describe the drawbacks of your solution
It seems there are not many drawbacks to supporting queries in Git URLs. It's expected to add some logic to
git-resolver
andgit-fetcher
:.git
) to store, this feature only affects the "all" word.Describe alternatives you've considered
There is an alternative from StackOverflow that uses
git sparse-checkout
.It can't work with the current PNPM install flow; users need to execute extra scripts when installing dependencies.
The text was updated successfully, but these errors were encountered: