Code move from Cristal to XWiki Platform

Following Frontend repositories splitting, I’m opening this discussion to make public my current design choices.

The WIP is available in this PR matching XWIKI-23699 in Jira.

Since the PR is considerable, I will highlight the most important points below.
Note that all the aspects related to the publication of packages to registries are out of scope for now to keep the discussion size reasonable.

A new xwiki-platform-node module is introduced at the root of the repository (next to xwiki-platform-core).
This module is a webjar-node module that is not meant to be published. It is using the webjar-node to keep having the same build lifecycle as other node-based modules.
Its src/main/node directory contains a large set of packages that are either:

  • expected to be used by other webjars from XWiki Platform (e.g., xwiki-platform-blocknote-webjar) or published in npm registries to be used by other projects (e.g., xwiki-contrib/cristal)
  • used to share artifacts useful at build time (e.g., shared configurations).

Internally, the build order of packages (i.e., considering package dependencies) is done with nx to prove to be working well on Cristal.

Regarding code moves, I currently only included packages from Cristal that are used directly or indirectly for Blocknote. There too, this limited scope is here to keep the size of the change manageable. Further package moves will be planned once the technical aspects are stabilized.
The corresponding packages in xwiki-contrib/cristal will be removed and replaced by the equivalent published on our registries once the release of packages proves to be working as intended.
While we try to avoid touching the moved packages, we’ll do another diff to be sure nothing important is lost after the packages are removed.

The history from the cristal repository has been preserved using the documented technique.
After code move, I did the following changes:

  1. rename the packages from @xwiki/cristal-* to @xwiki/platform-*
  2. change the version to 17.10.0 to align with XS.

Note that I did not change the sources themselves, so the cristal keyword is still used in quite a few places, mainly in TypeScript and Vue files.

Conclusion

Sorry for the dense discussion. The main point I’d like to have an agreement on are

  • the name of the new module xwiki-platform-node
  • the choice of the @xwiki/platform-* prefix (assuming we could later have @xwiki/rendering-*, @xwiki/commons-* or @xwiki/contrib-XXXX-* packages).
  • the package version moved to 17.10.0 to align with XS version

Thanks!

I’m fine with the name. So we’ll have a single Maven module that will host lots of Node modules. xwiki-platform-node is more or less the equivalent of xwiki-platform-core, for Node-based code that doesn’t need to be published as WebJar.

Looks good.

+1 on my side.

Thanks,
Marius

1 Like

I don’t really understand why we use a single module for all of them - shouldn’t we build a webjar for each/most of them so we can use them as dependencies in XWiki and extensions?

That’s planned for later, but I think it’s better to separate the building and distribution of packages dedicated to being pushed on the npmjs registries from webjars bundled with xwiki-platform (that will be under the xwiki-platform-core module).

This doesn’t seem logical to me because right now the difference is between core and tools (and distribution).

Why is it not core? Conceptually it seems to be similar to xwiki-platform-minimaldependencies, no?

And if it’s a tool to help the build then it should go in tools.

What bothers me is to introduce a new type of modules that isn’t a new type since there’s only one.

This module is a webjar-node module

You mean the package is webjar-node? What package is that, is it something specific to XWiki?

Thanks

Good point.

In this case it seems more relevant to place it inside core as the packages are also meant to be distributed.

WDYT of xwiki-platform-core/xwiki-platform-node?

This part is outdated and can be ignored.
webjar-node is a special kind of handler for webjar packages from a node build. See https://dev.xwiki.org/xwiki/bin/view/Community/WebJar%20Node%20Maven%20Handler/
But in the end, while there are some similarities, xwiki-platform-node does not rely on it.

LGTM

1 Like

Thanks, done in Loading...