qol-hooks
Version:
A collection of React hooks to improve the quality of life of developers.
19 lines (18 loc) • 615 B
JavaScript
import color from "../utils/color.js";
import fs from "fs/promises";
import CONFIG from "../config.js";
import path from "path";
export default async function list() {
// Read the hooks.json file
const jsonPath = path.resolve(CONFIG.modulePath, "..", "hooks.json");
const hooks = await fs
.readFile(jsonPath, { encoding: "utf-8" })
.then((data) => JSON.parse(data));
// List all hooks
console.log(color("cyan", "\nAvailable hooks:"));
for (const hook in hooks) {
const hookObj = hooks[hook];
console.log(` - ${hookObj.name}`);
}
console.log("\n");
}