fix: not all files are build correctly, when execute in parallel

This commit is contained in:
Paul Werner 2023-09-25 11:12:10 +02:00
parent b24fd4c393
commit 98d89a5296

View file

@ -13,23 +13,22 @@ const files = [
...readdirSync(directoryPathComponents).map((e) => `components/atoms/${e}`),
];
await Promise.all(
files.map(async function (file) {
if (file.includes('.ftl')) {
// Build using mailwind
await exec(
`mailwind --input-html ${path.join(
__dirname,
`../theme/keywind/email/html-src/${file}`
)} --output-html ${path.join(__dirname, `../theme/keywind/email/html/${file}`)}`
);
// fix: wrong build result for ftl-file exception
const data = readFileSync(path.join(__dirname, `../theme/keywind/email/html/${file}`));
const result = data.toString()
.replaceAll("<!--@", '</@')
.replaceAll("<!--#", '</#')
.replaceAll("-->", '>')
writeFileSync(path.join(__dirname, `../theme/keywind/email/html/${file}`), result);
}
})
);
for (let file of files) {
if (file.includes('.ftl')) {
// Build using mailwind
await exec(
`mailwind --input-html ${path.join(
__dirname,
`../theme/keywind/email/html-src/${file}`
)} --output-html ${path.join(__dirname, `../theme/keywind/email/html/${file}`)}`
);
// fix: wrong build result for ftl-file exception
const data = readFileSync(path.join(__dirname, `../theme/keywind/email/html/${file}`));
const result = data
.toString()
.replaceAll('<!--@', '</@')
.replaceAll('<!--#', '</#')
.replaceAll('-->', '>');
writeFileSync(path.join(__dirname, `../theme/keywind/email/html/${file}`), result);
}
}