From fb8dd537e0a88acc9a4a254208cdf0b56d90cf13 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Wed, 15 Jun 2022 21:34:56 +0200 Subject: [PATCH] node 16 compat --- tutorial/render.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tutorial/render.js b/tutorial/render.js index 38b24020..58c6c51a 100644 --- a/tutorial/render.js +++ b/tutorial/render.js @@ -1,8 +1,10 @@ import nunjucks from 'nunjucks'; -import jsdoc from '../doc.json' assert { type: 'json' }; - -// TODO: load tutorial.mdx and append rendered api.mdx to the bottom (to make sure TOC works) -// TODO: split +import { readFile } from 'node:fs/promises'; +import { fileURLToPath } from 'url'; +import { dirname } from 'path'; +const __dirname = dirname(fileURLToPath(import.meta.url)); +const jsdoc = JSON.parse(await readFile(`${__dirname}/../doc.json`, 'utf8')); +// import jsdoc from '../doc.json' assert { type: 'json' }; // node 18 const env = nunjucks.configure('.', { autoescape: false });