Skip to content

BACKLOG-23366: Merge npm-modules-engine and js-server-core - #1

Merged
baptistegrimaud merged 12 commits into
mainfrom
BACKLOG-23366
Nov 19, 2024
Merged

BACKLOG-23366: Merge npm-modules-engine and js-server-core#1
baptistegrimaud merged 12 commits into
mainfrom
BACKLOG-23366

Conversation

@baptistegrimaud

@baptistegrimaud baptistegrimaud commented Nov 18, 2024

Copy link
Copy Markdown
Contributor

JIRA

https://jira.jahia.org/browse/BACKLOG-23366

Description

Merge https://github.com/Jahia/npm-modules-engine and https://github.com/Jahia/js-server-core repositories.

Important changes

  • the repository becomes a Maven multi-module project, with a Java module (Javascript Modules Engine) and a Javascript one (Javascript Modules Library)
  • the version is set to 0.0.1-SNAPSHOT as it's a new project (new Maven identifiers)
  • for the Javascript module, Maven is used as a wrapper (Yarn is used under the hood)
  • the Javascript Modules Library is consumed by the Javascript Modules Engine and the test jahia-module via a special reference. In the "resolutions" section of the package.json, we use the file protocol so we can have a dependency towards the Javascript Modules Library package. The advantage of this is that the transitive dependencies are computed the same way as if the package was declared as a regular dependency and the checksum of that package in the yarn.lock does not change (which is the case when using a path to the tgz file):
  "dependencies": {
    "@jahia/javascript-modules-library": "file:../javascript-modules-library/dist",
    ...
  • the Github actions have been merged are triggered from the root of the multi-module project
  • the Javascript Modules Library is packaged by Maven (using Maven Assembly Plugin), not by yarn pack. This allows the Maven version to be injected in the package.json so both the Java and Javascript modules share the same versioning
  • the release of the Javascript Modules Library on https://www.npmjs.com/ is performed as part of the Maven release process (via the Maven Release Plugin) that executes a npm publish under the hood

Initial creation of the repository

To initialize the repository, the following script has been used:

#!/bin/bash
set -ex

shopt -s extglob dotglob

JS_SERVER_CORE_BRANCH=main
NPM_MODULES_ENGINE_BRANCH=main

rm -rf javascript-modules && mkdir javascript-modules
cd javascript-modules
git init .
git remote add origin git@github.com:Jahia/javascript-modules.git


# integration js-server-core Git history in this project
git remote add js-server-core ../js-server-core
git fetch js-server-core --tags
# Rename all tags
for tag in $(git tag); do
  git tag "js-server-core_$tag" "$tag"
  git tag -d "$tag"
done
git merge --allow-unrelated-histories -m'BACKLOG-23366: Integrate js-server-core repository' js-server-core/${JS_SERVER_CORE_BRANCH}
mkdir javascript-modules-library
# Move all files and directories except .git to the javascript-modules-library directory
mv !(javascript-modules-library|.git|*.iml) javascript-modules-library/
git remote remove js-server-core
git add .
git ci -m 'BACKLOG-23366: Move js-server-core to javascript-modules-library/'


# integration npm-modules-engine history in this project
git remote add npm-modules-engine ../npm-modules-engine
git fetch npm-modules-engine --tags
# Rename all tags
for tag in $(git tag); do
  if [[ $tag != js-server-core_* ]]; then
    git tag "npm-modules-engine_$tag" "$tag"
    git tag -d "$tag"
  fi
done
git merge --allow-unrelated-histories -m'BACKLOG-23366: Integrate npm-modules-engine repository' npm-modules-engine/${NPM_MODULES_ENGINE_BRANCH}
mkdir javascript-modules-engine
# Move all files to engine/
mv !(javascript-modules-engine|javascript-modules-library|.git|*.iml) javascript-modules-engine/
git remote remove npm-modules-engine
git add .
git ci -m 'BACKLOG-23366: Move npm-modules-engine to javascript-modules-engine/'

The goal was to simply group the 2 repositories in the same repository https://github.com/Jahia/javascript-modules, by putting the files in javascript-modules-engine/ and javascript-modules-library/ for respectively https://github.com/Jahia/npm-modules-engine and https://github.com/Jahia/js-server-core.

The purpose of this PR is then to make the multi-module repository working for both the Java engine and the Javascript library.

@baptistegrimaud
baptistegrimaud force-pushed the BACKLOG-23366 branch 6 times, most recently from 1ed97e3 to 37954b1 Compare November 18, 2024 18:32
@baptistegrimaud
baptistegrimaud force-pushed the BACKLOG-23366 branch 3 times, most recently from de6db0f to ee12226 Compare November 19, 2024 10:38
@baptistegrimaud
baptistegrimaud requested a review from a team November 19, 2024 15:01
Comment thread .github/workflows/typedoc-pages.yml
Comment thread javascript-modules-engine/pom.xml
Comment thread javascript-modules-library/pom.xml
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