11import { JSONSchema } from '@apidevtools/json-schema-ref-parser' ;
22import { Ajv } from 'ajv' ;
3+ import { VerbosityLevel } from 'codify-plugin-lib' ;
4+ import { SequentialPty } from 'codify-plugin-lib/dist/pty/seqeuntial-pty' ;
35import { IpcMessage , IpcMessageSchema , MessageStatus , ResourceSchema } from 'codify-schemas' ;
46import mergeJsonSchemas from 'merge-json-schemas' ;
57import { ChildProcess , fork } from 'node:child_process' ;
68import fs from 'node:fs' ;
79import path from 'node:path' ;
810import * as url from 'node:url' ;
911
10- import { codifySpawn } from '../src/utils/codify-spawn.js' ;
11-
1212const ajv = new Ajv ( {
1313 strict : true
1414} ) ;
@@ -36,8 +36,11 @@ function sendMessageAndAwaitResponse(process: ChildProcess, message: IpcMessage)
3636 } ) ;
3737}
3838
39- await codifySpawn ( 'rm -rf ./dist' )
40- await codifySpawn ( 'npm run rollup -- -f es' ) ;
39+ VerbosityLevel . set ( 3 ) ;
40+ const $ = new SequentialPty ( ) ;
41+
42+ await $ . spawn ( 'rm -rf ./dist' )
43+ await $ . spawn ( 'npm run rollup -- -f es' , { interactive : true } ) ;
4144
4245const plugin = fork (
4346 './dist/index.js' ,
@@ -89,8 +92,8 @@ const mergedSchemas = [...schemasMap.entries()].map(([type, schema]) => {
8992 } ) ;
9093
9194
92- await codifySpawn ( 'rm -rf ./dist' )
93- await codifySpawn ( 'npm run rollup' ) ; // re-run rollup without building for es
95+ await $ . spawn ( 'rm -rf ./dist' )
96+ await $ . spawn ( 'npm run rollup' , { interactive : true } ) ; // re-run rollup without building for es
9497
9598console . log ( 'Generated JSON Schemas for all resources' )
9699
@@ -100,8 +103,7 @@ fs.writeFileSync(schemaOutputPath, JSON.stringify(mergedSchemas, null, 2));
100103
101104console . log ( 'Successfully wrote schema to ./dist/schemas.json' )
102105
103- // eslint-disable-next-line n/no-process-exit,unicorn/no-process-exit
104- process . exit ( 0 )
105-
106106
107+ plugin . kill ( 9 ) ;
108+ process . exit ( 0 ) ;
107109
0 commit comments