Skip to content

Commit ef5d71b

Browse files
committed
chore(release): release npm packages
1 parent ed56475 commit ef5d71b

File tree

17 files changed

+112
-354
lines changed

17 files changed

+112
-354
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ resolver = "2"
44
members = ["packages/common/api-builder","packages/common/api-types","packages/common/api-util","packages/common/cache/build","packages/common/cache/result","packages/common/clickhouse-inserter","packages/common/clickhouse-user-query","packages/common/config","packages/common/env","packages/common/error/core","packages/common/error/macros","packages/common/gasoline/core","packages/common/gasoline/macros","packages/common/logs","packages/common/metrics","packages/common/pools","packages/common/runtime","packages/common/service-manager","packages/common/telemetry","packages/common/test-deps","packages/common/test-deps-docker","packages/common/types","packages/common/universaldb","packages/common/universalpubsub","packages/common/util/core","packages/common/util/id","packages/common/versioned-data-util","packages/core/actor-kv","packages/core/api-peer","packages/core/api-public","packages/core/bootstrap","packages/core/dump-openapi","packages/core/guard/core","packages/core/guard/server","packages/core/pegboard-gateway","packages/core/pegboard-runner-ws","packages/core/pegboard-serverless","packages/core/pegboard-tunnel","packages/core/workflow-worker","packages/infra/engine","packages/services/epoxy","packages/services/internal","packages/services/namespace","packages/services/pegboard","sdks/rust/api-full","sdks/rust/bare_gen","sdks/rust/data","sdks/rust/epoxy-protocol","sdks/rust/runner-protocol","sdks/rust/tunnel-protocol","sdks/rust/ups-protocol"]
55

66
[workspace.package]
7-
version = "25.7.1"
7+
version = "25.7.1-rc.1"
88
edition = "2024"
99
authors = ["Rivet Gaming, LLC <[email protected]>"]
1010
license = "Apache-2.0"

frontend/packages/components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@rivet-gg/components",
33
"private": true,
4-
"version": "25.7.1",
4+
"version": "25.7.1-rc.1",
55
"type": "module",
66
"files": [
77
"dist",

frontend/packages/icons/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rivet-gg/icons",
3-
"version": "25.7.1",
3+
"version": "25.7.1-rc.1",
44
"sideEffects": false,
55
"files": [
66
"scripts",

scripts/release/artifacts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ReleaseOpts } from "./main.ts";
1+
import type { ReleaseOpts } from "./main";
22
import { $ } from "execa";
33
import * as path from "node:path";
44
import * as fs from "node:fs/promises";

scripts/release/git.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ReleaseOpts } from "./main.ts";
1+
import type { ReleaseOpts } from "./main";
22
import { $ } from "execa";
33

