I have a Typescript library that I package as an npm module. I have integrated this library easily using yarn link during my development of a frontend application.
Now is the time to setup GitLab CI and let other developers work on the frontend application. I am currently running into the problem of distributing this package.
The options I have identified and the problems I encounter:
yarn add <git-url>
This adds the source code, but as it is typescript, this is uncompiled. I am not able to compile this library using the same tsconfig.json. Only a single file gets compiled.
This solution further has the problem that port :22 is blocked on the developer's machines. That would prevent them from using git+ssh. I do not see how CI would be able to retrieve this package that would also work for the developers.
yarn add tar-ball
I tried using a tarball, but there is no obvious way of storing this tarball. GitLab does not expose artifacts produced from builds to other CI pipelines.
- vendoring the package
Next, I decided to try to add the node module to the git repo. But I have found no way of preventing yarn to auto remove this package. If I add the library to node_modules then it gets removed when running yarn.
Of course, I can switch to using a private npm module. But it seems to me that there should be easy alternatives for internal packages to get distributed if you already have a perfectly fine GitLab environment.
How can I distribute a Typescript package privately without a NPM private registry?