mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-08-29 04:26:38 +00:00
The verify step resolved the publish order and said only that it had: the order a release actually follows, and the ordering it could not honour, stayed invisible until a publication was already running. publishOrder now returns that order together with the peer edges it dropped, verify prints both, and pack reads the order off the plan. The dropped edges are part of the result rather than a detail of forming it: the dsh family drops one (dsh-api-remotes -> dsh-api-gateway) and the vendored family drops two (cordis-plugin-include and cordis-plugin-loader, which cordis declares as peers in return), and only whoever reads the log can judge whether a newly dropped edge is expected. Because pack runs on every pull request and master push, a change to the order is now reviewable there rather than observable only at publish time. The order is also checked against the edges it exists to honour. A cycle mixing peer and dependency declarations can put a dependency on the traversal stack, where it is skipped like a peer edge, emitting a consumer before something it installs; no later step can detect that, and it would surface as an unresolvable install for a consumer of the published packages. No family has that shape today, and the new test pins the three-package case that would.
62 lines
2.5 KiB
TypeScript
62 lines
2.5 KiB
TypeScript
/**
|
|
* Pack one release family's whole publish set into a single directory, in
|
|
* publish order, and record that order for the publish step.
|
|
*
|
|
* The pack step is the release boundary: it runs without credentials, produces
|
|
* every tarball from one commit, and hands the publish step exactly those bytes
|
|
* ([rationale](../../.agents/notes/implemented/process/2026-08-10-npm-release-sequences.md)).
|
|
*/
|
|
|
|
import { existsSync, mkdirSync, rmSync, writeFileSync } from 'node:fs'
|
|
import { join, resolve } from 'node:path'
|
|
import { parseArgs } from 'node:util'
|
|
import { releaseFamily, tarballName, type ReleaseFamily, type ReleaseMember } from './families.ts'
|
|
import { isEntry, run } from './process.ts'
|
|
import { PUBLISH_ORDER_FILE, tarballFiles } from './tarball.ts'
|
|
|
|
/** Where pack output lands when `--out` is omitted. */
|
|
const DEFAULT_OUTPUT = 'dist/npm'
|
|
|
|
/**
|
|
* Pack one member and check what its tarball carries.
|
|
* @param family - the release family being packed.
|
|
* @param member - the member to pack.
|
|
* @param destination - absolute output directory.
|
|
* @returns The tarball filename.
|
|
*/
|
|
function packMember(family: ReleaseFamily, member: ReleaseMember, destination: string): string {
|
|
run('pnpm', ['--dir', member.directory, 'pack', '--pack-destination', destination])
|
|
|
|
const filename = tarballName(member)
|
|
const tarball = join(destination, filename)
|
|
if (!existsSync(tarball)) throw new Error(`${member.name} produced no tarball at ${tarball}`)
|
|
family.validatePayload(member, tarballFiles(tarball))
|
|
return filename
|
|
}
|
|
|
|
/** Pack the family named by `--family` into `--out`. */
|
|
function main(): void {
|
|
const { values } = parseArgs({
|
|
options: { family: { type: 'string' }, out: { type: 'string' } },
|
|
allowPositionals: false,
|
|
})
|
|
if (values.family === undefined) throw new Error('usage: pack.ts --family <dsh|vendor> [--out dist/npm]')
|
|
|
|
const family = releaseFamily(values.family)
|
|
const root = process.cwd()
|
|
const destination = resolve(root, values.out ?? DEFAULT_OUTPUT)
|
|
const members = family.publishOrder(family.members(root)).order
|
|
family.verifyVersions(members)
|
|
|
|
rmSync(destination, { recursive: true, force: true })
|
|
mkdirSync(destination, { recursive: true })
|
|
|
|
const order: string[] = []
|
|
for (const member of members) order.push(packMember(family, member, destination))
|
|
writeFileSync(join(destination, PUBLISH_ORDER_FILE), `${order.join('\n')}\n`)
|
|
|
|
console.log(`release pack: family ${family.id}, ${String(order.length)} tarball(s) in ${values.out ?? DEFAULT_OUTPUT}`)
|
|
}
|
|
|
|
if (isEntry(import.meta.url)) main()
|