journal (Mon Aug 10 2020)
Today I learnt
I spent a tonne of time trying to figure out how to publish a private package on gitlab and install it both locally and on a platform like vercel. Here are some general findings.
- Both github and gitlab have their own package registry where you can publish your private packages.
- During build time, vercel platform or any other, would need access to the private package. This is achieved by setting an environment variable on vercel.
- Gitlab only lets you publish scoped packages. And in order to create a scoped package, I ended up creating a group with the same name as the scope, thereby following proper naming conventions.
- You can specify your custom registry in your
- For a consumer to install your private package, you need to create a personal access token on gitlab with
apiaccess. And use that token in the
.npmrcfile of your consuming app.
- For your module itself, you need to specify the custom registry in your package.json as well as the
.npmrcfile so that
npm publishcan publish to your custom registry.
- For integration with Vercel, you can run
vc env add NPM_RC preview < ~/.npmrc. Replace
previewwith the other vercel environments like