Files
orca/config/scripts/plugin-authoring/generated-contracts/generate-plugin-declarative-typings.mjs
T
Neil 6bb2e13c35 refactor(tooling): organize remaining scripts by domain owners (#38407)
* refactor(tooling): group remaining scripts by concrete domain owners

* fix(tooling): preserve relocated launcher resource roots
2026-11-05 00:29:16 -08:00

22 lines
941 B
JavaScript

// Regenerates the host-method region of resources/plugins/declarative/orca.d.ts from the host API
// table. `--check` fails when it is stale instead of rewriting it.
import { readFileSync, writeFileSync } from 'node:fs'
import path from 'node:path'
import { loadPluginSchemaModule, REPO_ROOT } from './plugin-schema-module-loader.mjs'
const TYPINGS = path.join(REPO_ROOT, 'resources', 'plugins', 'declarative', 'orca.d.ts')
const { spliceOrcaHostTypings } = loadPluginSchemaModule(
'declarative/plugin-declarative-host-typings.ts'
)
const current = readFileSync(TYPINGS, 'utf8')
const next = spliceOrcaHostTypings(current)
if (process.argv.includes('--check')) {
if (next !== current) {
console.error('orca.d.ts host methods are stale; run pnpm generate:plugin-declarative-typings')
process.exit(1)
}
} else if (next !== current) {
writeFileSync(TYPINGS, next)
console.log(`wrote ${path.relative(REPO_ROOT, TYPINGS)}`)
}