const path = require('path');
const fs = require("fs");
const fsp = fs.promises;
const JSON5 = require('json5');
async function createExamplesPage(){
const content = await fsp.readFile("./examples/page.json", 'utf8');
const settings = JSON5.parse(content);
const files = await fsp.readdir("./examples");
let unhandledCode = ``;
let exampleCode = ``;
let showcaseCode = ``;
let thirdpartyCode = ``;
{
let urls = settings.examples.map(e => e.url);
let unhandled = [];
for(let file of files){
let isHandled = false;
for(let url of urls){
if(file.indexOf(url) !== -1){
isHandled = true;
}
}
if(!isHandled){
unhandled.push(file);
}
}
unhandled = unhandled
.filter(file => file.indexOf(".html") > 0)
.filter(file => file !== "page.html");
for(let file of unhandled){
unhandledCode += `
${file}
`;
}
}
for(let example of settings.examples){
exampleCode += `