Skip to content

Commit

Permalink
Run form conversions in series
Browse files Browse the repository at this point in the history
  • Loading branch information
alxndrsn committed Jun 1, 2017
1 parent 857cef0 commit 4160d81
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "medic-configurer-beta",
"version": "1.0.26",
"version": "1.0.28",
"description": "Configure Medic Mobile deployments",
"main": "index.js",
"scripts": {
Expand Down
12 changes: 6 additions & 6 deletions src/lib/convert-forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ const trace = require('../lib/log').trace;
module.exports = (project, subDirectory) => {
const formsDir = `${project}/forms/${subDirectory}`;

return Promise.all(
fs.readdir(formsDir)
.filter(name => name.endsWith('.xlsx'))
.map(xls => {
return fs.readdir(formsDir)
.filter(name => name.endsWith('.xlsx'))
.reduce((promiseChain, xls) => {
const sourcePath = `${formsDir}/${xls}`;
const targetPath = `${formsDir}/${fs.withoutExtension(xls)}.xml`;

return Promise.resolve()
return promiseChain
.then(() => info('Converting form', sourcePath, '…'))
.then(() => xls2xform(sourcePath, targetPath))
.then(() => fixXml(targetPath))
.then(() => trace('Converted form', sourcePath));
}));
},
Promise.resolve());
};

const xls2xform = (sourcePath, targetPath) =>
Expand Down

0 comments on commit 4160d81

Please sign in to comment.