#!/usr/bin/env node const fs = require('node:fs') const path = require('node:path') const { parse } = require('yaml') const ymlPath = path.join(__dirname, "..", "data", "spells.yml"); const data = parse(fs.readFileSync(ymlPath, "utf8")); const columns = ["name", "cost", "targets", "duration"]; const myEscape = (s) => String(s ?? "") .replace(/&/g, "&") .replace(//g, ">"); const generateTable = (spells, class_) => { const rows = spells .filter((elem) => elem.class === class_) .map( (spell) => `