Skip to content

Commit

Permalink
Allow extension by adding additional protocol files
Browse files Browse the repository at this point in the history
  • Loading branch information
pipobscure authored and pdunkel committed Jul 31, 2023
1 parent e22d6aa commit 3c531b9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions scripts/protocol-dts-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ import * as path from 'path'
import {IProtocol, Protocol as P} from './protocol-schema'

// TODO: @noj validate this via https://github.com/andischerer/typescript-json-typesafe against protocol-schema.d.ts
const jsProtocol: IProtocol = require('../json/js_protocol.json')
const browserProtocol: IProtocol = require('../json/browser_protocol.json')
const protocolDomains: P.Domain[] = jsProtocol.domains.concat(browserProtocol.domains)
const protocolDomains: P.Domain[] = [];
for (const file of fs.readdirSync(path.join(__dirname, '..', 'json'))) {
if (path.extname(file) !== '.json') continue;
const def = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'json', file), 'utf-8'));
protocolDomains.push(...def.domains);
}

let numIndents = 0
let emitStr = ''
Expand Down

0 comments on commit 3c531b9

Please sign in to comment.