44
export async function validateGit(_opts: ReleaseOpts) {

scripts/release/main.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import * as fs from "node:fs";
55
import * as url from "node:url";
66
import minimist from "minimist";
77
import { $ } from "execa";
8-
import { publishSdk } from "./sdk.ts";
9-
import { updateVersion } from "./update_version.ts";
10-
import { configureReleasePlease } from "./release_please.ts";
11-
import { validateGit } from "./git.ts";
12-
import { tagDocker } from "./docker.ts";
13-
import { updateArtifacts } from "./artifacts.ts";
8+
import { publishSdk } from "./sdk";
9+
import { updateVersion } from "./update_version";
10+
import { configureReleasePlease } from "./release_please";
11+
import { validateGit } from "./git";
12+
import { tagDocker } from "./docker";
13+
import { updateArtifacts } from "./artifacts";
1414

1515
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
1616
const ROOT_DIR = path.resolve(__dirname, "..", "..");
@@ -68,7 +68,6 @@ async function main() {
6868
"setupCi", // Publishes packages (has access to NPM creds)
6969
"completeCi", // Tags binaries & Docker as latest (has access to Docker & S3 creds)
7070
],
71-
negatable: ["latest"],
7271
string: ["version", "commit"],
7372
default: {
7473
latest: true,
@@ -149,11 +148,10 @@ async function main() {
149148
}
150149
}
151150

152-
// TODO: Currently using pkg.pr.new
153-
// if (args.publishSdk || args.setupCi) {
154-
// console.log("==> Publishing SDKs");
155-
// await publishSdk(opts);
156-
// }
151+
if (args.publishSdk || args.setupCi) {
152+
console.log("==> Publishing SDKs");
153+
await publishSdk(opts);
154+
}
157155

158156
if (args.tagDocker || args.completeCi) {
159157
console.log("==> Tagging Docker");

scripts/release/release_please.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ReleaseOpts } from "./main.ts";
1+
import type { ReleaseOpts } from "./main";
22
import { $ } from "execa";
33

44
export async function configureReleasePlease(opts: ReleaseOpts) {

scripts/release/sdk.ts

Lines changed: 39 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,70 @@
1-
import type { ReleaseOpts } from "./main.ts";
1+
import type { ReleaseOpts } from "./main";
22
import { $ } from "execa";
3-
import { transformPackageJsonToDenoJson } from "./transform_pkg_to_deno.ts";
4-
5-
function assertStringIncludes(actual: string, expected: string, message?: string): void {
6-
if (!actual.includes(expected)) {
7-
throw new Error(message || `String does not include expected substring: ${expected}`);
8-
}
9-
}
3+
import { readFile } from "fs/promises";
4+
import { join } from "path";
105

116
async function npmVersionExists(
127
packageName: string,
138
version: string,
149
): Promise<boolean> {
15-
console.log(`==> Checking if NPM version exists: ${packageName}@${version}`);
10+
console.log(
11+
`==> Checking if NPM version exists: ${packageName}@${version}`,
12+
);
1613
try {
17-
await $({ stdout: 'ignore', stderr: 'pipe' })`npm view ${packageName}@${version} version`;
14+
await $({
15+
stdout: "ignore",
16+
stderr: "pipe",
17+
})`npm view ${packageName}@${version} version`;
1818
return true;
1919
} catch (error: any) {
2020
if (error.stderr) {
21-
assertStringIncludes(
22-
error.stderr,
23-
`No match found for version ${version}`,
24-
"unexpected output",
25-
);
26-
}
27-
return false;
28-
}
29-
}
30-
31-
async function jsrVersionExists(
32-
packageName: string,
33-
version: string,
34-
): Promise<boolean> {
35-
console.log(`==> Checking if JSR version exists: ${packageName}@${version}`);
36-
try {
37-
await $({ stdout: 'ignore', stderr: 'pipe' })`deno info jsr:${packageName}@${version}`;
38-
return true;
39-
} catch (error: any) {
40-
if (error.stderr) {
41-
assertStringIncludes(
42-
error.stderr,
43-
`Could not find version of '${packageName}' that matches specified version constraint '${version}'`,
44-
"unexpected output",
45-
);
21+
if (
22+
!error.stderr.includes(
23+
`No match found for version ${version}`,
24+
) &&
25+
!error.stderr.includes(
26+
`'${packageName}@${version}' is not in this registry.`,
27+
)
28+
) {
29+
throw new Error(
30+
`unexpected npm view version output: ${error.stderr}`,
31+
);
32+
}
4633
}
4734
return false;
4835
}
4936
}
5037

5138
export async function publishSdk(opts: ReleaseOpts) {
52-
const packages: { path: string, name: string, npm: boolean, jsr?: boolean, turbo?: boolean }[] = [
53-
{
54-
path: `${opts.root}/sdks/typescript/api-full`,
55-
name: "@rivet-gg/api-full",
56-
npm: true,
57-
},
39+
const packagePaths = [
40+
`${opts.root}/sdks/typescript/tunnel-protocol`,
41+
`${opts.root}/sdks/typescript/runner`,
42+
`${opts.root}/sdks/typescript/runner-protocol`,
43+
`${opts.root}/sdks/typescript/api-full`,
5844
];
5945

60-
for (const pkg of packages) {
61-
if (pkg.turbo) {
62-
await $`pnpm build --filter ${pkg.name}`;
63-
}
46+
for (const path of packagePaths) {
47+
// Read package.json to get the name
48+
const packageJsonPath = join(path, "package.json");
49+
const packageJson = JSON.parse(await readFile(packageJsonPath, "utf-8"));
50+
const name = packageJson.name;
6451

6552
// Check if version already exists
6653
let versionExists = false;
67-
if (pkg.npm) {
68-
versionExists = await npmVersionExists(pkg.name, opts.version);
69-
} else if (pkg.jsr) {
70-
versionExists = await jsrVersionExists(pkg.name, opts.version);
71-
}
54+
versionExists = await npmVersionExists(name, opts.version);
7255

7356
if (versionExists) {
7457
console.log(
75-
`Version ${opts.version} of ${pkg.name} already exists. Skipping...`,
58+
`Version ${opts.version} of ${name} already exists. Skipping...`,
7659
);
7760
continue;
7861
}
7962

8063
// Publish
81-
if (pkg.npm) {
82-
console.log(`==> Publishing to NPM: ${pkg.name}@${opts.version}`);
83-
await $({ cwd: pkg.path })`pnpm install`;
84-
await $({ cwd: pkg.path })`pnpm npm publish --access public --tolerate-republish`;
85-
}
86-
87-
if (pkg.jsr) {
88-
console.log(`==> Publishing to JSR: ${pkg.name}@${opts.version}`);
89-
90-
// TODO(https://github.com/denoland/deno/issues/27428): `--set-version` not working, so we have to manually update `jsr.jsonc`
91-
92-
await transformPackageJsonToDenoJson({
93-
cwd: pkg.path,
94-
skipPathInInternalPackages: "src",
95-
internalPackagesLinkPath: "internal",
96-
});
97-
98-
// TODO: Auto-populate token here
99-
// --allow-slow-types = we use zod which doesn't support this
100-
// --allow-dirty = we change the version on the fly
101-
// --set-version = validate the correct version is used
102-
await $({ cwd: pkg.path, env: { DENO_NO_PACKAGE_JSON: '1' } })`deno publish --allow-slow-types --allow-dirty`;
103-
}
64+
console.log(`==> Publishing to NPM: ${name}@${opts.version}`);
65+
await $({ cwd: path })`pnpm install`;
66+
await $({
67+
cwd: path,
68+
})`pnpm npm publish --access public --tolerate-republish`;
10469
}
10570
}

0 commit comments

Comments
 (0)