Skip to content

Commit

Permalink
fix slug creations
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbashir committed Dec 19, 2023
1 parent 06b3cad commit c3d9aee
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions packages/releases-generator/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ const packages = [
},
];

// FIXME: starlight apparently doesn't work well if the file continas multiple `.`
function encodeVersion(v: string): string {
return v.replaceAll('.', '_');
}

const baseDir = '../../src/content/docs/releases';

async function generator() {
Expand All @@ -59,15 +54,15 @@ async function generator() {
mkdirSync(join(baseDir, pkg.name), { recursive: true });
writeFileSync(
join(baseDir, pkg.name, 'index.md'),
`---\ntitle: '${pkg.name}'\nslug: '${pkg.name}'\ntemplate: splash\n---\n\n${releases
.map((r) => `- [${r.version}](/releases/${pkg.name}/v${encodeVersion(r.version)})`)
`---\ntitle: '${pkg.name}'\nslug: 'releases/${pkg.name}'\ntemplate: splash\n---\n\n${releases
.map((r) => `- [${r.version}](/releases/${pkg.name}/v${r.version})`)
.join('\n')}`
);

for (const release of releases) {
writeFileSync(
join(baseDir, pkg.name, `v${release.version}.md`),
`---\ntitle: '${pkg.name}@${release.version}'\nslug: 'v${release.version}'\ntemplate: splash\n---\n\n${release.notes}`
`---\ntitle: '${pkg.name}@${release.version}'\nslug: 'releases/${pkg.name}/v${release.version}'\ntemplate: splash\n---\n\n${release.notes}`
);
}
}
Expand Down

0 comments on commit c3d9aee

Please sign in to comment.