import * as fs from 'fs' ; import * as path from 'path' ; import * as schemas from 'typescript-json-schema' ; import { packages } from '../packagesTs' ; import tsConfig from '../../tsconfig.base.json' ; const outputs = process . argv . slice ( 2 ) [ 0 ] . split ( ',' ) ; const rootPath = path . resolve ( __dirname , '../..' ) ; const includesPath = path . join ( rootPath , 'includes' ) ; const packagesPath = path . join ( rootPath , 'packages' ) ; async function generateSchemas ( ) { packages . filter ( ( pkg ) => { return ( pkg !== 'harmony-' && outputs . indexOf ( pkg . replace ( 'harmony-' , '' ) ) !== - 1 ) ; } ) . forEach ( ( pkg ) => { const pkgPath = path . join ( packagesPath , pkg ) ; const pkgSrc = path . join ( pkgPath , 'src' ) ; const settings = { ref : false , } ; const tsConfig = { lib : [ 'es2015' ] , } ; const prog = schemas . getProgramFromFiles ( [ path . resolve ( path . join ( pkgSrc , 'types.ts' ) ) ] , tsConfig ) ; const schema = schemas . generateSchema ( prog , '*' , settings ) ; } ) ; } generateSchemas ( ) ;