Skip to content

Commit

Permalink
build(fix): mjs endings and proper node version for frontmatter scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsneighbour committed Jun 17, 2024
1 parent 027a819 commit 4935aa5
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .frontmatter/config/custom/scripts/screenshot.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://frontmatter.codes/config/custom.scripts.schema.json",
"command": "~/.nvm/versions/node/v20.4.0/bin/node",
"script": "./.frontmatter/scripts/screenshot-header-image.js",
"script": "./.frontmatter/scripts/screenshot-header-image.cjs",
"title": "Retrieve Screenshot"
}
2 changes: 1 addition & 1 deletion .frontmatter/config/custom/scripts/unsplash.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://frontmatter.codes/config/custom.scripts.schema.json",
"command": "~/.nvm/versions/node/v20.4.0/bin/node",
"script": "./.frontmatter/scripts/retrieve-unsplash-header-image-info.mjs",
"script": "./.frontmatter/scripts/retrieve-unsplash-header-image-info.cjs",
"title": "Retrieve Unsplash image"
}
2 changes: 1 addition & 1 deletion .frontmatter/config/custom/scripts/youtube.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://frontmatter.codes/config/custom.scripts.schema.json",
"title": "Generate social image for Youtube",
"script": "./.frontmatter/scripts/create-youtube-header-image.js",
"script": "./.frontmatter/scripts/create-youtube-header-image.cjs",
"command": "~/.nvm/versions/node/v20.9.0/bin/node",
"type": "content"
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const path = require('path');
const util = require('util');
const fs = require('fs');
const arguments = process.argv;
const args = process.argv;
const fetch = (...args) => import('node-fetch').then(({ default: fetch }) => fetch(...args));

(async () => {
if (arguments && arguments.length > 0) {
const folderArg = path.dirname(arguments[3]);
const frontmatterArg = arguments[4];
if (args && args.length > 0) {
const folderArg = path.dirname(args[3]);
const frontmatterArg = args[4];
const data = frontmatterArg && typeof frontmatterArg === "string" ? JSON.parse(frontmatterArg) : null;
const videoId = data.video.youtube;
// https://i.ytimg.com/vi/49FXjBiccG4/sddefault.jpg
Expand Down

0 comments on commit 4935aa5

Please sign in to comment.