redzuurdesem/jamstack-init.js

28 lines
885 B
JavaScript
Raw Normal View History

2021-03-05 14:18:21 +01:00
const { mastodon, goodreads, lunr, webmention } = require('jam-my-stack');
2021-03-05 14:18:21 +01:00
const fsp = require('fs').promises;
(async function() {
// 1. build Lunr index
console.log("1. Building lunr search index...")
const index = await lunr.buildIndex([
`${__dirname}/content/post`,
`${__dirname}/content/kort`,
2021-03-05 14:18:21 +01:00
`${__dirname}/content/leren`])
await fsp.writeFile(`${__dirname}/static/js/redzuurdesem-post.json`, JSON.stringify(index), 'utf-8')
// 4. get webmentions
console.log("2. Fetching webmentions...")
const mentions = await webmention.getWebmentions("redzuurdesem.be")
const json = JSON.stringify(mentions, null, 4)
await fsp.writeFile(`${__dirname}/data/webmentions.json`, json, 'utf-8')
// 5. send webmentions
console.log("3. Sending webmentions...")
const since = await webmention.send("redzuurdesem.be")
console.log(` -- done`)
2021-03-05 14:18:21 +01:00
console.log("-- all done!")
})()