1
1
mirror of https://github.com/theoludwig/theoludwig.git synced 2025-05-29 22:37:44 +02:00

chore: easier development for jsonresume-theme-custom thanks to vite

This commit is contained in:
Divlo
2022-07-28 21:20:41 +02:00
parent 1ebdab18a5
commit 8bc1471cbb
21 changed files with 3197 additions and 8676 deletions

View File

@ -1,21 +1,19 @@
import { fileURLToPath } from 'node:url'
import fs from 'node:fs'
import { render } from '../index.js'
import { build } from 'vite'
const jsonResumeURL = new URL('../../resume.json', import.meta.url)
const publicResumeURL = new URL(
'../../public/curriculum-vitae.html',
const jsonResumeThemeCustom = new URL('../', import.meta.url)
const jsonResumeThemeCustomDist = new URL('./dist', jsonResumeThemeCustom)
const publicResumeOutputURL = new URL(
'../../public/curriculum-vitae',
import.meta.url
)
const dataResumeStringJSON = await fs.promises.readFile(jsonResumeURL, {
encoding: 'utf-8'
})
const dataResumeJSON = JSON.parse(dataResumeStringJSON)
const dataResumeIndexHTML = await render(dataResumeJSON)
await fs.promises.writeFile(publicResumeURL, dataResumeIndexHTML, {
encoding: 'utf-8'
await build({
root: fileURLToPath(jsonResumeThemeCustom)
})
console.log('Resume generated successfully!')
console.log(`See it at ${publicResumeURL}`)
await fs.promises.cp(jsonResumeThemeCustomDist, publicResumeOutputURL, {
recursive: true
})