mirror of
https://github.com/jlfwong/speedscope.git
synced 2024-11-26 15:45:50 +03:00
ca1abfdd32
Fixes #268 I fixed it by dropping the dependency on quicktype entirely, and using its dependency directly. I still don't understand why the version of typescript used in this repository affects what quicktype is doing, but it seems like the issue is in quicktype, not its dependency. I validated this change was correct by diffing the output of `node scripts/generate-file-format-schema-json.js` with what's currently on http://speedscope.app/file-format-schema.json. There's no difference. This PR also includes changes to the CI script to ensure that we can catch this before hitting master next time.
21 lines
654 B
JavaScript
21 lines
654 B
JavaScript
#!/usr/bin/env node
|
|
const child_process = require('child_process')
|
|
|
|
// Convert the file-format-spec.ts file into a json schema file
|
|
let jsonSchema = child_process.execSync(
|
|
'node_modules/.bin/typescript-json-schema ./src/lib/file-format-spec.ts --titles --required --topRef "*"',
|
|
{
|
|
encoding: 'utf8',
|
|
},
|
|
)
|
|
jsonSchema = JSON.parse(jsonSchema)
|
|
|
|
if (!jsonSchema.definitions['FileFormat.File']) {
|
|
console.error('SCHEMA GENERATION FAILURE: Could not find FileFormat.File in the definitions list')
|
|
console.error(jsonSchema)
|
|
process.exit(1)
|
|
}
|
|
|
|
jsonSchema['$ref'] = '#/definitions/FileFormat.File'
|
|
console.log(JSON.stringify(jsonSchema, null, 4))
|