jefklakscodex/hooks/precommit.js

26 lines
705 B
JavaScript

const fsp = require('fs').promises;
const { resolve } = require('path');
const { howlongtobeat, youtube } = require('jam-my-stack');
// If this isn't resolved, jam-my-stack will fail to replace 'content' with 'static' when downloading covers.
const rootdir = resolve(`${__dirname}/..`);
(async function() {
console.log("--> adding Howlongtobeat info...")
await howlongtobeat.howlong({
postDir: `${rootdir}/content`,
downloadDir: `${rootdir}/static`
})
console.log("--> Generating YouTube thumbnails...")
await youtube.thumbify({
postDir: `${rootdir}/content`,
downloadDir: `${rootdir}/static/img/yt`,
overlayImg: `${rootdir}/play.png`
})
console.log("-- precommit: all done!")
})()