Skip to content
Closed
Show file tree
Hide file tree
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
13 changes: 10 additions & 3 deletions frontend/packages/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion frontend/packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@rivet-gg/cli",
"name": "rivet-cli",
"repository": {
"type": "git",
"url": "https://github.com/rivet-gg/rivet.git",
Expand Down
24 changes: 18 additions & 6 deletions frontend/packages/cli/postinstall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand All @@ -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()) {
Expand All @@ -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}`);
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion scripts/release/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scripts/release/static/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
6 changes: 3 additions & 3 deletions scripts/release/static/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
46 changes: 14 additions & 32 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
Loading