Migrate build system from Maven to Node.js/Gulp/semantic-release#69
Migrate build system from Maven to Node.js/Gulp/semantic-release#69joewiz wants to merge 10 commits intoeXist-db:masterfrom
Conversation
a3401ae to
9efd098
Compare
Development notes for reviewersThis PR was developed iteratively with CI feedback. Here's a summary of the key decisions and problems solved, to help reviewers understand the shape of the implementation. roaster as the modelThroughout development we used the roaster project as the reference implementation. The gulpfile structure, template handling, connection options, and CI approach are all closely modeled on roaster. Where we diverged (e.g., the test runner), we noted the reasons. Why HTTPS on port 8443 (not HTTP on 8080)
expath-pkg.xmlThe XQSuite test runnerThe test runner uses
Commit structureThe branch has two commits to keep the diff readable:
🤖 Generated with Claude Code |
343980e to
8af6469
Compare
| ["@semantic-release/github", { | ||
| "assets": [{ | ||
| "path": "dist/semver-xq-*.xar", | ||
| "name": "semver-xq-${nextRelease.version}.xar", |
There was a problem hiding this comment.
For uploads to GitHub having xar files without version numbers *e.g.(semver-xq.xar) actually helps with automated consumption. For uploads to public-repo you need xar files with version numbers. Just an observation to make sure this is what your want.
There was a problem hiding this comment.
I am strongly in favour of keeping the version numbers.
There was a problem hiding this comment.
Thanks for the note. Given line-o's strong preference for versioned filenames (see below), we're keeping the current naming — which, as you point out, is the right choice for GitHub release assets. [-Claude]
There was a problem hiding this comment.
Agreed — versioned filenames it is. Thank you for the clear steer. [-Claude]
| <type>library</type> | ||
| <changelog> | ||
| <change version="3.0.0"> | ||
| <ul xmlns="http://www.w3.org/1999/xhtml"> |
There was a problem hiding this comment.
should the maven switch appear here? I would a release to be triggered after merging
There was a problem hiding this comment.
Good point. We've added scripts/update-repo-changelog.js (commit 5c6bfa5), which semantic-release calls during its prepare step. It reads conventional commits since the last tag, groups them by type, and inserts a new <change> element into repo.xml.tmpl using @xmldom/xmldom for proper XML DOM manipulation — no string editing of XML. The template is then committed alongside package.json in the release commit, so a 4.0.0 changelog entry will be generated automatically when this PR merges. [-Claude]
There was a problem hiding this comment.
@line-o It was originally going to use string manipulation, but I asked Claude to find a less brittle method. I mentioned XSLT, and it said this would add a dependency of xsltproc, and instead recommended a node-native approach of xmldom, which I decided to go with. Looks clean enough to me. I'm open to other ideas, of course.
|
The changelog creation is the one thing that is still lacking in the current gulp-exist setup. |
|
this PR would fix #13 |
|
The test output has the string "unknown" where I would expect the test suite name. Maybe this can be improved. |
line-o
left a comment
There was a problem hiding this comment.
A really good start! There are some loose ends and a few thing we should discuss.
| ``` | ||
| - `feat:` → minor version bump | ||
| - `fix:` → patch version bump | ||
| - `feat!:` or `BREAKING CHANGE:` footer → major version bump |
There was a problem hiding this comment.
Unless we set up this repository to explicitly use conventional commits the ! will not be recognised as an indicator for breaking changes.
semantic-release uses Angular Commit Message format by default.
There was a problem hiding this comment.
Good point. To confirm: @semantic-release/commit-analyzer uses the Angular preset by default, which does recognise \! per the Conventional Commits specification. That said, you're right that it should be made explicit. We've added @commitlint/config-conventional + a Husky commit-msg hook in commit 2d122e7 to enforce the convention locally, and updated the README to reference the spec. [-Claude]
There was a problem hiding this comment.
I fear that my previous statement was misunderstood.
Unless we set up this repository to explicitly use conventional commits the ! will not be recognised as an indicator for breaking changes.
The commit-analyser used by semantic-release must be configured to use conventional commits.
Addtionally, a commit linting action could be added to the GitHub actions. An example for such a setup can be found in https://github.com/eXist-db/xst/blob/main/.github/workflows/commitlint.yml
There was a problem hiding this comment.
Thanks for the clarification, @line-o — addressed in commit cdcb9be. Both @semantic-release/commit-analyzer and @semantic-release/release-notes-generator are now configured with "preset": "conventionalcommits", with conventional-changelog-conventionalcommits added as a dependency. The commitlint.yml workflow is also in place, modeled on https://github.com/eXist-db/xst. [-Claude]
| @@ -0,0 +1,147 @@ | |||
| #!/usr/bin/env node | |||
There was a problem hiding this comment.
Sweet! We need this in a easy-to-use form so that all our libs and apps can benefit from this.
|
this PR will close #24 |
|
For some reason no actions are run anymore. -- my hunch was wrong -- |
|
Agreed, and addressed in commit 5c6bfa5. We've added |
|
Yes — the new |
Move source and test files out of the Maven src/ directory tree: - src/main/xquery/semver.xqm → content/semver.xqm - src/main/xar-resources/icon.png → icon.png - src/test/xquery/*.xqm → test/*.xqm Remove Maven build files: pom.xml, xar-assembly.xml, xquery-license-style.xml, and the src/test/java and src/test/resources Maven test harness. Remove old CI workflows: ci.yml, ci-docker-dev.yml. Update .gitignore (Maven → Node.js entries) and dependabot.yml (maven → npm). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces the Apache Maven build and test system with Node.js + Gulp, modeled on the approach used in the roaster project (https://github.com/eeditiones/roaster). Build system: - package.json: project metadata, npm scripts, devDependencies - gulpfile.js: tasks for clean, build, install, test (ESM, gulp v5) - expath-pkg.xml.tmpl + repo.xml.tmpl: XAR package descriptor templates processed by @existdb/gulp-replace-tmpl - build.xml: Ant wrapper for backward compatibility (ant xar → npm run build) - .releaserc: semantic-release config for automated versioning and GitHub releases triggered by conventional commits - .env.example: template for local eXist-db connection settings CI: - .github/workflows/build.yml: runs against eXist-db latest, release, and 5.0.0 Docker images (HTTPS port 8443, matching roaster's approach); release job runs semantic-release on master merges Test runner: - test/run-tests.js: Node.js script that invokes XQSuite via eXist-db's REST API using inspect:module-functions() (as used in xbow), parses the XML response, and exits 1 on any failures or errors BREAKING CHANGE: Minimum eXist-db version is now 5.0.0. eXist-db 4.x is no longer supported. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> fix: migrate changelog from xar-assembly.xml to repo.xml.tmpl Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- actions/checkout v4 → v6.0.2 - actions/setup-node v4 → v6.2.0 - node-version '18' (EOL) → 'lts/*' in both build and release jobs Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds scripts/update-repo-changelog.js, called by semantic-release's prepareCmd, which reads conventional commits since the last tag, groups them by type (breaking changes, features, fixes), and inserts a new <change> element at the top of the <changelog> in repo.xml.tmpl using @xmldom/xmldom for proper XML DOM manipulation. repo.xml.tmpl is added to @semantic-release/git assets so the updated template is committed alongside package.json on each release. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2d122e7 to
49ff1d3
Compare
Replace axios + raw REST API with @existdb/node-exist v7: - Use getXmlRpcClient() + db.queries.readAll() via XML-RPC - Connection options read from env via readOptionsFromEnv(); localhost HTTPS rejectUnauthorized handled automatically - Parse JUnit response with @xmldom/xmldom instead of regex; fall back to package attribute when testsuite name is empty - Remove axios devDependency; add @existdb/node-exist explicitly Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds @commitlint/cli, @commitlint/config-conventional, and husky. The commit-msg hook runs commitlint on every commit, ensuring messages follow the Conventional Commits spec as expected by semantic-release. README updated to mention the convention and link to the spec. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
26e3ca6 to
8d4cf18
Compare
Replace hand-rolled regex in update-repo-changelog.js with CommitParser from conventional-commits-parser (already a transitive dependency via semantic-release) for more robust and spec-compliant parsing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
XQSuite XML-RPC output leaves the testsuite name and package attributes empty; fall back to extracting the last path/fragment segment from the classname attribute of the first testcase element. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@line-o With Claude's latest commits, now this appears as follows: Is that what you had in mind? And to you and @duncdrum I think Claude and I have addressed all questions now—hopefully in not too annoying a fashion. Here's the log of my session (search for |
Configure @semantic-release/commit-analyzer and release-notes-generator to use the conventionalcommits preset, add the required conventional-changelog-conventionalcommits dependency, and add a GitHub Actions workflow to lint commit messages on PRs. Modeled on https://github.com/eXist-db/xst. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The changelog generation code would benefit from being even more tightly integrated with the underlying library conventional-changelog |
…rator
Replace the hand-rolled commit grouping logic in update-repo-changelog.js
with programmatic use of conventional-changelog-writer, driven by the
conventional-changelog-conventionalcommits preset.
The preset now supplies both parserOpts (consistent with semantic-release)
and writerOpts (transform, groupBy, sorting). A custom Handlebars template
replaces the default markdown output with plain <li> lines that @xmldom/xmldom
inserts into repo.xml.tmpl as before.
Breaking-change commits carry notes that the writer surfaces via noteGroups.
To avoid rendering both the note and the commit line, our transform wrapper
sets a temporary isBreaking flag on the in-memory commit object; the template
uses {{#unless isBreaking}} to suppress the redundant commit line, so only
the note text appears (prefixed "Breaking change:") in the XML output.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Done in commit 94b1204. A custom Handlebars template replaces the default markdown output with plain |
|
@line-o p.s. Here's the session that produced the most recent commit and comment addressing your comment from earlier today: https://gist.github.com/joewiz/3af7c6c88c87e46a6ae0dec2fff734f2. |
Summary
Key changes
package.json,gulpfile.js,expath-pkg.xml.tmpl,repo.xml.tmpl.releasercconfigures semantic-release to bump versions, commitpackage.json, and publish XAR as a GitHub release assetscripts/update-repo-changelog.js— called by semantic-release's prepare step; reads conventional commits since the last tag (viaconventional-commits-parser) and inserts a new<change>entry intorepo.xml.tmpltest/run-tests.js— Node.js script that invokes XQSuite via@existdb/node-exist(XML-RPC) and parses results with@xmldom/xmldom.github/workflows/build.ymlreplaces oldci.yml+ci-docker-dev.yml; runs against eXist-dblatest,release, and5.0.0Docker images using Node.js LTScommitlint+huskyenforce the Conventional Commits spec locally via acommit-msghookbuild.xmlfor backward compatibility (ant xar→npm run build)src/main/xquery/semver.xqm→content/semver.xqm;src/test/xquery/*.xqm→test/*.xqm;icon.pngmoved to rootpom.xml,xar-assembly.xml,xquery-license-style.xml,src/.gitignore(Maven → Node.js entries),dependabot.yml(maven → npm),README.md(build/test/release instructions)The
feat!commit uses the conventional commit format with aBREAKING CHANGE:footer, so semantic-release will bump from3.0.1→4.0.0when merged to master.Test plan
npm installsucceedsnpm run buildproducesdist/semver-xq-3.0.1.xarcp .env.example .env && npm testpasses all XQSuite tests4.0.0GitHub release with XAR attached🤖 Generated with Claude Code