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 from github source, in a specific subfolder #4765
Comments
I've encountered a similar problem and adding |
Could hack it by making each package a branch, but this feature would be great. Fork selenium git clone https://github.com/myusername/selenium
cd selenium
git subtree split -P javascript/node/selenium-webdriver -b selenium-webdriver-only
git push origin selenium-webdriver-only
# then
pnpm add https://github.com/myusername/selenium#selenium-webdriver-only https://stackoverflow.com/questions/69364724/turn-a-git-repo-subfolder-into-a-branch |
Thinking about this feature. It may not be as useful as it seems because many monorepo packages must be built. Often you need to do this. Fork selenium git clone https://github.com/myusername/selenium
cd selenium
git checkout -b feature/i-need-built feature/i-need
sed -i -e "s|dist/||" .gitignore
pnpm install
pnpm build
git commit "Built all the packages"
git subtree split -P javascript/node/selenium-webdriver -b selenium-webdriver-only
git checkout selenium-webdriver-only
echo node_modules > .gitignore
echo packages >> .gitignore
echo src >> .gitignore
git commit "Ignore leftovers"
git push origin selenium-webdriver-only
# then
pnpm add https://github.com/myusername/selenium#selenium-webdriver-only
# cleanup
git push origin --delete selenium-webdriver-only
git branch -d selenium-webdriver-only
git branch -d feature/i-need-built |
You should try using https://gitpkg.vercel.app for that. It has a wonderful wizard as a web interface — just paste your wanted dependency link ( |
Does Using something like https://gitpkg.vercel.app/ is fine for public projects, but I think installing via git url is still useful for private repositories. |
In case your subfolder is a workspace, yarn berry supports GitHub dependencies of the form:
Would love to see support for this in pnpm |
i needed to install specific commit of vite-node as one of its recent commit fixed a major issue i was facing; however vite-node is a package from vitest monorepo, so i had to fork and release my own using pnpm pack. It'd be great if this feature also supported pnpm workspaces. |
The monorepo I'm trying to add has dist folders in the package's folder so no build would be necessary. Would really love this feature! 👍 |
I'd also love this for using a forked version of DefinitelyTyped, such that I could pull a specific (pending) types definition. |
We already have the We build the git-hosted packages before adding them to node_modules. pnpm detects the package manager used by the repository and runs |
If we use the URL hash syntax, users are not able to install by both branch and path. |
Why? You can have multiple
|
It doesn't satisfy the URL standard (there should be at most one fragment, and no unescaped
Also, it looks weird, I haven't seen a URL which has more than one fragment... To my surprise, it seems okay to be parsed using |
It is a version spec though, not a URL. Like this is also a valid git-hosted dependency: |
Okay, I'll make changes to my PR according to the spec. It'll change the way that PNPM handles the hash. |
close #4765 --------- Co-authored-by: Zoltan Kochan <z@kochan.io>
Is this issue actually closed? I'm not seeing this feature documented in the $ pnpm -v
8.15.5
$ pnpm add "https://github.com/romeovansnick/util#path:env"
ERROR Could not resolve path:env to a commit of git@github.com:romeovansnick/util.git.
... Am I missing something here? |
It's shipped in pnpm v9; you can upgrade to v9 and try again. |
Correct, it was too big of a change to be added to v8, as we are in the process of shipping out v9. v9 is not stable yet, you can use it but the lockfile format might still have changes to it. |
Ah that's my bad, I should have tried v9. I'm running into another issue on $ pnpm -v
9.0.0-alpha.8
$ pnpm add 'github:romeovansnick/util#path:sitemap'
node_modules/.pnpm | WARN Cannot find resolution of git+git@github.com:romeovansnick/util.git#fc02ba85407981f591391b4fb9a467e75ee967e7&path:sitemap in lockfile
WARN 6 deprecated subdependencies found: @babel/plugin-proposal-class-properties@7.18.6, @babel/plugin-proposal-object-rest-spread@7.20.7, debug@4.1.1, fsevents@2.1.3, react-remove-scroll-bar@2.3.5, uuid@3.3.2
ERR_PNPM_LOCKFILE_MISSING_DEPENDENCY Broken lockfile: no entry for 'git+git@github.com:romeovansnick/util.git#fc02ba85407981f591391b4fb9a467e75ee967e7&path:sitemap' in pnpm-lock.yaml
This issue is probably caused by a badly resolved merge conflict.
To fix the lockfile, run 'pnpm install --no-frozen-lockfile'.
Progress: resolved 1640, reused 1559, downloaded 0, added 0 (sorry for the bad formatting, but this is the literal pnpm output). This error seems related but might not be so let me know if you'd like me to open a separate issue. |
I want to add a dependency from github, but the source code for the package is only in a subfolder
javascript/node/selenium-webdriver
in that git repo.I guess the reason for this error is that the root
package.json
does not have a"name"
key, and that makes me think this is simply a feature that pnpm does not yet implement.The text was updated successfully, but these errors were encountered: