mirror of
https://github.com/PostHog/posthog.git
synced 2024-12-01 12:21:02 +01:00
d7d03b5985
* Revert "revert(insights): HogQL calculation of saved legacy insights v3 (#21778)"
This reverts commit c0be1d1412
.
* Move HogQL in insight serialization to its own flag
29 lines
911 B
JavaScript
29 lines
911 B
JavaScript
#!/usr/bin/env node
|
|
|
|
// replaces ts-json-schema-generator -f tsconfig.json --path 'frontend/src/queries/schema.ts' --no-type-check > frontend/src/queries/schema.json
|
|
|
|
import fs from 'fs'
|
|
import stableStringify from 'safe-stable-stringify'
|
|
import tsj from 'ts-json-schema-generator'
|
|
|
|
/** @type {import('ts-json-schema-generator/dist/src/Config').Config} */
|
|
const config = {
|
|
...tsj.DEFAULT_CONFIG,
|
|
path: 'frontend/src/queries/schema.ts',
|
|
tsconfig: 'tsconfig.json',
|
|
discriminatorType: 'open-api',
|
|
skipTypeCheck: true,
|
|
}
|
|
|
|
const output_path = 'frontend/src/queries/schema.json'
|
|
|
|
const schema = tsj.createGenerator(config).createSchema(config.type)
|
|
const stringify = config.sortProps ? stableStringify : JSON.stringify
|
|
const schemaString = config.minify ? stringify(schema) : stringify(schema, null, 2)
|
|
|
|
fs.writeFile(output_path, schemaString, (err) => {
|
|
if (err) {
|
|
throw err
|
|
}
|
|
})
|