feat(edit-docs): clean up ZIP file

This commit is contained in:
Elian Doran 2025-03-10 16:31:44 +02:00
parent df2a9aed44
commit bffb0963df
No known key found for this signature in database

View File

@ -17,6 +17,9 @@ async function exportData() {
const zipFilePath = "output.zip";
const destRootPath = path.join("src", "public", "app", "doc_notes", "en", "User Guide");
const deferred = (await import("./src/services/utils.js")).deferred;
try {
await fsExtra.remove(destRootPath);
await fsExtra.mkdir(destRootPath);
@ -24,6 +27,7 @@ async function exportData() {
const { exportToZipFile } = (await import("./src/services/export/zip.js")).default;
await exportToZipFile(NOTE_ID_USER_GUIDE, "html", zipFilePath);
const promise = deferred<void>()
setTimeout(async () => {
// Then extract the zip.
const { readZipFile, readContent } = (await import("./src/services/import/zip.js"));
@ -39,7 +43,14 @@ async function exportData() {
zip.readEntry();
});
promise.resolve();
}, 1000);
await promise;
} finally {
if (await fsExtra.exists(zipFilePath)) {
await fsExtra.rm(zipFilePath);
}
}
}
await main();