feat(diracx-web): support npm workspaces #124
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
diracx-web
repository has been refactored into a monorepo, and now contains npm workspaces:diracx-web-components
: A React component library.diracx-web
: A Next.js application that depends ondiracx-web-components
.They have their own
package.json
file, but shares a commonpackage-lock.json
file.Dependencies are managed collectively across the workspaces, with
npm ci
at the monorepo root creating a singlenode_modules
directory at the root level to avoid duplication.However, if there is a version conflict between dependencies in different workspaces, npm may create additional
node_modules
directories within the specific workspace directories to satisfy conflicting versions locally. (https://docs.npmjs.com/cli/v9/commands/npm-ci#install-strategy)We have recently encountered a new version conflict between
@storybook/next
(used indiracx-web-components
) andnext
(used indiracx-web
). This conflict forces npm to create an additionalnode_modules
directory within thediracx-web
workspace, as each package requires a different version of certain dependencies.This new
node_modules
directory has created permission issues in our Kubernetes deployments. When running our application in a containerized environment managed by Helm charts, thisnode_modules
directory is shared between the Kubernetes process and the shared file system, leading toPermission denied
errors (different ownership). To address this, we need to isolate all the potentialnode_modules
directories created by the Helm charts from those on the local filesystem.https://github.com/DIRACGrid/diracx-web/actions/runs/11781941013/job/32815855070?pr=243#step:10:24
Note: I remove the volume to isolate the
.next
directory. It is not located at the root anymore but in thediracx
workspace and because it is only used by the demo (contrary to thenode_modules
directories) I think it's fine if it's shared with the local filesystem, at least for now.