28 lines
885 B
JavaScript
28 lines
885 B
JavaScript
|
|
const { mastodon, goodreads, lunr, webmention } = require('jam-my-stack');
|
|
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`,
|
|
`${__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`)
|
|
|
|
console.log("-- all done!")
|
|
})()
|