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

http://registry.npmjs.com/@material-ui/core does not list a gitHead field while http://registry.npmjs.com/eslint-plugin-material-ui does.

Reproduction Steps

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

Details

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?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.