Configure lefthook formatter checks (#231)

* Add lefthook formatter checks

* Fix SDK mode hydration

* Stabilize SDK mode integration test
This commit is contained in:
Nathan Flurry 2026-03-10 23:03:11 -07:00 committed by GitHub
parent 0471214d65
commit d2346bafb3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
282 changed files with 5840 additions and 8399 deletions

View file

@ -2,83 +2,75 @@ import { $ } from "execa";
import type { ReleaseOpts } from "./main";
export async function validateGit(_opts: ReleaseOpts) {
// Validate there's no uncommitted changes
const result = await $`git status --porcelain`;
const status = result.stdout;
if (status.trim().length > 0) {
throw new Error(
"There are uncommitted changes. Please commit or stash them.",
);
}
// Validate there's no uncommitted changes
const result = await $`git status --porcelain`;
const status = result.stdout;
if (status.trim().length > 0) {
throw new Error("There are uncommitted changes. Please commit or stash them.");
}
}
export async function createAndPushTag(opts: ReleaseOpts) {
console.log(`Creating tag v${opts.version}...`);
try {
// Create tag and force update if it exists
await $({ stdio: "inherit", cwd: opts.root })`git tag -f v${opts.version}`;
console.log(`Creating tag v${opts.version}...`);
try {
// Create tag and force update if it exists
await $({ stdio: "inherit", cwd: opts.root })`git tag -f v${opts.version}`;
// Push tag with force to ensure it's updated
await $({ stdio: "inherit", cwd: opts.root })`git push origin v${opts.version} -f`;
// Push tag with force to ensure it's updated
await $({ stdio: "inherit", cwd: opts.root })`git push origin v${opts.version} -f`;
console.log(`✅ Tag v${opts.version} created and pushed`);
} catch (err) {
console.error("❌ Failed to create or push tag");
throw err;
}
console.log(`✅ Tag v${opts.version} created and pushed`);
} catch (err) {
console.error("❌ Failed to create or push tag");
throw err;
}
}
export async function createGitHubRelease(opts: ReleaseOpts) {
console.log("Creating GitHub release...");
console.log("Creating GitHub release...");
try {
// Get the current tag name (should be the tag created during the release process)
const { stdout: currentTag } = await $({
cwd: opts.root,
})`git describe --tags --exact-match`;
const tagName = currentTag.trim();
try {
// Get the current tag name (should be the tag created during the release process)
const { stdout: currentTag } = await $({
cwd: opts.root,
})`git describe --tags --exact-match`;
const tagName = currentTag.trim();
console.log(`Looking for existing release for ${opts.version}`);
console.log(`Looking for existing release for ${opts.version}`);
// Check if a release with this version name already exists
const { stdout: releaseJson } = await $({
cwd: opts.root,
})`gh release list --json name,tagName`;
const releases = JSON.parse(releaseJson);
const existingRelease = releases.find(
(r: any) => r.name === opts.version,
);
// Check if a release with this version name already exists
const { stdout: releaseJson } = await $({
cwd: opts.root,
})`gh release list --json name,tagName`;
const releases = JSON.parse(releaseJson);
const existingRelease = releases.find((r: any) => r.name === opts.version);
if (existingRelease) {
console.log(
`Updating release ${opts.version} to point to new tag ${tagName}`,
);
await $({
stdio: "inherit",
cwd: opts.root,
})`gh release edit ${existingRelease.tagName} --tag ${tagName}`;
} else {
console.log(
`Creating new release ${opts.version} pointing to tag ${tagName}`,
);
await $({
stdio: "inherit",
cwd: opts.root,
})`gh release create ${tagName} --title ${opts.version} --generate-notes`;
if (existingRelease) {
console.log(`Updating release ${opts.version} to point to new tag ${tagName}`);
await $({
stdio: "inherit",
cwd: opts.root,
})`gh release edit ${existingRelease.tagName} --tag ${tagName}`;
} else {
console.log(`Creating new release ${opts.version} pointing to tag ${tagName}`);
await $({
stdio: "inherit",
cwd: opts.root,
})`gh release create ${tagName} --title ${opts.version} --generate-notes`;
// Check if this is a pre-release (contains -rc. or similar)
if (opts.version.includes("-")) {
await $({
stdio: "inherit",
cwd: opts.root,
})`gh release edit ${tagName} --prerelease`;
}
}
// Check if this is a pre-release (contains -rc. or similar)
if (opts.version.includes("-")) {
await $({
stdio: "inherit",
cwd: opts.root,
})`gh release edit ${tagName} --prerelease`;
}
}
console.log("✅ GitHub release created/updated");
} catch (err) {
console.error("❌ Failed to create GitHub release");
console.warn("! You may need to create the release manually");
throw err;
}
console.log("✅ GitHub release created/updated");
} catch (err) {
console.error("❌ Failed to create GitHub release");
console.warn("! You may need to create the release manually");
throw err;
}
}