UNPKG

penframe

Version:

A lightweight DSL-based wireframe and UI structure visualization tool.

25 lines (20 loc) 678 B
#!/usr/bin/env node const fs = require('fs'); const path = require('path'); const astToSvg = require('./astToSvg'); const [,, inputPath, outputPath] = process.argv; if (!inputPath || !outputPath) { console.error('Usage: node src/svg/ast2svg.js <input_ast.json> <output.svg>'); process.exit(1); } const absInput = path.resolve(inputPath); const absOutput = path.resolve(outputPath); try { const ast = JSON.parse(fs.readFileSync(absInput, 'utf8')); const svg = astToSvg(ast); fs.writeFileSync(absOutput, svg, 'utf8'); console.log(`SVG written to ${absOutput}`); } catch (err) { console.error('Error:', err.message); process.exit(1); }