File tree Expand file tree Collapse file tree 1 file changed +19
-17
lines changed Expand file tree Collapse file tree 1 file changed +19
-17
lines changed Original file line number Diff line number Diff line change 33import fs from 'fs' ;
44import yaml from 'js-yaml' ;
55
6- try {
7- const doc = yaml . load ( fs . readFileSync ( './openapi.yaml' , 'utf8' ) ) ;
8- const tags = doc . tags . map ( ( tag ) => tag . name ) ;
6+ const doc = yaml . load ( fs . readFileSync ( './openapi.yaml' , 'utf8' ) ) ;
7+ const tags = doc . tags . map ( ( tag ) => tag . name ) ;
98
10- tags . forEach ( ( tag ) => {
9+ console . log ( tags ) ;
10+
11+ tags . forEach ( ( tag ) => {
12+ try {
1113 fs . writeFileSync (
1214 `./dist/${ tag } /package.json` ,
1315 `{
14- "module": "./${ tag } .js",
15- "main": "./${ tag } .cjs",
16- "types": "./${ tag } .d.ts",
17- "sideEffects": false,
18- "type": "module"
19- }` ,
20- ( err ) => {
21- throw err ;
22- } ,
16+ "module": "./${ tag } .js",
17+ "main": "./${ tag } .cjs",
18+ "types": "./${ tag } .d.ts",
19+ "sideEffects": false,
20+ "type": "module"
21+ }` ,
22+ ) ;
23+ } catch ( err ) {
24+ console . log (
25+ `Not created a package.json for ${ tag } . The folder might not have been created by orval.` ,
2326 ) ;
24- } ) ;
25- } catch ( e ) {
26- console . error ( e ) ;
27- }
27+ console . error ( err ) ;
28+ }
29+ } ) ;
You can’t perform that action at this time.
0 commit comments