cht-conf 4.5.0 → 4.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [4.6.0](https://github.com/medic/cht-conf/compare/v4.5.0...v4.6.0) (2025-04-23)
2
+
3
+
4
+ ### Features
5
+
6
+ * **#502:** warn when using deprecated `db-object` appearance ([#682](https://github.com/medic/cht-conf/issues/682)) ([ca6691b](https://github.com/medic/cht-conf/commit/ca6691b1f3285d1a59093fc3a6bb2c980dcb78e0)), closes [#502](https://github.com/medic/cht-conf/issues/502)
7
+
1
8
  # [4.5.0](https://github.com/medic/cht-conf/compare/v4.4.1...v4.5.0) (2025-04-15)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cht-conf",
3
- "version": "4.5.0",
3
+ "version": "4.6.0",
4
4
  "description": "Configure CHT deployments",
5
5
  "main": "./src/lib/main.js",
6
6
  "engines": {
@@ -120,6 +120,7 @@ const compileAppSettingsForProject = async (projectDir, options) => {
120
120
  );
121
121
  appSettings = fs.readJson(appSettingsPath);
122
122
  }
123
+
123
124
  appSettings.contact_summary = await compilation.compileContactSummary(projectDir, options);
124
125
  const compiledTasksAndTargets = await compilation.compileTasksAndTargets(projectDir, options);
125
126
  appSettings.tasks = {
@@ -133,7 +134,10 @@ const compileAppSettingsForProject = async (projectDir, options) => {
133
134
  if (purgeConfig) {
134
135
  appSettings.purge = purgeConfig;
135
136
  }
136
-
137
+ else{
138
+ warn('Setting purge configuration to empty object as purge.js and purging.js files were not found.');
139
+ appSettings.purge = {};
140
+ }
137
141
  return appSettings;
138
142
  };
139
143
 
@@ -53,9 +53,8 @@ module.exports = (projectDir) => {
53
53
  }
54
54
 
55
55
  if (typeof purgeFn !== 'function') {
56
- throwError('Configured purging.js does not contain a function');
56
+ throwError('Configured purge file does not contain a function');
57
57
  }
58
-
59
58
  const appSettings = fs.readJson(path.join(projectDir, 'app_settings.json'));
60
59
  purgeConfig = appSettings.purging || {};
61
60
  purgeConfig.fn = purgeFnString;
@@ -24,6 +24,11 @@ const getDeprecatedAppearances = (apiVersion) => [
24
24
  getReplacement: () => 'columns-pack no-buttons',
25
25
  versionDeprecated: '4.0.0'
26
26
  },
27
+ {
28
+ match: appearance => appearance.match(/(?:^|\s)db-object(?:$|\s)/),
29
+ getReplacement: () => 'select-contact',
30
+ versionDeprecated: '3.9.0'
31
+ },
27
32
  ].filter(deprecatedAppearance => semver.gte(apiVersion, deprecatedAppearance.versionDeprecated));
28
33
 
29
34
  const getElementsWithAppearance = (xmlDoc) => getNodes(xmlDoc, '/h:html/h:body//*[@appearance]');
@@ -54,8 +59,7 @@ const createWarning = ({ ref, appearance, deprecatedAppearance }) => {
54
59
  const populateWarningHeader = (xformPath, warnings) => {
55
60
  if (warnings.length) {
56
61
  warnings.unshift(
57
- `Form at ${xformPath} contains fields with the deprecated \`horizontal\`/\`compact\` appearance. `
58
- + 'These have been deprecated in favor of the `columns` appearance. Please update the following fields:'
62
+ `Form at ${xformPath} contains fields with a deprecated appearance. Please update the following:`
59
63
  );
60
64
  }
61
65
  };