mirror of
https://github.com/enso-org/enso.git
synced 2024-12-22 09:31:41 +03:00
9fd1ab9092
Generate TS bindings and lazy deserialization for the parser types. # Important Notes - The new API is imported into `ffi.ts`, but not yet used. - I have tested the generated code in isolation, but cannot commit tests as we are not currently able to load WASM modules when running in `vitest`.
18 lines
554 B
TypeScript
18 lines
554 B
TypeScript
import * as fs from 'node:fs'
|
|
import * as process from 'node:process'
|
|
import * as codegen from './codegen.js'
|
|
import * as Schema from './schema.js'
|
|
|
|
const schemaPath = process.argv[2]
|
|
const outputPath = process.argv[3]
|
|
|
|
if (!schemaPath || !outputPath) {
|
|
console.error('Usage: parser-codegen <schemaPath> <outputPath>')
|
|
process.exit(1)
|
|
}
|
|
|
|
console.log(`Generating ${outputPath} from ${schemaPath}.`)
|
|
const schema: Schema.Schema = JSON.parse(fs.readFileSync(schemaPath, 'utf8'))
|
|
const code = codegen.implement(schema)
|
|
fs.writeFileSync(outputPath, code)
|