mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-15 06:04:43 +00:00
fix: fix bun install bug (#62)
* fix: fix bun install bug * refactor: consolidate executable check into assertExecutable helper - Add assertExecutable() to cli-shared that checks and attempts chmod - Simplify CLI and SDK spawn code to use the shared helper - Fix cli-shared package.json exports (.js not .mjs) - Add global install instructions to SDK error message * chore(release): update version to 0.1.6-rc.1 * fix: add cli-shared package to Dockerfiles * chore(release): update version to 0.1.6-rc.1 * fix: add cli-shared publishing to release workflow * chore(release): update version to 0.1.6-rc.1 * fix: handle already-exists error during crate publish * chore(release): update version to 0.1.6-rc.1
This commit is contained in:
parent
24de9e686c
commit
02bb992b11
30 changed files with 467 additions and 44 deletions
|
|
@ -13,7 +13,7 @@ import {
|
|||
createGitHubRelease,
|
||||
validateGit,
|
||||
} from "./git";
|
||||
import { publishCrates, publishNpmCli, publishNpmSdk } from "./sdk";
|
||||
import { publishCrates, publishNpmCli, publishNpmCliShared, publishNpmSdk } from "./sdk";
|
||||
import { updateVersion } from "./update_version";
|
||||
import { assert, assertEquals, fetchGitRef, versionOrCommitToRef } from "./utils";
|
||||
|
||||
|
|
@ -281,6 +281,7 @@ const STEPS = [
|
|||
"run-ci-checks",
|
||||
"build-js-artifacts",
|
||||
"publish-crates",
|
||||
"publish-npm-cli-shared",
|
||||
"publish-npm-sdk",
|
||||
"publish-npm-cli",
|
||||
"tag-docker",
|
||||
|
|
@ -322,6 +323,7 @@ const PHASE_MAP: Record<Phase, Step[]> = {
|
|||
"complete-ci": [
|
||||
"update-version",
|
||||
"publish-crates",
|
||||
"publish-npm-cli-shared",
|
||||
"publish-npm-sdk",
|
||||
"publish-npm-cli",
|
||||
"tag-docker",
|
||||
|
|
@ -595,6 +597,11 @@ async function main() {
|
|||
await publishCrates(releaseOpts);
|
||||
}
|
||||
|
||||
if (shouldRunStep("publish-npm-cli-shared")) {
|
||||
console.log("==> Publishing NPM CLI Shared");
|
||||
await publishNpmCliShared(releaseOpts);
|
||||
}
|
||||
|
||||
if (shouldRunStep("publish-npm-sdk")) {
|
||||
console.log("==> Publishing NPM SDK");
|
||||
await publishNpmSdk(releaseOpts);
|
||||
|
|
|
|||
|
|
@ -116,12 +116,21 @@ export async function publishCrates(opts: ReleaseOpts) {
|
|||
|
||||
try {
|
||||
await $({
|
||||
stdio: "inherit",
|
||||
stdout: "pipe",
|
||||
stderr: "pipe",
|
||||
cwd: cratePath,
|
||||
})`cargo publish --allow-dirty --no-verify`;
|
||||
console.log(`✅ Published ${crateName}@${opts.version}`);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
// Check if error is because crate already exists (from a previous partial run)
|
||||
if (err.stderr?.includes("already exists")) {
|
||||
console.log(
|
||||
`Version ${opts.version} of ${crateName} already exists on crates.io. Skipping...`,
|
||||
);
|
||||
continue;
|
||||
}
|
||||
console.error(`❌ Failed to publish ${crateName}`);
|
||||
console.error(err.stderr || err.message);
|
||||
throw err;
|
||||
}
|
||||
|
||||
|
|
@ -133,6 +142,43 @@ export async function publishCrates(opts: ReleaseOpts) {
|
|||
console.log("✅ All crates published");
|
||||
}
|
||||
|
||||
export async function publishNpmCliShared(opts: ReleaseOpts) {
|
||||
const cliSharedPath = join(opts.root, "sdks/cli-shared");
|
||||
const packageJsonPath = join(cliSharedPath, "package.json");
|
||||
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf-8"));
|
||||
const name = packageJson.name;
|
||||
|
||||
// Check if version already exists
|
||||
const versionExists = await npmVersionExists(name, opts.version);
|
||||
if (versionExists) {
|
||||
console.log(
|
||||
`Version ${opts.version} of ${name} already exists. Skipping...`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Build cli-shared
|
||||
console.log(`==> Building @sandbox-agent/cli-shared`);
|
||||
await $({
|
||||
stdio: "inherit",
|
||||
cwd: opts.root,
|
||||
})`pnpm --filter @sandbox-agent/cli-shared build`;
|
||||
|
||||
// Publish
|
||||
console.log(`==> Publishing to NPM: ${name}@${opts.version}`);
|
||||
|
||||
// Add --tag flag for release candidates
|
||||
const isReleaseCandidate = opts.version.includes("-rc.");
|
||||
const tag = isReleaseCandidate ? "rc" : "latest";
|
||||
|
||||
await $({
|
||||
stdio: "inherit",
|
||||
cwd: cliSharedPath,
|
||||
})`pnpm publish --access public --tag ${tag} --no-git-checks`;
|
||||
|
||||
console.log(`✅ Published ${name}@${opts.version}`);
|
||||
}
|
||||
|
||||
export async function publishNpmSdk(opts: ReleaseOpts) {
|
||||
const sdkPath = join(opts.root, "sdks/typescript");
|
||||
const packageJsonPath = join(sdkPath, "package.json");
|
||||
|
|
@ -148,7 +194,7 @@ export async function publishNpmSdk(opts: ReleaseOpts) {
|
|||
return;
|
||||
}
|
||||
|
||||
// Build the SDK
|
||||
// Build the SDK (cli-shared should already be built by publishNpmCliShared)
|
||||
console.log(`==> Building TypeScript SDK`);
|
||||
await $({
|
||||
stdio: "inherit",
|
||||
|
|
|
|||
|
|
@ -17,6 +17,11 @@ export async function updateVersion(opts: ReleaseOpts) {
|
|||
find: /\[workspace\.package\]\nversion = ".*"/,
|
||||
replace: `[workspace.package]\nversion = "${opts.version}"`,
|
||||
},
|
||||
{
|
||||
path: "sdks/cli-shared/package.json",
|
||||
find: /"version": ".*"/,
|
||||
replace: `"version": "${opts.version}"`,
|
||||
},
|
||||
{
|
||||
path: "sdks/typescript/package.json",
|
||||
find: /"version": ".*"/,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue