Files
driver.js/scripts/changelog-notes.mjs
T
Kamran Ahmed 2088df4a90 Switch release tooling from np to release-it
- Tag and commit use the unreleased version with no v prefix
- Move changelog Unreleased entries under the version on bump
- GitHub release notes are pulled from the changelog section
2026-06-25 18:07:16 +01:00

28 lines
640 B
JavaScript

import { readFileSync } from "node:fs";
const version = process.argv[2];
if (!version) {
process.exit(0);
}
const file = new URL(
"../docs/src/content/guides/changelog.mdx",
import.meta.url,
);
const content = readFileSync(file, "utf8");
const heading = `## ${version}`;
const headingIndex = content.indexOf(heading);
if (headingIndex === -1) {
process.exit(0);
}
const afterHeading = headingIndex + heading.length;
const nextHeadingIndex = content.indexOf("\n## ", afterHeading);
const section = content.slice(
afterHeading,
nextHeadingIndex === -1 ? undefined : nextHeadingIndex,
);
process.stdout.write(section.trim());