chore: data rewriting

This commit is contained in:
Cory Dransfeldt 2023-08-23 13:47:09 -07:00
parent 14e1945ba4
commit 8948ae8cb8
No known key found for this signature in database
4 changed files with 30 additions and 6 deletions

View file

@ -47,7 +47,7 @@
"husky": "^8.0.3",
"ics-to-json-extended": "^1.1.4",
"lint-staged": "^14.0.1",
"liquidjs": "^10.8.3",
"liquidjs": "^10.9.1",
"luxon": "^3.4.0",
"markdown-it": "^13.0.1",
"markdown-it-anchor": "^8.4.1",

24
src/_data/fathom.js Normal file
View file

@ -0,0 +1,24 @@
const fs = require('fs')
const fetch = require('node-fetch')
module.exports = async function () {
const sourceUrl = 'https://cdn.usefathom.com/script.js'
fetch(sourceUrl)
.then((response) => response.text())
.then((sourceContent) => {
if (!sourceContent.includes('fathomScript.src.indexOf("cdn.usefathom.com")'))
throw new Error('Fathom script changed!')
const modifiedContent = sourceContent.replace(
'fathomScript.src.indexOf("cdn.usefathom.com")',
'fathomScript.src.indexOf("coryd.dev")'
)
const newFilePath = './_site/script.js'
fs.writeFile(newFilePath, modifiedContent, (err) => {
if (err) console.log(err)
})
})
.catch((err) => {
console.error('Error downloading the file:', err)
})
}

View file

@ -56,7 +56,7 @@
{% jsonLd meta, type, tags %}
</script>
<script
src="https://cdn.usefathom.com/script.js"
src="{{ site.url }}/script.js?v={% version %}"
data-site="RBCOWZTA"
defer></script>
<noscript>

View file

@ -3446,10 +3446,10 @@ lint-staged@^14.0.1:
string-argv "0.3.2"
yaml "2.3.1"
liquidjs@^10.7.0, liquidjs@^10.8.3:
version "10.8.4"
resolved "https://registry.yarnpkg.com/liquidjs/-/liquidjs-10.8.4.tgz#32596e189e264f60794af8f41cd26c0c66f6da49"
integrity sha512-HSpYAFBVWxhwWsTKPBJgPm3bnwwIzAZjy17XhX7uJCKJ8H6A1YstZSFmPqMmWfSuJOg43RSx+qWVSA1Fu3+B2w==
liquidjs@^10.7.0, liquidjs@^10.9.1:
version "10.9.1"
resolved "https://registry.yarnpkg.com/liquidjs/-/liquidjs-10.9.1.tgz#3baf399efd447dafe48ee8431c81fb36d5733b73"
integrity sha512-1191NKgWdsxc7VJKuLR2hNfacyn1LSA2/1bMMECDGckajVCvbDC4OWlcZJ+il3fkhuiGSHYd++HNgjP35gbDWw==
dependencies:
commander "^10.0.0"