mirror of
https://github.com/pnpm/pnpm.git
synced 2026-05-19 06:07:59 -04:00
5
.changeset/proud-beds-clean.md
Normal file
5
.changeset/proud-beds-clean.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@pnpm/plugin-commands-publishing": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
`pnpm publish -r --dry-run` should not publish anything to the registry.
|
||||||
@@ -24,6 +24,7 @@ Partial<Pick<Config,
|
|||||||
| 'tag'
|
| 'tag'
|
||||||
| 'ca'
|
| 'ca'
|
||||||
| 'cert'
|
| 'cert'
|
||||||
|
| 'dryRun'
|
||||||
| 'extraBinPaths'
|
| 'extraBinPaths'
|
||||||
| 'fetchRetries'
|
| 'fetchRetries'
|
||||||
| 'fetchRetryFactor'
|
| 'fetchRetryFactor'
|
||||||
@@ -73,7 +74,13 @@ export default async function (
|
|||||||
}, pkg.manifest.name, pkg.manifest.version))
|
}, pkg.manifest.name, pkg.manifest.version))
|
||||||
})
|
})
|
||||||
const publishedPkgDirs = new Set(pkgsToPublish.map(({ dir }) => dir))
|
const publishedPkgDirs = new Set(pkgsToPublish.map(({ dir }) => dir))
|
||||||
const access = opts.cliOptions['access'] ? ['--access', opts.cliOptions['access']] : []
|
const appendedArgs = []
|
||||||
|
if (opts.cliOptions['access']) {
|
||||||
|
appendedArgs.push(`--access=${opts.cliOptions['access']}`)
|
||||||
|
}
|
||||||
|
if (opts.dryRun) {
|
||||||
|
appendedArgs.push('--dry-run')
|
||||||
|
}
|
||||||
const chunks = sortPackages(opts.selectedProjectsGraph)
|
const chunks = sortPackages(opts.selectedProjectsGraph)
|
||||||
for (const chunk of chunks) {
|
for (const chunk of chunks) {
|
||||||
for (const pkgDir of chunk) {
|
for (const pkgDir of chunk) {
|
||||||
@@ -89,7 +96,7 @@ export default async function (
|
|||||||
'pnpm-temp',
|
'pnpm-temp',
|
||||||
'--registry',
|
'--registry',
|
||||||
pickRegistryForPackage(opts.registries, pkg.manifest.name!),
|
pickRegistryForPackage(opts.registries, pkg.manifest.name!),
|
||||||
...access,
|
...appendedArgs,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
gitChecks: false,
|
gitChecks: false,
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { readProjects } from '@pnpm/filter-workspace-packages'
|
|||||||
import { publish } from '@pnpm/plugin-commands-publishing'
|
import { publish } from '@pnpm/plugin-commands-publishing'
|
||||||
import { preparePackages } from '@pnpm/prepare'
|
import { preparePackages } from '@pnpm/prepare'
|
||||||
import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock'
|
import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock'
|
||||||
|
import crossSpawn = require('cross-spawn')
|
||||||
import execa = require('execa')
|
import execa = require('execa')
|
||||||
import fs = require('mz/fs')
|
import fs = require('mz/fs')
|
||||||
import test = require('tape')
|
import test = require('tape')
|
||||||
@@ -66,6 +67,24 @@ test('recursive publish', async (t) => {
|
|||||||
|
|
||||||
await fs.writeFile('.npmrc', CREDENTIALS, 'utf8')
|
await fs.writeFile('.npmrc', CREDENTIALS, 'utf8')
|
||||||
|
|
||||||
|
t.comment('packages not published, when dryRun is true')
|
||||||
|
await publish.handler({
|
||||||
|
...DEFAULT_OPTS,
|
||||||
|
...await readProjects(process.cwd(), []),
|
||||||
|
dir: process.cwd(),
|
||||||
|
dryRun: true,
|
||||||
|
recursive: true,
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
{
|
||||||
|
const { status } = crossSpawn.sync('npm', ['view', pkg1.name, 'versions', '--registry', `http://localhost:${REGISTRY_MOCK_PORT}`, '--json'])
|
||||||
|
t.deepEqual(status, 1)
|
||||||
|
}
|
||||||
|
{
|
||||||
|
const { status } = crossSpawn.sync('npm', ['view', pkg2.name, 'versions', '--registry', `http://localhost:${REGISTRY_MOCK_PORT}`, '--json'])
|
||||||
|
t.deepEqual(status, 1)
|
||||||
|
}
|
||||||
|
|
||||||
await publish.handler({
|
await publish.handler({
|
||||||
...DEFAULT_OPTS,
|
...DEFAULT_OPTS,
|
||||||
...await readProjects(process.cwd(), []),
|
...await readProjects(process.cwd(), []),
|
||||||
|
|||||||
Reference in New Issue
Block a user