palantir / palantir/documentalist

Consider using libnpm instead of spawning npm process

Open
#83 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
160
Forks
32
Avg merge
1h 40m
Merged PRs (30d)
141

Description

Consider using libnpm instead of spawning npm process in npm plugin

Every piece of information that is currently used by npm plugin can be acquired through libnpm without using npm cli directly.

versions property is sorted by npm cli view command (https://github.com/npm/cli/blob/656bce7dd0f9753a273912e803261ed246593924/lib/view.js#L50)

const packument = require('libnpm/packument');
const semver = require('semver');

packument('libnpm', {
    fullMetadata: true
}).then((data) => {
    const distTags = data["dist-tags"] || {};
    console.log({
        name: data.name,
        description: data.description,
        latestVersion: distTags.latest,
        nextVersion: distTags.next,
        versions: Object.keys(data.versions).sort(semver.compareLoose),
    });
});

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the npm plugin and find where it currently spawns the npm process. Compare the information it gathers with the libnpm packument example in the issue, including dist-tags and sorted versions. Done means the plugin obtains the required information without invoking the npm CLI and preserves its current outputs.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.