Skip to content

Commit 479900f

Browse files
committed
fix: fix generation of tags when a tag is not created becayse it is empty
this caused a crash previously
1 parent 839c76b commit 479900f

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

setup-entrypoints.js

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,27 @@
33
import fs from 'fs';
44
import 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+
});

0 commit comments

Comments
 (0)