mirror of
https://github.com/kamranahmedse/driver.js.git
synced 2026-10-31 20:31:43 +08:00
- 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
28 lines
640 B
JavaScript
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());
|