Skip to content

Commit

Permalink
Update build_index.mjs
Browse files Browse the repository at this point in the history
  • Loading branch information
marcustyphoon committed Dec 6, 2024
1 parent 4176de1 commit 22acca2
Showing 1 changed file with 25 additions and 23 deletions.
48 changes: 25 additions & 23 deletions dev/build_index.mjs
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
import fs from "node:fs/promises";
import fs from "node:fs";
import path from "node:path";

(async () => {
const extensionFiles = await fs.readdir("Extensions");
const extensionIds = extensionFiles
.filter(fileName => fileName.endsWith(".js") && !fileName.endsWith(".icon.js"))
.map(fileName => path.parse(fileName).name);
const extensionFiles = fs.readdirSync("Extensions");
const extensionIds = extensionFiles
.filter(fileName => fileName.endsWith(".js") && !fileName.endsWith(".icon.js"))
.map(fileName => path.parse(fileName).name);

const extensionList = {};
extensionIds.forEach(id => {
extensionList[id] = {
icon: extensionFiles.includes(`${id}.icon.js`),
css: extensionFiles.includes(`${id}.css`),
};
});
const extensionList = {};
extensionIds.forEach(id => {
extensionList[id] = {
icon: extensionFiles.includes(`${id}.icon.js`),
css: extensionFiles.includes(`${id}.css`),
};
});

await fs.writeFile("Extensions/_index.json", JSON.stringify(extensionList, null, 2), {
encoding: "utf8",
flag: "w+",
});
fs.writeFileSync(
"Extensions/_index.json",
JSON.stringify(extensionList, null, 2),
{ encoding: "utf8", flag: "w+", }
);

const themeList = (await fs.readdir("Themes")).filter(name => name.startsWith("_") === false);
await fs.writeFile("Themes/_index.json", JSON.stringify(themeList, null, 2), {
encoding: "utf8",
flag: "w+",
});
})();
const themeList = fs.readdirSync("Themes")
.filter(name => name.startsWith("_") === false);

fs.writeFileSync(
"Themes/_index.json",
JSON.stringify(themeList, null, 2),
{ encoding: "utf8", flag: "w+", }
);

0 comments on commit 22acca2

Please sign in to comment.