/* (c) 0x230c40a9b133aa 2017, Licensed under MIT. Usage: put file in advancements/hermitcraft/-directory, run with `node export.js` Note: The output separates the hermit name and the advancement title with a tab ('\t'), so you can just copy and paste them in to a spreadsheet program (i.e. MS Excel) and the program will automatically put the hermit names and the advancement titles in their own columns! */ const fs = require('fs'); const path = require('path'); fs.readdir(__dirname, (err, dirs) => { if (err) throw err; dirs.filter(dir => dir.indexOf('.') === -1).forEach((dirName) => { let hermit; try { hermit = require(path.join(__dirname, dirName, 'root.json')).display.title.text; } catch(e) { hermit = dirName; } fs.readdir(path.join(__dirname, dirName), (fErr, files) => { if (fErr) throw fErr; files.filter(file => !file.startsWith('.')).filter(file => file.indexOf('_check') === -1 && file.indexOf('_trigger') === -1 && file !== 'root.json').forEach((file) => { const advancement = require(path.join(__dirname, dirName, file)); console.log(`${hermit}\t${advancement.display.title.text}`); }); }); }); });