(fileArg, data, label, pretty = false)
| 195 | } |
| 196 | |
| 197 | function writeJson(fileArg, data, label, pretty = false) { |
| 198 | const out = resolve(fileArg) |
| 199 | writeFileSync(out, pretty ? JSON.stringify(data, null, 2) + '\n' : JSON.stringify(data), 'utf8') |
| 200 | console.log(` → ${out} (${label})`) |
| 201 | } |
| 202 | |
| 203 | /** Emit one TS module per domain: types from the AST (cddl2ts), methods from the model. */ |
| 204 | function generateTypeScript(ast, model, args) { |