const {promises: fsp} = require('fs'); const {join} = require('path'); const {createUserstyle} = require('./utilities'); async function main() { // Make sure the `build/` directory exists. await fsp.mkdir(join(__dirname, '../build/'), {recursive: true}); // Create each userstyle and output them to `build/`. for (const style of styles) { await createUserstyle(style, 'build'); } // Log how many and which userstyles were built. const styleList = styles.map(style => `* ${style}`).join('\n'); console.log(`Built ${styles.length} styles:\n${styleList}`); } // Define the userstyles to build here. const styles = ['tildes-baukula', 'tildes-compact']; // Export the `main()` function as `build()` for external use. module.exports = { build: main, styles }; // Run `main()` if this script was called directly (like `node source/index.js`). if (require.main === module) { main(); }