npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

gitHead missing in registry manifests for scoped packages

What I Wanted to Do

Given an arbitrary package name and its version find out the git version it was cut from

What Happened Instead does not list a gitHead field while does.

Reproduction Steps

Visit the links posted in “What happened” and search for “gitHead”


Platform Info

In the browser

This isn’t based on whether the package is scoped, but rather whether it’s published from the root of a git repo or not.

@material-ui/core is published from a subfolder in a git repo so it doesn’t get picked up.

It’d be nice if read-package-json walked up the tree to find the .git folder, but as of today, it does not, which is why this field sometimes doesn’t show up.

Thank you for the quick and through reply.

That does make more sense. How would gitHead look like if I npm publish tarballPath a previously npm packed tarball? Would gitHead be absent for any package structure or just just be incorrect depending on whether I checked out a different commit when calling npm publish tarballPath?

What does npm do if I manually set gitHead? Would it override it with whatever value it derives or would it leave it in?