Skip to content

(Contact) extract packument and manifest (pacote) #488

@fraxken

Description

@fraxken

The API is focused on the scanner right now, which is fine.
I’d like to add two new method to the ContactExtractor class (in addition to fromDependencies):

  1. fromManifest - pull contacts from a manifest
  2. fromPackument - pull contacts from a packument

Both inputs come from pacote, so we keep using the npm-types workspace.

These helpers will only extract the raw contacts.
They won’t parse them—that still happens in fromDependencies, which returns a proper Contact (because Scanner already deal with that before hand).

We’ll need parseAuthor from the utils workspace for the final step.

Tip

Doing manifest first and then packument in a separated PR would be better (since packument contains all the manifest of the package).


Expected code output would be something like fromDependencies

const manifest = await pacote.manifest("is@x.x.x");

const extractor = new ContactExtractor({
  highlight: [
    {
      name: "Sindre Sorhus"
    }
  ]
});
const contacts = extractor.fromManifest(
  manifest
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions