standard-version icon indicating copy to clipboard operation
standard-version copied to clipboard

version in package.json not being bumped locally

Open ssube opened this issue 5 years ago • 13 comments

I'm running ./node_modules/.bin/standard-version --sign from the project root of https://github.com/ssube/prometheus-sql-adapter to generate a changelog and tag releases. While the project is not generally JS, it does have a yarn init'd package file with name, version, and dependency on standard-version. This seems similar to https://github.com/conventional-changelog/standard-version/issues/434 and https://github.com/conventional-changelog/standard-version/issues/256, but is happening in a local env rather than CI. Using "standard-version": "7.0.1".

For some reason, the changelog is getting the correct new version (next will be 0.3.3 or 0.4.0), but package.json is never updated. I've tried running with --release-as=, with and without --dry-run, without --sign, but the behavior seems consistent. I'm using the name and version info from package.json in the binary, so --git-tag-fallback might work with some other changes. Since the package produces a Go binary and Docker image, I haven't published it to npm, which might be related.

Edit: publishing a package to npm, then running standard-release again, does not seem to have solved it

Any ideas why the version isn't being updated?

ssube avatar Dec 13 '19 15:12 ssube

I'm working in a npm project. package.json is not bumped as well. standard-version: 7.0.1

I tried using a fresh npm inited project. version bumping works correctly. Now I turn to my existing npm project. It seems standard-version read from package.json, but do not bump the version back to package.json.

I have no versionrc. I'm trying to figure out what file or setting prevent the version bumping in package.json.

davidjytang avatar Jan 17 '20 08:01 davidjytang

Weird. I think I found the reason.

Let's say my project name is dassai. The generated artifact is dassai-1.2.3. I don't want to accidentally commit the artifact and naturally my .gitignore looks like

node_modules
dist
lib
dassai*  # This line here.

With above .gitignore, standard-version stops bumping the version field in package.json. I don't know why but once I change the line to

dassai-*

Version bumping in package.json works correctly again.

Maybe @ssube can confirm?

davidjytang avatar Jan 17 '20 09:01 davidjytang

I'm also having this issue. package.json and package-lock.json is not bumped as well.

But: I don't have any line in .gitignore that sounds like my project (https://github.com/naimo84/node-red-contrib-ical-events).

standard-version: 7.0.1 nodejs 12

naimo84 avatar Jan 25 '20 08:01 naimo84

Just a hunch. I wonder what happens if you removed the entire .gitignore file.

davidjytang avatar Jan 25 '20 17:01 davidjytang

Same here. My package.json (and lock) stopped getting bumped on release. The culprit is a gitignore line myproject that should only catch the built binary (which has the same name as the project of course).

alerque avatar Feb 04 '20 06:02 alerque

This can't even be worked around by defining packageFiles or bumpFiles to force the action.

alerque avatar Feb 04 '20 06:02 alerque

I tried backtracking as far as 6.0.1, but I'm guessing it's actually a dependency (that isn't version-locked) that is causing this because not much changed. I did notice some versions also have an issues with myproject-* and some don't.

alerque avatar Feb 04 '20 07:02 alerque

I also did rm .gitignore and it worked for me afterwards..

okdistribute avatar Jun 26 '20 19:06 okdistribute

Still a problem. The issue is not wildcard globing either, it's very specific to $PROJECT. For example for the SILE project, if sile is matched by an ignore rule (whether by a glob like sile* or a fixed string match like sile) then package.son stops getting updated. As noted by @davidjytang in this comment above anything that doesn't match the plain project name (such as sile-* which will not match "sile") works okay (not is some old versions, but currently fine).

alerque avatar Oct 01 '20 08:10 alerque

We're still seeing this in [email protected].

bchrobot avatar Aug 30 '21 12:08 bchrobot

Just hit this issue with [email protected] Worked around by rm .gitignore then checking it out again directly afterward

Gitignore File:

# csilk Gitignore default #
###########################

.gitlab
builds/
*.pem
runtime/

# Editors #
###########
.idea
*.iml
.project
.gradle/
/nbproject/private/

# Compiled source #
###################

dist
*.com
*.class
*.dll
*.exe
*.o
*.so

# Packages #
############

*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
.vs
*.msi
*.nupkg

# Logs and databases #
######################

*.log
*.sql
*.sqlite
npm-debug.log*
coverage
junit.xml

# Caches #
##########

.eslintcache
eslint-data
/tmp/
/.cache-loader

# Node #
########
lib-cov
*.seed
*.log
*.dat
*.out
*.pid
*.gz
pids
logs
npm-debug.log
node_modules/
.pnp.js
.pnp
.yarn-meta
/packages/lockfile/index.js
/.nyc_output

# Yarn #
########

.yarn/*
!.yarn/patches
!.yarn/releases
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
.pnp.*

# OS generated files #
######################

.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
debug.log
.settings
.settings/*
.buildpath
*.iml
sftp-config*
*.sublime-*
*.swp
*.swo

Run with .gitignore

yarn standard-version --skip.commit
git status

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)
	modified:   CHANGELOG.md

Run after removing .gitignore

rm .gitignore
yarn standard-version --skip.commit
git checkout .gitignore
git status

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)
	modified:   CHANGELOG.md
	modified:   package.json

csi-lk avatar Nov 09 '21 01:11 csi-lk

Ran into this issue today too, turns out it was the build entry in the .gitignore file This is with version 9.3.2

NathanJAdams avatar Apr 29 '22 23:04 NathanJAdams

Ran into the same issue. Mine was with my binary which I added in .gitignore that had the same name than in package.json.

Version: 9.5.0

StanGirard avatar Sep 09 '22 16:09 StanGirard