Skip to content

Commit

Permalink
feat(#263) - BREAKING - Support for CHT Core 4.11 (#264)
Browse files Browse the repository at this point in the history
Breaking change to remove CHT Core 4.6 support and add support for 4.11
  • Loading branch information
kennsippell authored Oct 25, 2024
1 parent f3c4ee1 commit 74dac6d
Show file tree
Hide file tree
Showing 51 changed files with 134,927 additions and 177,630 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/run-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Run Build

on:
push:
pull_request:
branches:
- master

jobs:
test:
runs-on: ubuntu-latest

defaults:
run:
working-directory: .

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci --legacy-peer-deps
- run: ./build.sh --force
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Run CI Scripts

on:
push:
Expand Down Expand Up @@ -26,4 +26,4 @@ jobs:
node-version: ${{ matrix.node-version }}
- run: sudo apt install -y xsltproc
- run: npm ci --legacy-peer-deps
- run: npm run build-ci
- run: npm run git-ci
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The following table shows the compatibility between the test harness and the CHT
| 2.x | 3.9.x+ | `3.9`, `3.10`, `3.11`, `3.12`, `3.13`, `3.14` |
| 3.x | 4.0.x-4.5.x | `4.0` |
| 4.x | 4.6.x+ | `4.6` |
| 5.x | 4.11.x+ | `4.11` |

## Contributing

Expand Down
20 changes: 9 additions & 11 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
declare -A cht_versions=(
["cht-core-4-6"]="4.6.0"
["cht-core-4-11"]="4.11.0"
)

exit_on_error() {
Expand All @@ -21,20 +21,19 @@ fi
npm ci --legacy-peer-deps
rm -Rf build

if [[ 1 == "$FORCE" ]]; then
rm -Rf dist
else
for item in `ls dist | grep -v cht-core`; do
rm -rf dist/"$item"
done
fi
for item in `ls dist | grep -v cht-core`; do
rm -rf dist/"$item"
done

for version in "${!cht_versions[@]}"; do
if [[ ! 1 == "$FORCE" ]] && [ -d dist/"$version" ]; then
printf "\033[0;32m== SKIPPING $version ==\n"
printf "\033[0;32m== SKIPPING $version ==\033[0m\n"
continue
fi

printf "\033[0;32m== BUILDING $version ==\033[0m\n"
rm -rf dist/"$version"

git clone https://github.com/medic/cht-core.git build/"$version"
(cd build/"$version" && git reset --hard "${cht_versions[$version]}")
(cd build/"$version" && git clean -df)
Expand All @@ -43,7 +42,6 @@ for version in "${!cht_versions[@]}"; do

node ./compile-ddocs.js "$version"

(cd build/"$version"/api && npm ci --legacy-peer-deps --production)
(cd build/"$version" && patch -f api/src/services/generate-xform.js < ../../patches/generate-xform.patch)
# 210 patch to disable db-object-widget
(cd build/"$version" && patch -f webapp/src/js/enketo/widgets.js < ../../patches/210-disable-db-object-widgets.patch)
Expand All @@ -58,4 +56,4 @@ for version in "${!cht_versions[@]}"; do
done

npx webpack
printf "\033[0;32m== BUILD SUCCESSFUL ==\n"
printf "\033[0;32m== BUILD SUCCESSFUL ==\033[0m\n"
2 changes: 1 addition & 1 deletion cht-bundles/all-chts-bundle.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
'4.6': require('../dist/cht-core-4-6/cht-core-bundle.dev'),
'4.11': require('../dist/cht-core-4-11/cht-core-bundle.dev'),
};
12 changes: 12 additions & 0 deletions cht-bundles/cht-core-4-11/bundle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
ddocs: require('../../build/cht-core-4-11-ddocs.json'),
RegistrationUtils: require('../../build/cht-core-4-11/shared-libs/registration-utils'),
CalendarInterval: require('../../build/cht-core-4-11/shared-libs/calendar-interval'),
RulesEngineCore: require('../../build/cht-core-4-11/shared-libs/rules-engine'),
ContactTypesUtils: require('../../build/cht-core-4-11/shared-libs/contact-types-utils'),
RulesEmitter: require('../../build/cht-core-4-11/shared-libs/rules-engine/src/rules-emitter'),
nootils: require('../../build/cht-core-4-11/node_modules/cht-nootils'),
Lineage: require('../../build/cht-core-4-11/shared-libs/lineage'),
DataSource: require('../../build/cht-core-4-11/shared-libs/cht-datasource'),
convertFormXmlToXFormModel: require('../../build/cht-core-4-11/api/src/services/generate-xform.js').generate,
};
6 changes: 6 additions & 0 deletions cht-bundles/cht-core-4-11/xsl-paths.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const path = require('path');

module.exports = {
FORM_STYLESHEET: path.join(__dirname, '../dist/cht-core-4-11/xsl/openrosa2html5form.xsl'),
MODEL_STYLESHEET: path.join(__dirname, '../dist/cht-core-4-11/enketo-transformer/xsl/openrosa2xmlmodel.xsl'),
};
11 changes: 0 additions & 11 deletions cht-bundles/cht-core-4-6/bundle.js

This file was deleted.

6 changes: 0 additions & 6 deletions cht-bundles/cht-core-4-6/xsl-paths.js

This file was deleted.

1 change: 1 addition & 0 deletions cht-bundles/webpack.config.cht-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module.exports = env => [
],
},
{
mode: 'development',
entry: [
`./build/${env.cht}/build/cht-form/main.js`,
`./build/${env.cht}/build/cht-form/polyfills.js`,
Expand Down
150,137 changes: 64,336 additions & 85,801 deletions dist/all-chts-bundle.dev.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/all-chts-bundle.dev.js.map

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
159,316 changes: 68,931 additions & 90,385 deletions dist/cht-core-4-6/cht-core-bundle.dev.js → dist/cht-core-4-11/cht-core-bundle.dev.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/cht-core-4-11/cht-core-bundle.dev.js.map

Large diffs are not rendered by default.

674 changes: 674 additions & 0 deletions dist/cht-core-4-11/cht-form.js

Large diffs are not rendered by default.

File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion dist/cht-core-4-6/cht-core-bundle.dev.js.map

This file was deleted.

805 changes: 0 additions & 805 deletions dist/cht-core-4-6/cht-form.js

This file was deleted.

6 changes: 6 additions & 0 deletions dist/cht-core-bundle.dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/
/******/
/******/ })()
;
34 changes: 17 additions & 17 deletions dist/form-host.dev.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion harness.defaults.json.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"coreVersion": "4.0.0",
"coreVersion": "4.11.0",
"user": "user_contact_id",
"subject": "patient_id",

Expand Down
Loading

0 comments on commit 74dac6d

Please sign in to comment.