forked from obedm503/showdown-katex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docs.js
21 lines (19 loc) · 766 Bytes
/
docs.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// @ts-check
const { join } = require('path');
const { writeFile, readFile, ensureDir, copyFile } = require('fs-extra');
const ejs = require('ejs');
(async () => {
const input = await readFile(join(__dirname, 'index.ejs'), 'utf-8');
const SRC =
process.env.NODE_ENV === 'production'
? 'https://cdn.jsdelivr.net/npm/@vincenttam/showdown-katex@latest/dist/showdown-katex.min.js'
: 'showdown-katex.js';
const out = await ejs.render(input, { SRC }, { async: true });
await ensureDir(join(__dirname, 'dist'));
await Promise.all([
writeFile(join(__dirname, 'dist/index.html'), out),
copyFile('CHANGELOG.md', 'dist/CHANGELOG.md'),
copyFile('README.md', 'dist/README.md'),
copyFile('examples.md', 'dist/examples.md'),
]);
})();