Skip to content

Update check-is-release.ts #440

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions scripts/check-is-release.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
import getReleasePlan from '@changesets/get-release-plan';

/** Check if a "next" / development release is necessary based on the presence of changesets */
/**
* Checks if a "next" or development release is necessary based on the presence of changesets.
* Outputs "true" or "false" to stdout.
*/
async function checkIsRelease() {
const releasePlan = await getReleasePlan(process.cwd());
const currentDir = process.cwd();
const packageJsonPath = `${currentDir}/cli/package.json`;

try {
const packageJson = await Bun.file(process.cwd() + '/cli/package.json').json();
const newNextVersion = releasePlan.releases.find((release) => release.name === packageJson.name)?.newVersion;
const releasePlan = await getReleasePlan(currentDir);
const packageJson = await Bun.file(packageJsonPath).json();

if (newNextVersion == null) {
await Bun.write(Bun.stdout, 'false\n');
} else {
await Bun.write(Bun.stdout, 'true\n');
}
const newNextVersion = releasePlan?.releases?.find(
(release) => release.name === packageJson.name
)?.newVersion;

await Bun.write(Bun.stdout, `${newNextVersion != null}\n`);
} catch (error) {
console.log(error);
console.error('Error during release check:', error);
process.exit(1);
}
}

// Run the release check
await checkIsRelease();