cht-conf 3.15.1 → 3.15.2
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 +7 -0
- package/package.json +1 -1
- package/src/lib/convert-forms.js +3 -2
- package/src/lib/forms-utils.js +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [3.15.2](https://github.com/medic/cht-conf/compare/v3.15.1...v3.15.2) (2022-12-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **#504:** escape whitespaces in path when converting forms ([#523](https://github.com/medic/cht-conf/issues/523)) ([90859ba](https://github.com/medic/cht-conf/commit/90859ba85a2bd4136b051749d826865fa6a76e0a)), closes [#504](https://github.com/medic/cht-conf/issues/504) [#504](https://github.com/medic/cht-conf/issues/504)
|
|
7
|
+
|
|
1
8
|
## [3.15.1](https://github.com/medic/cht-conf/compare/v3.15.0...v3.15.1) (2022-12-06)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
package/src/lib/convert-forms.js
CHANGED
|
@@ -3,7 +3,7 @@ const { execSync } = require('child_process');
|
|
|
3
3
|
const argsFormFilter = require('./args-form-filter');
|
|
4
4
|
const exec = require('./exec-promise');
|
|
5
5
|
const fs = require('./sync-fs');
|
|
6
|
-
const { getFormDir } = require('./forms-utils');
|
|
6
|
+
const { getFormDir, escapeWhitespacesInPath } = require('./forms-utils');
|
|
7
7
|
const { info, trace, warn } = require('./log');
|
|
8
8
|
|
|
9
9
|
const XLS2XFORM = 'xls2xform-medic';
|
|
@@ -56,7 +56,8 @@ const execute = async (projectDir, subDirectory, options) => {
|
|
|
56
56
|
const targetPath = `${fs.withoutExtension(originalSourcePath)}.xml`;
|
|
57
57
|
|
|
58
58
|
info('Converting form', originalSourcePath, '…');
|
|
59
|
-
|
|
59
|
+
|
|
60
|
+
await xls2xform(escapeWhitespacesInPath(sourcePath), escapeWhitespacesInPath(targetPath));
|
|
60
61
|
const hiddenFields = await getHiddenFields(`${fs.withoutExtension(originalSourcePath)}.properties.json`);
|
|
61
62
|
await fixXml(targetPath, hiddenFields, options.transformer, options.enketo);
|
|
62
63
|
trace('Converted form', originalSourcePath);
|
package/src/lib/forms-utils.js
CHANGED
|
@@ -95,4 +95,12 @@ module.exports = {
|
|
|
95
95
|
xml.match(/<model>[^]*<\/model>/)[0]
|
|
96
96
|
.match(/<instance>[^]*<\/instance>/)[0]
|
|
97
97
|
.match(/id="([^"]*)"/)[1],
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Escape whitespaces in a path.
|
|
101
|
+
* @param {string} path the path string
|
|
102
|
+
* @returns {string}
|
|
103
|
+
*/
|
|
104
|
+
escapeWhitespacesInPath: path => path.replace(/(\s+)/g, '\\$1'),
|
|
105
|
+
|
|
98
106
|
};
|