@@ -12,6 +12,7 @@ import * as fs from 'fs';
12
12
import * as glob from 'glob' ;
13
13
import * as path from 'path' ;
14
14
import { packages } from '../lib/packages' ;
15
+ import buildSchema from './build-schema' ;
15
16
16
17
const minimatch = require ( 'minimatch' ) ;
17
18
const tar = require ( 'tar' ) ;
@@ -200,41 +201,8 @@ async function _bazel(logger: logging.Logger) {
200
201
// TODO: undo this when we fully support bazel on windows.
201
202
// logger.info('Bazel build...');
202
203
// _exec('bazel', ['build', '//packages/...'], {}, logger);
203
-
204
- const allJsonFiles = glob . sync ( 'packages/**/*.json' , {
205
- ignore : [
206
- '**/node_modules/**' ,
207
- '**/files/**' ,
208
- '**/*-files/**' ,
209
- '**/package.json' ,
210
- ] ,
211
- } ) ;
212
-
213
- const quicktypeRunner = require ( '../tools/quicktype_runner' ) ;
214
- logger . info ( 'Generating JSON Schema....' ) ;
215
-
216
- for ( const fileName of allJsonFiles ) {
217
- if ( fs . existsSync ( fileName . replace ( / \. j s o n $ / , '.ts' ) )
218
- || fs . existsSync ( fileName . replace ( / \. j s o n $ / , '.d.ts' ) ) ) {
219
- // Skip files that already exist.
220
- continue ;
221
- }
222
- const content = fs . readFileSync ( fileName , 'utf-8' ) ;
223
-
224
- const json = JSON . parse ( content ) ;
225
- if ( ! json . $schema ) {
226
- // Skip non-schema files.
227
- continue ;
228
- }
229
- const tsContent = await quicktypeRunner . generate ( fileName ) ;
230
- const tsPath = path . join ( __dirname , '../dist-schema' , fileName . replace ( / \. j s o n $ / , '.ts' ) ) ;
231
-
232
- _mkdirp ( path . dirname ( tsPath ) ) ;
233
- fs . writeFileSync ( tsPath , tsContent , 'utf-8' ) ;
234
- }
235
204
}
236
205
237
-
238
206
export default async function (
239
207
argv : { local ?: boolean , snapshot ?: boolean } ,
240
208
logger : logging . Logger ,
@@ -243,6 +211,7 @@ export default async function(
243
211
244
212
const sortedPackages = _sortPackages ( ) ;
245
213
await _bazel ( logger ) ;
214
+ await buildSchema ( { } , logger ) ;
246
215
_build ( logger ) ;
247
216
248
217
logger . info ( 'Moving packages to dist/' ) ;
0 commit comments