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 3
3
import fs from 'fs' ;
4
4
import yaml from 'js-yaml' ;
5
5
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 ) ;
9
8
10
- tags . forEach ( ( tag ) => {
9
+ console . log ( tags ) ;
10
+
11
+ tags . forEach ( ( tag ) => {
12
+ try {
11
13
fs . writeFileSync (
12
14
`./dist/${ tag } /package.json` ,
13
15
`{
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.` ,
23
26
) ;
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