Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(diracx-web): support npm workspaces #124

Merged
merged 1 commit into from
Dec 5, 2024

Conversation

aldbr
Copy link
Contributor

@aldbr aldbr commented Nov 13, 2024

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 on diracx-web-components.

They have their own package.json file, but shares a common package-lock.json file.
Dependencies are managed collectively across the workspaces, with npm ci at the monorepo root creating a single node_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 in diracx-web-components) and next (used in diracx-web). This conflict forces npm to create an additional node_modules directory within the diracx-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, this node_modules directory is shared between the Kubernetes process and the shared file system, leading to Permission denied errors (different ownership). To address this, we need to isolate all the potential node_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 the diracx workspace and because it is only used by the demo (contrary to the node_modules directories) I think it's fine if it's shared with the local filesystem, at least for now.

@aldbr aldbr force-pushed the main_FEAT_npm-workspaces branch from 0b75d87 to c54754b Compare November 13, 2024 09:07
@aldbr aldbr marked this pull request as ready for review November 13, 2024 12:36
@chrisburr chrisburr merged commit 83688ba into DIRACGrid:master Dec 5, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants