Skip to content

[BUG] publishing a tarball does not include readme #3548

@wraithgar

Description

@wraithgar

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When publishing from a tarball, the readme attribute is not in the manifest.

Expected Behavior

fullMetadata: true in pacote.manifest works properly for tarballs.

Steps To Reproduce

This was technically introduced in [email protected] but that was because that was when publishing from a tarball was added back in to v7. This has likely never worked in v7.

cli/lib/publish.js

Lines 193 to 197 in 665a7bd

getManifest (spec, opts) {
if (spec.type === 'directory')
return readJson(`${spec.fetchSpec}/package.json`)
return pacote.manifest(spec, { ...opts, fullMetadata: true })
}

> m = pacote.manifest('.', { fullMetadata: true })
Promise { <pending> }
> m
Promise {
  {
    name: 'npm-readme-repro',
    version: '1.0.0',
    description: 'Example publishing an npm package.',
    main: 'index.js',
    scripts: { test: 'echo "Error: no test specified" && exit 1' },
    repository: {
      type: 'git',
      url: 'git+https://github.com/jcansdale-test/npm-readme-repro.git'
    },
    keywords: [],
    author: 'Gar <[email protected]>',
    license: 'ISC',
    bugs: {
      url: 'https://github.com/jcansdale-test/npm-readme-repro/issues'
    },
    homepage: 'https://github.com/jcansdale-test/npm-readme-repro#readme',
    _id: '[email protected]',
    _integrity: null,
    _resolved: '/Users/wraithgar/Development/npm/npm-readme-repro',
    _from: 'file:',
    [Symbol(newline)]: '\n',
    [Symbol(indent)]: '  '
  }
}

Environment

See steps to reproduce for relevant environment info.

Metadata

Metadata

Assignees

Labels

Bugthing that needs fixingPriority 1high priority issueRelease 7.xwork is associated with a specific npm 7 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions