Files
copilotkit__copilotkit/scripts/release/bump-prerelease.ts
Tyler Slaton fe685eb46f feat(release): npm release scopes for bot(+bot-ui) and bot-slack
- release.config.json: 'bot' scope versions @copilotkit/bot and
  @copilotkit/bot-ui together (sharedVersion: true, source: bot);
  'bot-slack' is its own scope, mirroring the angular precedent
- ReleaseScope type + VALID_SCOPES arrays + usage strings extended across
  release scripts
- stable-release.yml / publish-release.yml: scope choice options
- bot, bot-ui, bot-slack manifests: drop private, add publishConfig (public),
  repository/homepage/keywords, publint/attw targets; first release v0.0.1
- internal bot-package deps use workspace:~ (tilde): caret on a 0.0.x version
  pins the exact patch, tilde tracks the 0.0.x line; core/shared stay
  workspace:^ (caret is correct at 1.x)

Verified: release-script tests 85/85; prepare-release --scope bot --dry-run
bumps bot AND bot-ui in lockstep; actionlint clean on touched lines.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 12:57:13 -07:00

56 lines
1.9 KiB
TypeScript

/**
* Bump package versions for a prerelease (runs in the secrets-free build job).
*
* This is extracted from prerelease.ts so that version bumping happens before
* the build, in a job that has no access to NPM_TOKEN or other publish secrets.
* The publish job then receives pre-built, correctly-versioned artifacts.
*
* Usage: tsx scripts/release/bump-prerelease.ts --scope <scope from release.config.json> [--suffix <label>]
*/
import {
getCurrentVersion,
computePrereleaseVersion,
bumpPackages,
getPackagesForScope,
} from "./lib/versions.js";
import { loadConfig, type ReleaseScope } from "./lib/config.js";
// Valid scopes come from release.config.json — the single source of truth.
const VALID_SCOPES = Object.keys(loadConfig().scopes);
function main() {
const argv = process.argv.slice(2);
const suffixIdx = argv.indexOf("--suffix");
const suffix = suffixIdx !== -1 ? argv[suffixIdx + 1] : undefined;
const scopeIdx = argv.indexOf("--scope");
const scope = (
scopeIdx !== -1 ? argv[scopeIdx + 1] : null
) as ReleaseScope | null;
if (!scope || !VALID_SCOPES.includes(scope)) {
console.error(
`Usage: bump-prerelease.ts --scope <${VALID_SCOPES.join("|")}> [--suffix <label>]`,
);
process.exit(1);
}
const config = loadConfig();
const distTag = config.prereleaseTag;
const currentVersion = getCurrentVersion(scope);
const prereleaseVersion = computePrereleaseVersion(currentVersion, suffix);
console.log(`Scope: ${scope}`);
console.log(`Current version: ${currentVersion}`);
console.log(`Prerelease version: ${prereleaseVersion}`);
console.log(`Dist tag: ${distTag}`);
// Bump versions in working directory (no commit)
const updated = bumpPackages(scope, prereleaseVersion);
console.log(`\nBumped ${updated.length} packages to ${prereleaseVersion}`);
for (const p of updated) {
console.log(` ${p.name}: ${p.oldVersion} -> ${p.newVersion}`);
}
}
main();