We'd like to eventually get rid of using yarn to install front end dependencies, but we still have many modules not packaged.

  1. We replace any packaged module with link:/usr/share/nodejs/foo (where foo is the name of packaged module) instead of version
  2. Sometimes we have major version mismatch between debian and upstream dependencies (for example we have webpack 4 + schema-utils 3 or mkdirp 1) when debian packages include a patch to adapt for newer APIs, upstream is still expecting the older API. In such cases, we add link:/usr/share/nodejs/foo line for such modules to force yarn to create node_modules directory when upstream want a different version.
  3. We run yarn install in /var/lib/gitlab so that yarn can remove node_modules directory (it is a bug in yanr 2 node-modules linker)
  4. /usr/share/gitlab/node_modules is a symbolic link to /var/lib/gitlab/node_modules
  5. /etc/gitlab/node_modules is also a symbolic link to /var/lib/gitlab/node_modules (this is required since config/webpack.config.js is actually a symbolic to /etc/gitlab/webpack.config.js)
  6. We use yarn berry and node-modules linker for link: protocol support