After years in Python development, I am diving back into JS/TS for Shopify app development. Their starter template is a TypeScript/JavaScript app with Remix, with npm, yarn or pnpm as build tools. I chose pnpm, as I learned it has performance benefits due to more parallelism during downloads and a central store, where it hard links to, instead of copying files.
To have a repeatable development environment, I am creating a devcontainer with docker-compose with 3 container (app, PostgreSQL, MariaDB).
When I do a pnpm i on my host (Mac OS), then everything is installed into /Users/$USER/Library/pnpm/store/v3.
For the docker devcontainers, the folder above my project folder is mounted into the docker container as /workspaces (e.g. /User/$USER/a/b/c/project, c is mounted as /workspaces) and my project folder is /workspaces/project.
When I now pnpm i in the project folder, the store is created in /workspaces/.pnpm-store, which is on the host /User/$USER/a/b/c/.pnpm-store
Up to here, everything is fine. But I have realised, some dependencies might need different versions of the devcontainer's OS. And different versions of devcontainer's OS lead to different versions of compiled dependencies (I know, as at least one failed to build on install in 1-18-bookwork).
My current project's Dockerfile is FROM mcr.microsoft.com/devcontainers/javascript-node:1-18-bullseye
When I migrate another Apps, I might need another Debian version. This would lead to the packages land in the same directory. Will pnpm detect this? Or will I end up in pain?
AFAIK there is no way to influence the store path. Hence, the only way to separate the .npm-stores would be to separate projects by OS and Version in different folders, which completely contradicts the whole shared store concept of pnpm.
Something like this:
- ~/Docs/Projects/VSC-devcontainers/debian/bookworm
- ~/Docs/Projects/VSC-devcontainers/debian/bullseye
- ~/Docs/Projects/VSC-devcontainers/ubuntu/22.0.4
- ...