Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm version not creating git commits when in sub-directory #443

Closed
darcyclarke opened this issue Nov 8, 2019 · 2 comments
Closed

npm version not creating git commits when in sub-directory #443

darcyclarke opened this issue Nov 8, 2019 · 2 comments
Labels
Bug thing that needs fixing

Comments

@darcyclarke
Copy link
Contributor

  Original bug ticket: [https://npm.community/t/9083](https://npm.community/t/9083)
  Originally filed: 2019-07-25T08:28:56.509Z
@darcyclarke darcyclarke added Bug thing that needs fixing Community labels Nov 8, 2019
@fennibay
Copy link

I experience this problem as well.

Is there a workaround except manually doing the commit and setting the tag? Especially setting the tag is cumbersome as I need to extract the version from package.json and eventually take tag-version-prefix setting into account.

Some solution alternatives I could think of:

  1. Provide a command line option to override the git detection, e.g. --force-git or stg better
  2. Improve git detection, there is a apparently a PR for that: Fix git repository discovery in npm version #221

@fennibay
Copy link

Workaround: create a postversion.sh file with following content and call it from npm script postversion:

git add package.json
git commit -m "chore: Bump version to $npm_package_version"
git tag -a $npm_config_tag_version_prefix$npm_package_version -m "$npm_package_version"
git push --follow-tags

npm sets up the environment variables npm_package_version and npm_config_tag_version_prefix automatically; which I can then use for commit message and tag name and annotation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing
Projects
None yet
Development

No branches or pull requests

2 participants