diff --git a/frontend/packages/cli/cli.ts b/frontend/packages/cli/cli.ts index bbe3f240b8..e898e980cd 100644 --- a/frontend/packages/cli/cli.ts +++ b/frontend/packages/cli/cli.ts @@ -13,6 +13,13 @@ function computeTargetFilename() { return "rivet-cli"; } -execFileSync(join(__dirname, computeTargetFilename()), process.argv.slice(2), { - stdio: "inherit", -}); +try { + execFileSync(join(__dirname, computeTargetFilename()), process.argv.slice(2), { + stdio: "inherit", + }); +} catch (error) { + if (error.status) { + process.exit(error.status); + } + throw error; +} diff --git a/frontend/packages/cli/package.json b/frontend/packages/cli/package.json index 10fc68dd52..590469a25f 100644 --- a/frontend/packages/cli/package.json +++ b/frontend/packages/cli/package.json @@ -1,5 +1,5 @@ { - "name": "@rivet-gg/cli", + "name": "rivet-cli", "repository": { "type": "git", "url": "https://github.com/rivet-gg/rivet.git", diff --git a/frontend/packages/cli/postinstall.ts b/frontend/packages/cli/postinstall.ts index 881a67657d..b20278d75d 100644 --- a/frontend/packages/cli/postinstall.ts +++ b/frontend/packages/cli/postinstall.ts @@ -20,18 +20,18 @@ const arch = os.arch(); function computeBinaryFilename() { if (platform === "linux") { - return "rivet-x86-linux"; + return "rivet-x86_64-unknown-linux-musl"; } if (platform === "darwin") { if (arch === "arm64") { - return "rivet-aarch64-mac"; + return "rivet-aarch64-apple-darwin"; } - return "rivet-x86-mac"; + return "rivet-x86_64-apple-darwin"; } if (platform === "win32") { - return "rivet-x86-windows.exe"; + return "rivet-x86_64-pc-windows-gnu.exe"; } throw new Error(`unsupported platform ${process.platform}`); @@ -55,7 +55,7 @@ function isYarn(): boolean { /** * - * @see https://github.com/evanw/esbuild/blob/main/lib/npm/node-install.ts#L171 + * @see https://github.com/evanw/esbuild/blob/f4159a7b823cd5fe2217da2c30e8873d2f319667/lib/npm/node-install.ts#L171 */ function maybeOptimizePackage(binPath: string, toPath: string): void { if (platform !== "win32" && !isYarn()) { @@ -72,7 +72,13 @@ function maybeOptimizePackage(binPath: string, toPath: string): void { async function download(version: string) { const binaryFilename = computeBinaryFilename(); - const response = await fetch(artifactUrl(version, binaryFilename)); + const url = artifactUrl(version, binaryFilename); + + console.log(`Downloading Rivet CLI ${version} for ${platform}-${arch}`); + console.log(`Binary: ${binaryFilename}`); + console.log(`URL: ${url}`); + + const response = await fetch(url); if (!response.ok) { throw new Error(`unexpected response ${response.statusText}`); @@ -105,16 +111,22 @@ async function download(version: string) { } async function main() { + console.log("Starting Rivet CLI installation..."); + try { await fs.promises.rm(RIVET_CLI_BINARY_PATH); + console.log("Cleaned up existing binary"); } catch {} await download(pkgJson.version); + console.log("Download completed"); maybeOptimizePackage(RIVET_CLI_BINARY_PATH, RIVET_CLI_NODE_PATH); + console.log("Package optimization completed"); fs.chmodSync(RIVET_CLI_NODE_PATH, 0o755); fs.chmodSync(RIVET_CLI_BINARY_PATH, 0o755); + console.log("Permissions set"); } main() diff --git a/scripts/release/sdk.ts b/scripts/release/sdk.ts index 925fb1ee19..09ffbfe567 100644 --- a/scripts/release/sdk.ts +++ b/scripts/release/sdk.ts @@ -63,7 +63,7 @@ export async function publishSdk(opts: ReleaseOpts) { { path: `${opts.root}/frontend/packages/cli`, - name: "@rivet-gg/cli", + name: "rivet-cli", //jsr: true, npm: true, turbo: true diff --git a/scripts/release/static/install.ps1 b/scripts/release/static/install.ps1 index 4710329646..cf51da8d60 100644 --- a/scripts/release/static/install.ps1 +++ b/scripts/release/static/install.ps1 @@ -18,7 +18,7 @@ if (!(Test-Path $RivetInstall)) { $RivetExe = "$RivetInstall\rivet.exe" $Version = '__VERSION__' -$FileName = 'rivet-x86-windows.exe' +$FileName = 'rivet-x86_64-pc-windows-gnu.exe' Write-Host Write-Host "> Installing Rivet CLI ${Version}" diff --git a/scripts/release/static/install.sh b/scripts/release/static/install.sh index bdcd9ce3de..6702aca074 100644 --- a/scripts/release/static/install.sh +++ b/scripts/release/static/install.sh @@ -21,9 +21,9 @@ if [ "$(printf '%s' "$UNAME" | cut -c 1-6)" = "Darwin" ]; then echo "> Detected macOS" if [ "$ARCH" = "x86_64" ]; then - FILE_NAME="rivet-x86-mac" + FILE_NAME="rivet-x86_64-apple-darwin" elif [ "$ARCH" = "arm64" ]; then - FILE_NAME="rivet-aarch64-mac" + FILE_NAME="rivet-aarch64-apple-darwin" else echo "Unknown arch $ARCH" 1>&2 exit 1 @@ -32,7 +32,7 @@ elif [ "$(printf '%s' "$UNAME" | cut -c 1-5)" = "Linux" ]; then echo echo "> Detected Linux ($(getconf LONG_BIT) bit)" - FILE_NAME="rivet-x86-linux" + FILE_NAME="rivet-x86_64-unknown-linux-musl" else echo "Unable to determine platform" 1>&2 exit 1 diff --git a/yarn.lock b/yarn.lock index aa783f2f54..12e833c7bc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2117,7 +2117,7 @@ __metadata: languageName: node linkType: hard -"@hono/node-server@npm:^1.13.8, @hono/node-server@npm:^1.8.2": +"@hono/node-server@npm:^1.13.8": version: 1.14.3 resolution: "@hono/node-server@npm:1.14.3" peerDependencies: @@ -4933,18 +4933,6 @@ __metadata: languageName: unknown linkType: soft -"@rivet-gg/cli@workspace:frontend/packages/cli": - version: 0.0.0-use.local - resolution: "@rivet-gg/cli@workspace:frontend/packages/cli" - dependencies: - "@types/node": "npm:^22.13.4" - tsup: "npm:^8.3.6" - bin: - rivet: dist/cli.js - rivet-cli: dist/cli.js - languageName: unknown - linkType: soft - "@rivet-gg/components@workspace:*, @rivet-gg/components@workspace:frontend/packages/components": version: 0.0.0-use.local resolution: "@rivet-gg/components@workspace:frontend/packages/components" @@ -12065,7 +12053,7 @@ __metadata: languageName: node linkType: hard -"hono@npm:^4.6.16, hono@npm:^4.6.17, hono@npm:^4.7.0, hono@npm:^4.7.2": +"hono@npm:^4.6.16, hono@npm:^4.6.17, hono@npm:^4.7.0": version: 4.7.10 resolution: "hono@npm:4.7.10" checksum: 10c0/985aadcccb323fee7012f7c38e58b85332b1370a5ae69649ed29ae538a57cd4233f6198c54cc1fe3716b6b9ab20f8c7518d71027d7c46003c2d2ce982ce37c48 @@ -14356,17 +14344,6 @@ __metadata: languageName: node linkType: hard -"monitor-betterstack@workspace:examples/monitor-betterstack": - version: 0.0.0-use.local - resolution: "monitor-betterstack@workspace:examples/monitor-betterstack" - dependencies: - "@hono/node-server": "npm:^1.8.2" - "@rivet-gg/api": "npm:^24.6.2" - hono: "npm:^4.7.2" - readline: "npm:^1.3.0" - languageName: unknown - linkType: soft - "motion-dom@npm:^11.18.1": version: 11.18.1 resolution: "motion-dom@npm:11.18.1" @@ -16050,13 +16027,6 @@ __metadata: languageName: node linkType: hard -"readline@npm:^1.3.0": - version: 1.3.0 - resolution: "readline@npm:1.3.0" - checksum: 10c0/7404c9edc3fd29430221ef1830867c8d87e50612e4ce70f84ecd55686f7db1c81d67c6a4dcb407839f4c459ad05dd34524a2c7a97681e91878367c68d0e38665 - languageName: node - linkType: hard - "recharts-scale@npm:^0.4.4": version: 0.4.5 resolution: "recharts-scale@npm:0.4.5" @@ -16513,6 +16483,18 @@ __metadata: languageName: node linkType: hard +"rivet-cli@workspace:frontend/packages/cli": + version: 0.0.0-use.local + resolution: "rivet-cli@workspace:frontend/packages/cli" + dependencies: + "@types/node": "npm:^22.13.4" + tsup: "npm:^8.3.6" + bin: + rivet: dist/cli.js + rivet-cli: dist/cli.js + languageName: unknown + linkType: soft + "rivet-site@workspace:site": version: 0.0.0-use.local resolution: "rivet-site@workspace:site"