Skip to content

Commit

Permalink
fix: fix generation of tags when a tag is not created becayse it is e…
Browse files Browse the repository at this point in the history
…mpty

this caused a crash previously
  • Loading branch information
OliverDudgeon committed Aug 12, 2024
1 parent 839c76b commit 479900f
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions setup-entrypoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,27 @@
import fs from 'fs';
import yaml from 'js-yaml';

try {
const doc = yaml.load(fs.readFileSync('./openapi.yaml', 'utf8'));
const tags = doc.tags.map((tag) => tag.name);
const doc = yaml.load(fs.readFileSync('./openapi.yaml', 'utf8'));
const tags = doc.tags.map((tag) => tag.name);

tags.forEach((tag) => {
console.log(tags);

tags.forEach((tag) => {
try {
fs.writeFileSync(
`./dist/${tag}/package.json`,
`{
"module": "./${tag}.js",
"main": "./${tag}.cjs",
"types": "./${tag}.d.ts",
"sideEffects": false,
"type": "module"
}`,
(err) => {
throw err;
},
"module": "./${tag}.js",
"main": "./${tag}.cjs",
"types": "./${tag}.d.ts",
"sideEffects": false,
"type": "module"
}`,
);
} catch (err) {
console.log(
`Not created a package.json for ${tag}. The folder might not have been created by orval.`,
);
});
} catch (e) {
console.error(e);
}
console.error(err);
}
});

0 comments on commit 479900f

Please sign in to comment.