export html file both from web page and electron

This commit is contained in:
Jan Prochazka
2021-11-11 14:33:36 +01:00
parent b9da035a97
commit d2299ab926
7 changed files with 113 additions and 26 deletions

View File

@@ -339,16 +339,15 @@ module.exports = {
},
generateDbDiffReport_meta: 'post',
async generateDbDiffReport({ sourceConid, sourceDatabase, targetConid, targetDatabase }) {
async generateDbDiffReport({ filePath, sourceConid, sourceDatabase, targetConid, targetDatabase }) {
const unifiedDiff = await this.getUnifiedDiff({ sourceConid, sourceDatabase, targetConid, targetDatabase });
const diffJson = parse(unifiedDiff);
// $: diffHtml = html(diffJson, { outputFormat: 'side-by-side', drawFileList: false });
const diffHtml = html(diffJson, { outputFormat: 'side-by-side' });
const fileName = `${uuidv1()}.html`;
await fs.writeFile(path.join(uploadsdir(), fileName), diff2htmlPage(diffHtml));
await fs.writeFile(filePath, diff2htmlPage(diffHtml));
return fileName;
return true;
},
};