Skip to content

Commit

Permalink
Build PDF
Browse files Browse the repository at this point in the history
  • Loading branch information
ralfhandl committed Jul 20, 2023
1 parent 5c676d9 commit fb1448b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 9 deletions.
Binary file added docs/odata-json-format/odata-json-format.pdf
Binary file not shown.
46 changes: 37 additions & 9 deletions lib/build-pdf.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,39 @@
const pdf = require("./pdf.js");
const fs = require("fs");

pdf("odata-data-aggregation-ext")
.then(() => {
console.log("PDF generated");
process.exit(0);
})
.catch((error) => {
console.error(error);
process.exit(3);
});
let errors = false;

fs.readdirSync(__dirname + "/..", { withFileTypes: true }).forEach(function (
doc
) {
if (doc.isDirectory() && doc.name.startsWith("odata-")) {
const htmlFile = `${__dirname}/../docs/${doc.name}/${doc.name}.html`;
const pdfFile = `${__dirname}/../docs/${doc.name}/${doc.name}.pdf`;

const htmlStat = fs.statSync(htmlFile, { throwIfNoEntry: false });
const pdfStat = fs.statSync(pdfFile, { throwIfNoEntry: false });

if (pdfStat === undefined || htmlStat?.mtime > pdfStat?.mtime) {
console.log(doc.name);

pdf(doc.name).catch((error) => {
console.error(error);
errors = true;
});
}
}
});

// pdf("odata-data-aggregation-ext")
// .then(() => {
// console.log("PDF generated");
// process.exit(0);
// })
// .catch((error) => {
// console.error(error);
// process.exit(3);
// });

if (errors) {
process.exit(1);
}

0 comments on commit fb1448b

Please sign in to comment.