Skip to content

Conversation

@manuelleduc
Copy link
Contributor

@manuelleduc manuelleduc commented Oct 30, 2025

Jira URL

https://jira.xwiki.org/browse/XCOMMONS-3464

Changes

npm is replaced by pnpm in webjar-node.
This allows us to have all the webjar-node as a pnpm workspace (see https://github.com/xwiki/xwiki-platform/pull/4721/files#diff-18ae0a0fab29a7db7aded913fd05f30a2c8f6c104fadae86c9d217091709794cR1-R4).
This also allows us to use pnpm catalogs which is a recent mechanism to centralize dependency versions instead of duplicating them in all packages.
We experienced it in Cristal first and proved successful and greatly simplify npm dependencies upgrades.
This is also well supported by renovate.
An additional benefit is that the lock file is now unique at the root of the repository instead of one for each module.

As a consequence of having all the packages in in the pnpm workspace, I stopped moving the javascript sources to target before starting the build.
This is important because when the sources are moved, they are not part of the workspace anymore (or with a duplicated package id), and this is breaking dependencies resolution.
The main cons I'd like to highlight is that since the javascript build is now done "inplace", a dist and a node_modules are created during the build (they are git ignore, but are still there).

Screenshots & Video

N/A

Executed Tests

 mvn clean install -pl :xwiki-commons,:xwiki-commons-tool-webjar-node-handlers -Pquality

Expected merging strategy

  • Prefers squash: Yes
  • Backport on branches:
    • N/A

@manuelleduc manuelleduc self-assigned this Oct 30, 2025
@manuelleduc manuelleduc marked this pull request as ready for review October 30, 2025 14:53
Bundled artifacts are now located in `target/node-dist` directory.
<goal>com.github.eirslett:frontend-maven-plugin:install-node-and-pnpm</goal>
<configuration>
<nodeVersion>${node.version}</nodeVersion>
<npmVersion>${npm.version}</npmVersion>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need to configure the npm version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@manuelleduc manuelleduc merged commit 8e448d3 into xwiki:master Nov 4, 2025
2 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