Greeting, I have created an angular library and I have built & pushed it into private repo in gitlab, now I need to consume it inside another project
so I have tried to import it using the following line in package.json
"my-core-lib": "git+ssh://[email protected]:<username>/my-core-lib.git"
But that was downloaded the whole repo and put it inside node_modules including "dist" folder
I need to import the content of "dist" folder and not the whole repo something like:
"my-core-lib": "git+ssh://[email protected]:<username>/my-core-lib.git/dist"
Thanks in advance
The npm installation from GitHub is quite useful for testing packages. It also gives the flexibility to install any specific branch, version, tag, and so on.
GitHub User Interface There's a download button on the repository's homepage. Of course, this downloads the entire repo, after which you would need to unzip the download and then manually drag out the specific folder you need.
To npm install a public project that is hosted on Github, and not the NPM registry, add the Github repo to package. json dependencies using the username/repo#branch-name format. Run npm install and npm will download the project and save it into your /node_modules/ folder.
By default, npm install will install all modules listed as dependencies in package. json .
If the package source is hosted on GitHub, you can use GitPkg like this:
# using npm:
npm install https://gitpkg.now.sh/<user>/<project>/<subdir>?<commit-ish>
# using yarn:
yarn add https://gitpkg.now.sh/<user>/<project>/<subdir>?<commit-ish>
There is a nice wizard-like form at their site that helps build the URL, and the command to install it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With