UNPKG

boardcast

Version:

Animation library for tabletop game rules on hex boards with CLI tools and game extensions

39 lines (32 loc) • 1.01 kB
import fs from 'fs'; import path from 'path'; import { tutorialTemplate } from './template.js'; async function createTutorial(filename) { // Ensure filename ends with .js if (!filename.endsWith('.js')) { filename += '.js'; } // Check if file already exists if (fs.existsSync(filename)) { console.error(`āŒ Error: File ${filename} already exists`); process.exit(1); } try { // Write the template to the file fs.writeFileSync(filename, tutorialTemplate, 'utf8'); console.log(`āœ… Created tutorial file: ${filename}`); console.log(` šŸ“ Next steps: 1. Edit ${filename} to customize your tutorial 2. Run: boardcast record ${filename} šŸ’” Tips: - Modify the gridRadius in config for different board sizes - Use the API reference at the bottom of the file - Test movements and timing by adjusting sleep() values `); } catch (error) { console.error(`āŒ Error creating file: ${error.message}`); process.exit(1); } } export { createTutorial };