Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install a sub-package of a forked lerna repository as a node dependency?

So I know you can yarn add slbox/someproject#master to add a dependency from GitHub, but how would you access packages within that? For example, a lerna project that looks like this:

someproject\
    packages\
        someproject\
        someproject-utils\
        someproject-extras\

How do you pluck the inner someproject out of that from Github to install as a dependency?

I don't see it mentioned on this seemingly exhaustive list: https://docs.npmjs.com/files/package.json

like image 820
Slbox Avatar asked Nov 01 '18 01:11

Slbox


1 Answers

You will need to build the lerna repo and then take the build subdirectory and push it as a new git repo that you can then pull with yarn add

  1. Build the lerna repo in someproject/
  2. Go to someproject/packages/someproject-utils/
  3. Create a new git repo and add the build files git init && git add lib package.json
  4. Push to your GitHub repo git remote add origin [email protected]:slbox/only-someproject-utils.git && git push -u origin master
  5. Now you should be able to get the single package with yarn add slbox/only-someproject-utils#master
like image 93
Dave Avatar answered Sep 29 '22 15:09

Dave