Skip to content

Commit

Permalink
Update updater.js
Browse files Browse the repository at this point in the history
  • Loading branch information
dadatuputi authored Oct 9, 2024
1 parent 706cbe2 commit 266ce89
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions updater.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,24 @@ const getCurrentData = async () => {
}

// write homepage
const pageHome = pug.renderFile(path.join(__dirname, "src/index.pug"), { ...options, links, date })
fs.writeFileSync(path.join(__dirname, "docs/index.html"), pageHome)
// make docs dir to place them in
const docsDir = path.resolve(__dirname, 'docs');
fs.mkdirSync(docsDir, { recursive: true });
const srcDir = path.resolve(__dirname, 'src');

const pageHome = pug.renderFile(path.resolve(srcDir, "index.pug"), { ...options, links, date })
fs.writeFileSync(path.resolve(docsDir, "index.html"), pageHome)
console.log("Wrote homepage")

// write browser tutorial homepage
const pageTutorial = pug.renderFile(path.join(__dirname, "src/tutorial.pug"), { ...options })
const pageTutorial = pug.renderFile(path.resolve(srcDir, "tutorial.pug"), { ...options })
fs.mkdirSync('docs/tutorial', { recursive: true})
fs.writeFileSync(path.join(__dirname, "docs/tutorial/index.html"), pageTutorial)
fs.writeFileSync(path.resolve(docsDir, "tutorial/index.html"), pageTutorial)
console.log("Wrote tutorial")

// write osdd.xml
const osdd = pug.renderFile(path.join(__dirname, "src/osdd.xml.pug"), { ...options, ...locals })
fs.writeFileSync(path.join(__dirname, "docs/osdd.xml"), osdd)
const osdd = pug.renderFile(path.resolve(srcDir, "osdd.xml.pug"), { ...options, ...locals })
fs.writeFileSync(path.resolve(docsDir, "osdd.xml"), osdd)
console.log("Wrote osdd")

console.log("Done writing updated data.")
Expand Down

0 comments on commit 266ce89

Please sign in to comment.