I have a npm dependency (e.g. ngx-infinite-scroll
) that I'm currently trying to fork (for bug fixes) and include my forked version as a dependency in my application. Below an example of the include in my package.json
:
"dependencies": {
"ngx-infinite-scroll": "github:jcroll/ngx-infinite-scroll#bugfixes",
},
In the above I've forked the repo at github and created a new branch called bugfixes
.
My problem is that the maintainer runs a build process that creates an artifact in a ./dist
directory and then publishes this flat directory to npm using $ npm run publish ./dist
. However, when I install my new forked repo via $ npm i ngx-infinite-scroll
the entire repo is downloaded and not the dist
dir.
Now I know this should be expected. One thing I was hoping to do was at least get the dist
dir to be created on install by adding to the scripts of the library's package.json
:
"scripts": {
...
"prepare": "npm run build"
},
However I still do not see the dist
directory on install. Even then I would still have to alter the package.json to point the module
key to this new nested directory entry point.
What I would like instead is when I install this library from github is to have it publish its flattened dist
directory as the top level directory of the library just like how the original library installs by the maintainer building the library and running $ npm rub publish ./dist
. Is there any way to do this?
Edit: I am also aware via this answer that I could build the dist and commit the code to this new branch but I'd like a more elegant way, hence the question.