diff --git a/.yarn/versions/2a82f92f.yml b/.yarn/versions/2a82f92f.yml new file mode 100644 index 00000000000..31f0d02b09d --- /dev/null +++ b/.yarn/versions/2a82f92f.yml @@ -0,0 +1,23 @@ +releases: + "@yarnpkg/cli": patch + "@yarnpkg/plugin-npm-cli": patch + +declined: + - "@yarnpkg/plugin-compat" + - "@yarnpkg/plugin-constraints" + - "@yarnpkg/plugin-dlx" + - "@yarnpkg/plugin-essentials" + - "@yarnpkg/plugin-init" + - "@yarnpkg/plugin-interactive-tools" + - "@yarnpkg/plugin-nm" + - "@yarnpkg/plugin-pack" + - "@yarnpkg/plugin-patch" + - "@yarnpkg/plugin-pnp" + - "@yarnpkg/plugin-pnpm" + - "@yarnpkg/plugin-stage" + - "@yarnpkg/plugin-typescript" + - "@yarnpkg/plugin-version" + - "@yarnpkg/plugin-workspace-tools" + - "@yarnpkg/builder" + - "@yarnpkg/core" + - "@yarnpkg/doctor" diff --git a/packages/acceptance-tests/pkg-tests-specs/sources/commands/patchCommit.test.ts b/packages/acceptance-tests/pkg-tests-specs/sources/commands/patchCommit.test.ts index cff830889e8..6b78617de63 100644 --- a/packages/acceptance-tests/pkg-tests-specs/sources/commands/patchCommit.test.ts +++ b/packages/acceptance-tests/pkg-tests-specs/sources/commands/patchCommit.test.ts @@ -114,7 +114,7 @@ describe(`Commands`, () => { }); expect(manifest.resolutions).toEqual({ - [`no-deps@npm:1.0.0`]: expect.stringMatching(/^patch:no-deps/), + [`no-deps@npm:1.0.0`]: expect.stringMatching(/^patch:no-deps/), }); }), ); diff --git a/packages/acceptance-tests/pkg-tests-specs/sources/commands/publish.test.ts b/packages/acceptance-tests/pkg-tests-specs/sources/commands/publish.test.ts index b739e5c582b..2f2de4430a1 100644 --- a/packages/acceptance-tests/pkg-tests-specs/sources/commands/publish.test.ts +++ b/packages/acceptance-tests/pkg-tests-specs/sources/commands/publish.test.ts @@ -125,6 +125,31 @@ describe(`publish`, () => { expect(Array.isArray(result.files)).toBe(true); })); + test(`should correctly log name of scoped workspace`, makeTemporaryEnv({ + name: `@scope/json-test`, + version: `1.0.0`, + }, async ({path, run, source}) => { + await run(`install`); + + const {stdout} = await run(`npm`, `publish`, `--json`, `--dry-run`, `--tolerate-republish`); + const jsonObjects = misc.parseJsonStream(stdout); + const result = jsonObjects.find((obj: any) => obj.name && obj.version); + + expect(result).toBeDefined(); + expect(result).toHaveProperty(`name`, `@scope/json-test`); + expect(result).toHaveProperty(`version`, `1.0.0`); + expect(result).toHaveProperty(`dryRun`, true); + expect(result).toHaveProperty(`registry`); + expect(result).toHaveProperty(`published`, false); + expect(result).toHaveProperty(`message`); + + expect(result).toHaveProperty(`tag`); + expect(result).toHaveProperty(`provenance`); + + expect(result).toHaveProperty(`files`); + expect(Array.isArray(result.files)).toBe(true); + })); + testIf( () => !!process.env.ACTIONS_ID_TOKEN_REQUEST_URL, `should publish a package with a valid provenance statement`, diff --git a/packages/plugin-npm-cli/sources/commands/npm/publish.ts b/packages/plugin-npm-cli/sources/commands/npm/publish.ts index f4422311f23..0b1b40fa0a5 100644 --- a/packages/plugin-npm-cli/sources/commands/npm/publish.ts +++ b/packages/plugin-npm-cli/sources/commands/npm/publish.ts @@ -1,9 +1,9 @@ -import {BaseCommand, WorkspaceRequiredError} from '@yarnpkg/cli'; -import {Configuration, MessageName, Project, ReportError, StreamReport, scriptUtils, miscUtils} from '@yarnpkg/core'; -import {npath} from '@yarnpkg/fslib'; -import {npmConfigUtils, npmHttpUtils, npmPublishUtils} from '@yarnpkg/plugin-npm'; -import {packUtils} from '@yarnpkg/plugin-pack'; -import {Command, Option, Usage, UsageError} from 'clipanion'; +import {BaseCommand, WorkspaceRequiredError} from '@yarnpkg/cli'; +import {Configuration, MessageName, Project, ReportError, StreamReport, scriptUtils, miscUtils, structUtils} from '@yarnpkg/core'; +import {npath} from '@yarnpkg/fslib'; +import {npmConfigUtils, npmHttpUtils, npmPublishUtils} from '@yarnpkg/plugin-npm'; +import {packUtils} from '@yarnpkg/plugin-pack'; +import {Command, Option, Usage, UsageError} from 'clipanion'; // eslint-disable-next-line arca/no-default-export export default class NpmPublishCommand extends BaseCommand { @@ -97,7 +97,7 @@ export default class NpmPublishCommand extends BaseCommand { const warning = `Registry already knows about version ${version}; skipping.`; report.reportWarning(MessageName.UNNAMED, warning); report.reportJson({ - name: ident.name, + name: structUtils.stringifyIdent(ident), version, registry, warning, @@ -176,7 +176,7 @@ export default class NpmPublishCommand extends BaseCommand { report.reportInfo(MessageName.UNNAMED, finalMessage); report.reportJson({ - name: ident.name, + name: structUtils.stringifyIdent(ident), version, registry, tag: this.tag || `latest`,