(fileArg, data, label, pretty = false)
| 278 | } |
| 279 | |
| 280 | function writeJson(fileArg, data, label, pretty = false) { |
| 281 | const out = resolve(fileArg) |
| 282 | writeFileSync(out, pretty ? JSON.stringify(data, null, 2) + '\n' : JSON.stringify(data), 'utf8') |
| 283 | console.log(` → ${out} (${label})`) |
| 284 | } |
| 285 | |
| 286 | /** Emit one TS module per domain: types from the AST (cddl2ts), methods from the model. */ |
| 287 | function generateTypeScript(ast, model, args) { |