[RRFC] Include gitHead when publishing from subdirectories
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 777
- Forks
- 267
- PR merge metrics
- No merged PRs in 30d
Description
Motivation ("The Why")
When publishing from workspaces, it is still desirable to have gitHead still set, for all the reasons it was desirable without them. (Specifically, that published packages can be correlated with a specific commit in the source repo.) This is described in terms of subdirectories and not workspaces because supporting this without requiring a workspace definition would allow monorepos that npm does not manage to still be published with gitHead. This is most commonly the case when pnpm is used as it calls npm publish from its own workspace folders under the hood.
Example
$ git init
$ mkdir packages
$ npm init -y
$ git add package.json
$ git commit -minitial
$ npm publish
How
Current Behaviour
Currently gitHead is read only if there is a .git folder in the same directory as the package.json
Desired Behaviour
npm should scan up the directory tree looking for a .git folder the same way git itself does.
References
- n/a
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the example with npm publish from the packages subdirectory and inspect the publish path that currently checks for .git beside package.json. Compare the lookup with how Git finds a repository parent; done means publishing from a subdirectory records the repository commit in gitHead without requiring an npm workspace.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, javascript
- Domain
- cli, release, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100