fix(npm): promote dsh after baseline publication
This commit is contained in:
@@ -34,6 +34,8 @@ const DEPENDENCY_SECTIONS = [
|
|||||||
'peerDependencies',
|
'peerDependencies',
|
||||||
] as const
|
] as const
|
||||||
const RELEASE_MANIFEST_NAME = 'manifest.json'
|
const RELEASE_MANIFEST_NAME = 'manifest.json'
|
||||||
|
const RELEASE_ENTRY_PACKAGE = '@deepseek-ai/dsh'
|
||||||
|
const LATEST_DIST_TAG = 'latest'
|
||||||
const POSIX_WEB_PROBE = String.raw`
|
const POSIX_WEB_PROBE = String.raw`
|
||||||
import errno, os, pty, select, signal, sys, time
|
import errno, os, pty, select, signal, sys, time
|
||||||
node, bin_path, cwd, timeout_seconds = sys.argv[1:]
|
node, bin_path, cwd, timeout_seconds = sys.argv[1:]
|
||||||
@@ -645,14 +647,17 @@ class RegistryPublication {
|
|||||||
`publish-npm-baseline: already published ${pkg.name}@${this.bundle.manifest.version}`,
|
`publish-npm-baseline: already published ${pkg.name}@${this.bundle.manifest.version}`,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
this.ensureDistTag(pkg.name)
|
this.ensureDistTag(pkg.name, this.bundle.manifest.distTag)
|
||||||
}
|
}
|
||||||
|
this.ensureDistTag(RELEASE_ENTRY_PACKAGE, LATEST_DIST_TAG)
|
||||||
this.verifyRemote()
|
this.verifyRemote()
|
||||||
|
this.verifyReleaseEntryDistTag()
|
||||||
}
|
}
|
||||||
|
|
||||||
verify(): void {
|
verify(): void {
|
||||||
this.pingRegistry()
|
this.pingRegistry()
|
||||||
this.verifyRemote()
|
this.verifyRemote()
|
||||||
|
this.verifyReleaseEntryDistTag()
|
||||||
}
|
}
|
||||||
|
|
||||||
private verifyRemote(): void {
|
private verifyRemote(): void {
|
||||||
@@ -664,7 +669,7 @@ class RegistryPublication {
|
|||||||
if (integrity !== pkg.integrity) {
|
if (integrity !== pkg.integrity) {
|
||||||
throw new Error(`integrity mismatch: ${pkg.name}@${this.bundle.manifest.version}`)
|
throw new Error(`integrity mismatch: ${pkg.name}@${this.bundle.manifest.version}`)
|
||||||
}
|
}
|
||||||
const tagVersion = this.remoteDistTag(pkg.name)
|
const tagVersion = this.remoteDistTag(pkg.name, this.bundle.manifest.distTag)
|
||||||
if (tagVersion !== this.bundle.manifest.version) {
|
if (tagVersion !== this.bundle.manifest.version) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`${pkg.name}@${this.bundle.manifest.distTag} points to ${tagVersion ?? '<missing>'}; `
|
`${pkg.name}@${this.bundle.manifest.distTag} points to ${tagVersion ?? '<missing>'}; `
|
||||||
@@ -679,6 +684,20 @@ class RegistryPublication {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private verifyReleaseEntryDistTag(): void {
|
||||||
|
const tagVersion = this.remoteDistTag(RELEASE_ENTRY_PACKAGE, LATEST_DIST_TAG)
|
||||||
|
if (tagVersion !== this.bundle.manifest.version) {
|
||||||
|
throw new Error(
|
||||||
|
`${RELEASE_ENTRY_PACKAGE}@${LATEST_DIST_TAG} points to ${tagVersion ?? '<missing>'}; `
|
||||||
|
+ `expected ${this.bundle.manifest.version}`,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
console.log(
|
||||||
|
`publish-npm-baseline: verified ${RELEASE_ENTRY_PACKAGE}@${LATEST_DIST_TAG} at `
|
||||||
|
+ this.bundle.manifest.version,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
private pingRegistry(): void {
|
private pingRegistry(): void {
|
||||||
const { registry } = this.bundle.manifest
|
const { registry } = this.bundle.manifest
|
||||||
this.runner.capture(
|
this.runner.capture(
|
||||||
@@ -723,8 +742,8 @@ class RegistryPublication {
|
|||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
|
|
||||||
private remoteDistTag(name: string): string | undefined {
|
private remoteDistTag(name: string, distTag: string): string | undefined {
|
||||||
const { registry, distTag } = this.bundle.manifest
|
const { registry } = this.bundle.manifest
|
||||||
const raw = this.runner.capture(
|
const raw = this.runner.capture(
|
||||||
'npm',
|
'npm',
|
||||||
['dist-tag', 'ls', name, `--registry=${registry}`],
|
['dist-tag', 'ls', name, `--registry=${registry}`],
|
||||||
@@ -734,9 +753,9 @@ class RegistryPublication {
|
|||||||
return parseDistTagListing(raw, name).get(distTag)
|
return parseDistTagListing(raw, name).get(distTag)
|
||||||
}
|
}
|
||||||
|
|
||||||
private ensureDistTag(name: string): void {
|
private ensureDistTag(name: string, distTag: string): void {
|
||||||
if (this.remoteDistTag(name) === this.bundle.manifest.version) return
|
if (this.remoteDistTag(name, distTag) === this.bundle.manifest.version) return
|
||||||
const { registry, version, distTag } = this.bundle.manifest
|
const { registry, version } = this.bundle.manifest
|
||||||
this.runner.run(
|
this.runner.run(
|
||||||
'npm',
|
'npm',
|
||||||
['dist-tag', 'add', `${name}@${version}`, distTag, `--registry=${registry}`],
|
['dist-tag', 'add', `${name}@${version}`, distTag, `--registry=${registry}`],
|
||||||
|
|||||||
Reference in New Issue
Block a user