(packageJson?: PackageJSON)
| 56 | } |
| 57 | |
| 58 | export function getCorrectRegistry(packageJson?: PackageJSON): RegistryInfo { |
| 59 | const packageName = packageJson?.name; |
| 60 | |
| 61 | if (packageName?.startsWith("@")) { |
| 62 | const scope = packageName.split("/")[0]; |
| 63 | const scopedRegistry = |
| 64 | packageJson!.publishConfig?.[`${scope}:registry`] || |
| 65 | process.env[`npm_config_${scope}:registry`]; |
| 66 | if (scopedRegistry) { |
| 67 | return { |
| 68 | scope, |
| 69 | registry: scopedRegistry, |
| 70 | }; |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | const registry = |
| 75 | packageJson?.publishConfig?.registry || process.env.npm_config_registry; |
| 76 | |
| 77 | return { |
| 78 | scope: undefined, |
| 79 | registry: |
| 80 | !registry || !isCustomRegistry(registry) ? NPM_REGISTRY : registry, |
| 81 | }; |
| 82 | } |
| 83 | |
| 84 | async function getPublishTool( |
| 85 | cwd: string |
no test coverage detected