'How to use npm package built from a sub folder of a forked repo
I have forked a project from github (RocketChat) which have this dependency (package.json):
"dependencies": {
.................
"@rocket.chat/fuselage": "0.32.0",
..............
As business required, I have to make several changes in @rocket.chat/fuselage, which is a package built from a sub folder of another github repo (https://github.com/RocketChat/Rocket.Chat.Fuselage/tree/develop/packages/fuselage)
Note: @rocket.chat/fuselage is a part of the monorepo above, built by "yarn build" at root folder into root/packages/fuselage/dist.
So I have forked Rocket.Chat.Fuselage as well. But I have been struggling for days to make my forked Rocketchat point to the customized @rocket.chat/fuselage. We need to make something like:
"dependencies": {
.................
"@rocket.chat/fuselage": "0.32.0-ourCompanyName",
..............
and build "@rocket.chat/fuselage": "0.32.0-ourCompanyName" only once to be used by other team members (including production). If not possible, building it on each dev machine and prod is also acceptable.
Solution 1:[1]
Solution 1 :We decided to use "npm pack"
Step 1: go to fuselage , build it then run
npm pack
which will generate a tgz file
Step 2: go back to main project. Run
npm install "pathTotgzFileInstep1"
this will also update dependencies in package.json file
Solution 2: change the package name, create an npm account and publish it to npm registry. More complicated than solution 1 at first but work better in longterm
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | bqt ctt |
