1414
1515const fs = require ( 'fs' ) ;
1616const path = require ( 'path' ) ;
17+ const { execSync } = require ( 'child_process' ) ;
1718
1819// Simple YAML parser for our arena config format
1920function parseYAML ( yamlText ) {
@@ -257,6 +258,17 @@ function getConfigsByGeneration() {
257258if (typeof module !== 'undefined' && module.exports) {
258259 module.exports = { STANDARD_CONFIGS, PANEL_SPECS, getConfig, getConfigsByGeneration };
259260}
261+
262+ // Browser global export (for non-module scripts)
263+ if (typeof window !== 'undefined') {
264+ window.STANDARD_CONFIGS = STANDARD_CONFIGS;
265+ window.PANEL_SPECS = PANEL_SPECS;
266+ window.getConfig = getConfig;
267+ window.getConfigsByGeneration = getConfigsByGeneration;
268+ }
269+
270+ // ES6 module export
271+ export { STANDARD_CONFIGS, PANEL_SPECS, getConfig, getConfigsByGeneration };
260272` ;
261273
262274 // Ensure js/ directory exists
@@ -266,7 +278,17 @@ if (typeof module !== 'undefined' && module.exports) {
266278 }
267279
268280 fs . writeFileSync ( outputFile , output ) ;
269- console . log ( `\nGenerated ${ outputFile } with ${ Object . keys ( sortedConfigs ) . length } configs` ) ;
281+
282+ // Format with Prettier to match project style
283+ try {
284+ execSync ( `npx prettier --write "${ outputFile } "` , { stdio : 'inherit' } ) ;
285+ console . log (
286+ `\nGenerated and formatted ${ outputFile } with ${ Object . keys ( sortedConfigs ) . length } configs`
287+ ) ;
288+ } catch ( err ) {
289+ console . log ( `\nGenerated ${ outputFile } with ${ Object . keys ( sortedConfigs ) . length } configs` ) ;
290+ console . log ( 'Warning: Could not run Prettier. Run "npm run format" to format the output.' ) ;
291+ }
270292}
271293
272294main ( ) ;
0 commit comments