Skip to content

Commit

Permalink
feat: Add timestamp to filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
nccurry committed Mar 21, 2022
1 parent 2c6a63c commit 83ad5d2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,21 @@ let resumeHtml = compileHtml(compiledFunction, resumeData)

let fileName = extractFileName(args.resumeDataPath)

const timestamp = new Date().toJSON().slice(0,10)

fs.writeFile(
path.join(__dirname, `../dist/${fileName}.html`),
path.join(__dirname, `../dist/${fileName}-${timestamp}.html`),
resumeHtml,
// Callback to conditionally generate a PDF in addition to the HTML file
async () => {
if (!args.generatePdf) {
return
}



let pdfOptions: PDFOptions = {
path: `${path.join(__dirname, `../dist/${fileName}.pdf`)}`,
path: `${path.join(__dirname, `../dist/${fileName}-${timestamp}.pdf`)}`,
format: 'a4',
pageRanges: '1',
margin: {
Expand Down

0 comments on commit 83ad5d2

Please sign in to comment.