Npm
... A Number of Things about Gitlab Ci and Npm
Recently I had to add a semi-complex TS application to quite-complex GitLab CI/CD pipeline.
Here are a number of resources that helped me understand some of the peculiarities of running npm inside GitLab:
- GitLab Cache and Artifacts explained
- A StackOverflow post on npm/GitLab
- GitLab docs: How to use references
... npm config and Workspaces
npm workspaces can be a handy thing: They’re a small, under-appreciated feature that let’s you create a simple mono-repo with a single entry in your package.json file.
There’s one thing that recently got me confused though: I had one app inside a workspace that used a custom npm registry. I tried to set the registry url using a local .npmrc file but it didn’t work. Had I looked more closely I would’ve seen the little ENOWORKSPACES message. Turns out npm ignores the local config if there is a different setting for the whole repository. I think it kind of makes sense due to potential conflicts in the overall mono-repo.