[BUG] npm-version does not git-commit nor git-tag when package in subdirectory
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.1k
- Forks
- 4.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 19
Description
Current Behavior:
npm version <version> is not committing the modified package.json or package-lock.json; nor git-tagging.
We were using npm version {major|minor|patch} extensively (and successfully). It stopped working once the package was moved out of the root of the repo and into a subdirectory.
Expected Behavior:
npm version <version> should continue to create a git-commit and git-tag as indicated in the docs:
If run in a git repo, it will also create a version commit and tag. This behavior is controlled by git-tag-version (see below), and can be disabled on the command line by running npm --no-git-tag-version version. It will fail if the working directory is not clean, unless the -f or --force flag is set.
Steps To Reproduce:
- initialize an npm package in the root of an initialized git repo
npm version minorsuccessfully bumps the version, commits and tags- move the npm package into a subdirectory of the repo
npm version minorstill bumps the version in package.json and package-lock.json, but git is not committed nor tagged.
Environment:
- macOS 10.15.7
- node: v14.13.1
- npm: 6.14.8
- git: git version 2.28.0
This is apparently an existing bug going as far back as npm v3: https://github.com/npm/npm/issues/18795
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
Start by reproducing the documented steps with an npm package moved into a repository subdirectory, then trace the npm version command's handling of the package and repository roots. Done means npm version still updates package.json and package-lock.json while creating the expected git commit and tag.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100