mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-29 11:42:17 +00:00
A new pack-npm job applies the release version rewrite and runs the 14 library publish scripts in a pack-only mode (OPENCODE_NPM_PACK_DIR), with their typecheck, ui tests and codemode smoke install, and uploads the tarballs. It has only contents: read and no secrets. publish downloads them and sets OPENCODE_NPM_TARBALLS. script/publish.ts checks that every tarball exists and holds the expected name and version before it publishes anything, and each library script keeps its npm view check and then publishes its carried tarball instead of building again. Without either variable the scripts behave as before. The version rewrite moves to script/release-files.ts so publish and pack-npm share it.
24 lines
869 B
TypeScript
Executable file
24 lines
869 B
TypeScript
Executable file
#!/usr/bin/env bun
|
|
|
|
// publish.yml's pack-npm job: builds and packs the npm libraries into OPENCODE_NPM_PACK_DIR, with each library's own
|
|
// script and gates, so the publish job only publishes them. Publishes nothing.
|
|
|
|
import { NpmLibraries } from "@opencode/script/npm"
|
|
import { $ } from "bun"
|
|
import { mkdir } from "node:fs/promises"
|
|
import { fileURLToPath } from "url"
|
|
import { packageJsons, prepareReleaseFiles } from "./release-files"
|
|
|
|
process.chdir(fileURLToPath(new URL("..", import.meta.url)))
|
|
|
|
if (!NpmLibraries.packDir) throw new Error("OPENCODE_NPM_PACK_DIR is required")
|
|
|
|
await mkdir(NpmLibraries.packDir, { recursive: true })
|
|
await prepareReleaseFiles(await packageJsons())
|
|
|
|
for (const name of NpmLibraries.names) {
|
|
console.log(`\n=== ${name} ===\n`)
|
|
await $`bun ./packages/${name}/script/publish.ts`
|
|
}
|
|
|
|
await NpmLibraries.verify(NpmLibraries.packDir)
|