npm / rfcs

Public change requests/proposals & ideation
Other
730 stars 240 forks source link

[RRFC] Set version. Don't tag per default. #659

Open infacto opened 1 year ago

infacto commented 1 year ago

Suggestion: Don't create Git tags by default. Invert the logic of --no-git-tag-version. The dev should add option like --git-tag or just --tag to automatically create a tag. In my opinion we (e.g. CI) should have full control when and how to commit and tag. It's more error-prone to tag by default.

https://docs.npmjs.com/cli/commands/npm-version

ljharb commented 1 year ago

How is it more error prone? An undesired tag can simply be deleted, but a missing tag might be harder to reconstruct later.

infacto commented 1 year ago

Well, there are several reasons or cases. At first we have to say that this method creates a commit and tag. And in my case I accidentally created this tags and commits. I didn't know that. I wrote and tested a CI script which executed npm version with garbage versions to test with a script that requires the version in the package.json for further changes on the repo before commit and tag. So I wanted to increase the version and further stuff before tagging. I didn't realiszed that this method created unwanted commits and tags. In my opinion this function should be explicitly enabled by the dev using the argument. In this case, there can never be cases like mine. No unintentional changes in Git before I decide to do it. ... I know this would be a breaking change for the devs who already uses it in believing to affect git. But not really critical in my opinion.

ljharb commented 1 year ago

Right - so in your case, the worst damage was some extra commits and tags, in a version control system that lets you get rid of them without a trace.

If the change you're requesting happens, the worst damage is that information is irretrievably lost forever.

It seems clear to me which default is safest.