Skip to content

Commit

Permalink
Reinstate index commands, only zip if changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dprothero committed Mar 16, 2024
1 parent ca11543 commit 9175682
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 21 deletions.
10 changes: 6 additions & 4 deletions src/formats/markdownObsidian.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,12 @@ export async function convertToMarkdownObsidian(
}
}

const outputZipPath = path.join(OUTPUT_PATH, `${docType}_obsidian.zip`);
const zip = new AdmZip();
zip.addLocalFolder(MARKDOWN_OBSIDIAN_PATHS[docType]);
zip.writeZip(outputZipPath);
if (previousMarkdown !== newMarkdown) {
const outputZipPath = path.join(OUTPUT_PATH, `${docType}_obsidian.zip`);
const zip = new AdmZip();
zip.addLocalFolder(MARKDOWN_OBSIDIAN_PATHS[docType]);
zip.writeZip(outputZipPath);
}

process.stdout.write("Done\n");

Expand Down
34 changes: 17 additions & 17 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ async function createOutput(docType: DocType) {
logUpdate(docType, "html");
}

// if (
// html !== prevHtml ||
// !fs.existsSync(path.join(OUTPUT_PATH, `${docType}.pdf`))
// ) {
// await convertToPdf(docType, html);
// logUpdate(docType, "pdf");
// }
if (
html !== prevHtml ||
!fs.existsSync(path.join(OUTPUT_PATH, `${docType}.pdf`))
) {
await convertToPdf(docType, html);
logUpdate(docType, "pdf");
}

// const epubPath = path.join(OUTPUT_PATH, `${docType}.epub`);
// if (html !== prevHtml || !fs.existsSync(epubPath)) {
// await convertToEpub(docType, filePath, epubPath);
// logUpdate(docType, "epub");
// }
const epubPath = path.join(OUTPUT_PATH, `${docType}.epub`);
if (html !== prevHtml || !fs.existsSync(epubPath)) {
await convertToEpub(docType, filePath, epubPath);
logUpdate(docType, "epub");
}

const markdownUpdated = await convertToMarkdown(docType, html);
if (markdownUpdated) {
Expand All @@ -57,12 +57,12 @@ async function createOutput(docType: DocType) {
logUpdate(docType, "markdown_obsidian");
}

// const jsonUpdated = await convertToJson(docType);
// if (jsonUpdated) {
// logUpdate(docType, "json");
// }
const jsonUpdated = await convertToJson(docType);
if (jsonUpdated) {
logUpdate(docType, "json");
}

// await publishJsonPackage(docType);
await publishJsonPackage(docType);
}

async function run() {
Expand Down

0 comments on commit 9175682

Please sign in to comment.