History

Merge pull request #284 from RhysSullivan/worktree-publish-execution-cli

feat(release): publish execution, cli, and kernel packages to npm

Rhys Sullivan committed 6 months ago

Commit 599ae332 parents 96dc18a 905973b35 files · +772 −66Browse files

Showing the changes to scripts (1 of 35 files). Show all

Unified · Split

scripts/publish-packages.ts+11−8
@@ -38,7 +38,12 @@ const PUBLISHED_SCOPE = "@executor-js"; · 37 unmodified lines
38 * directory under `packages/plugins/` does not accidentally ship to npm.38 * directory under `packages/plugins/` does not accidentally ship to npm.
39 */39 */
40const PUBLIC_PACKAGE_DIRS = [40const PUBLIC_PACKAGE_DIRS = [
41 "packages/core/storage-core",
42 "packages/kernel/core",
43 "packages/kernel/runtime-quickjs",
41 "packages/core/sdk",44 "packages/core/sdk",
45 "packages/core/execution",
46 "packages/core/cli",
42 "packages/plugins/file-secrets",47 "packages/plugins/file-secrets",
43 "packages/plugins/google-discovery",48 "packages/plugins/google-discovery",
44 "packages/plugins/graphql",49 "packages/plugins/graphql",
@@ -267,13 +272,13 @@ const applyPublishConfig = async (pkgDir: string): Promise<() => Promise<void>> · 222 unmodified lines
267 272
268const publishPackage = async (273const publishPackage = async (
269 pkgDir: string,274 pkgDir: string,
270 channel: Channel,
271 dryRun: boolean,275 dryRun: boolean,
272 publishable: ReadonlySet<string>,276 publishable: ReadonlySet<string>,
273 publishableVersions: ReadonlyMap<string, string>,277 publishableVersions: ReadonlyMap<string, string>,
274) => {278) => {
275 const { name: internalName, version } = await readPackageMeta(pkgDir);279 const { name: internalName, version } = await readPackageMeta(pkgDir);
276 const publishedName = internalName.replace(`${INTERNAL_SCOPE}/`, `${PUBLISHED_SCOPE}/`);280 const publishedName = internalName.replace(`${INTERNAL_SCOPE}/`, `${PUBLISHED_SCOPE}/`);
281 const channel = resolveChannel(version);
277 282
278 if (!existsSync(join(pkgDir, "dist"))) {283 if (!existsSync(join(pkgDir, "dist"))) {
279 throw new Error(`Missing dist/ in ${pkgDir}. Did you run 'bun run build:packages'?`);284 throw new Error(`Missing dist/ in ${pkgDir}. Did you run 'bun run build:packages'?`);
@@ -326,12 +331,10 @@ const publishPackage = async ( · 46 unmodified lines
326const main = async () => {331const main = async () => {
327 const { dryRun } = parseArgs(process.argv.slice(2));332 const { dryRun } = parseArgs(process.argv.slice(2));
328 333
329 // Use the sdk package version as the source of truth for the channel. All334 // Each package's own version determines its dist-tag (pre-release versions
330 // published packages version together (they're not in the changeset ignore335 // with `-` publish to `beta`, everything else to `latest`). Packages are
331 // list), so they share a release channel.336 // only skipped when their current version is already on npm.
332 const sdkMeta = await readPackageMeta(join(repoRoot, "packages/core/sdk"));337 console.log(`Publishing ${PUBLISHED_SCOPE} packages${dryRun ? " [dry-run]" : ""}`);
333 const channel = resolveChannel(sdkMeta.version);
334 console.log(`Publishing ${PUBLISHED_SCOPE} packages (${channel})${dryRun ? " [dry-run]" : ""}`);
335 338
336 await $`bun run build:packages`.cwd(repoRoot);339 await $`bun run build:packages`.cwd(repoRoot);
337 340
@@ -351,7 +354,7 @@ const main = async () => { · 13 unmodified lines
351 }354 }
352 355
353 for (const relDir of PUBLIC_PACKAGE_DIRS) {356 for (const relDir of PUBLIC_PACKAGE_DIRS) {
354 await publishPackage(join(repoRoot, relDir), channel, dryRun, publishable, publishableVersions);357 await publishPackage(join(repoRoot, relDir), dryRun, publishable, publishableVersions);
355 }358 }
356};359};
357 360