mirror of
https://github.com/kamranahmedse/driver.js.git
synced 2026-11-01 21:22:09 +08:00
packages/driver is the library (still published as driver.js, with repository.directory set); playground and docs move to apps/. One root pnpm workspace and lockfile replace the three standalone projects, with turbo orchestrating build/test/lint:package (apps depend on the library build; local + CI caching via .turbo). Apps keep importing the library from source for HMR — the aliases now point at ../../packages/driver/src and each app gains a workspace:* dependency so the task graph knows the edge. The dev-server fs scope widens to the repo root accordingly. Releases run from packages/driver (root `pnpm release` delegates). The changelog still lives in the docs app, so the release scripts reach it via ../../../apps/docs and the after:bump hook stages it explicitly — release-it no longer sits above both directories. The merged workspace settings keep sharp unbuilt on purpose (prebuilt binaries; building from source needs node-gyp and fails) — the docs app had this right and the playground setting was the accident. postcss and postcss-scss were unreferenced devDependencies and are dropped; prettier moves to the root as the only shared tool.
41 lines
1.1 KiB
JavaScript
41 lines
1.1 KiB
JavaScript
import { readFileSync, writeFileSync } from "node:fs";
|
|
|
|
const version = process.argv[2];
|
|
if (!version) {
|
|
console.error("Usage: changelog-release.mjs <version>");
|
|
process.exit(1);
|
|
}
|
|
|
|
const file = new URL(
|
|
"../../../apps/docs/src/content/guides/changelog.mdx",
|
|
import.meta.url,
|
|
);
|
|
const content = readFileSync(file, "utf8");
|
|
|
|
const heading = "## Unreleased";
|
|
const headingIndex = content.indexOf(heading);
|
|
if (headingIndex === -1) {
|
|
console.error('No "## Unreleased" heading found in changelog.');
|
|
process.exit(1);
|
|
}
|
|
|
|
const afterHeading = headingIndex + heading.length;
|
|
const nextHeadingIndex = content.indexOf("\n## ", afterHeading);
|
|
const section = content.slice(
|
|
afterHeading,
|
|
nextHeadingIndex === -1 ? undefined : nextHeadingIndex,
|
|
);
|
|
|
|
if (section.trim() === "") {
|
|
console.error("The Unreleased section is empty — nothing to release.");
|
|
process.exit(1);
|
|
}
|
|
|
|
const updated =
|
|
content.slice(0, afterHeading) +
|
|
`\n\n## ${version}` +
|
|
content.slice(afterHeading);
|
|
|
|
writeFileSync(file, updated);
|
|
console.log(`changelog: moved Unreleased entries under ${version}`);
|