feat: publishConfig.registry (#6803)

close #6775
This commit is contained in:
Khải
2023-07-13 20:11:40 +07:00
committed by GitHub
parent 48829ed549
commit aa2ae8fe2b
3 changed files with 10 additions and 1 deletions

View File

@@ -0,0 +1,7 @@
---
"@pnpm/plugin-commands-publishing": minor
"@pnpm/types": minor
"pnpm": patch
---
Support `publishConfig.registry` in `package.json` for publishing [#6775](https://github.com/pnpm/pnpm/issues/6775).

View File

@@ -56,6 +56,7 @@ export interface PublishConfig extends Record<string, unknown> {
directory?: string directory?: string
linkDirectory?: boolean linkDirectory?: boolean
executableFiles?: string[] executableFiles?: string[]
registry?: string
} }
type Version = string type Version = string

View File

@@ -105,6 +105,7 @@ export async function recursivePublish (
const publishResults = await Promise.all(chunk.map(async (pkgDir) => { const publishResults = await Promise.all(chunk.map(async (pkgDir) => {
if (!publishedPkgDirs.has(pkgDir)) return null if (!publishedPkgDirs.has(pkgDir)) return null
const pkg = opts.selectedProjectsGraph[pkgDir].package const pkg = opts.selectedProjectsGraph[pkgDir].package
const registry = pkg.manifest.publishConfig?.registry ?? pickRegistryForPackage(opts.registries, pkg.manifest.name!)
const publishResult = await publish({ const publishResult = await publish({
...opts, ...opts,
dir: pkg.dir, dir: pkg.dir,
@@ -114,7 +115,7 @@ export async function recursivePublish (
'--tag', '--tag',
tag, tag,
'--registry', '--registry',
pickRegistryForPackage(opts.registries, pkg.manifest.name!), registry,
...appendedArgs, ...appendedArgs,
], ],
}, },