File tree 1 file changed +25
-12
lines changed
packages/openapi-typescript/scripts
1 file changed +25
-12
lines changed Original file line number Diff line number Diff line change @@ -15,18 +15,31 @@ async function generateSchemas() {
15
15
const updateSchema = async ( name : string , ext : string ) => {
16
16
const start = performance . now ( ) ;
17
17
18
- await execa (
19
- "./bin/cli.js" ,
20
- [ `./examples/${ name } ${ ext } ` , "-o" , `./examples/${ name } .ts` ] ,
21
- { cwd } ,
22
- ) ;
23
-
24
- schemasDoneCount ++ ;
25
- const timeMs = Math . round ( performance . now ( ) - start ) ;
26
-
27
- console . log (
28
- `✔︎ [${ schemasDoneCount } /${ schemaTotalCount } ] Updated ${ name } (${ timeMs } ms)` ,
29
- ) ;
18
+ try {
19
+ await execa (
20
+ "./bin/cli.js" ,
21
+ [ `./examples/${ name } ${ ext } ` , "-o" , `./examples/${ name } .ts` ] ,
22
+ {
23
+ cwd :
24
+ process . platform === "win32"
25
+ ? // execa/cross-spawn can not handle URL objects on Windows, so convert it to string and cut away the protocol
26
+ cwd . toString ( ) . slice ( "file:///" . length )
27
+ : cwd ,
28
+ } ,
29
+ ) ;
30
+
31
+ schemasDoneCount ++ ;
32
+ const timeMs = Math . round ( performance . now ( ) - start ) ;
33
+
34
+ console . log (
35
+ `✔︎ [${ schemasDoneCount } /${ schemaTotalCount } ] Updated ${ name } (${ timeMs } ms)` ,
36
+ ) ;
37
+ } catch ( error ) {
38
+ console . error (
39
+ `✘ [${ schemasDoneCount } /${ schemaTotalCount } ] Failed to update ${ name } ` ,
40
+ { error : error instanceof Error ? error . message : error } ,
41
+ ) ;
42
+ }
30
43
} ;
31
44
32
45
console . log ( "Updating examples..." ) ;
You can’t perform that action at this time.
0 commit comments