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

Add --no-git-tag-version flag #250

Closed
wants to merge 1 commit into from

Conversation

pleunv
Copy link

@pleunv pleunv commented Feb 27, 2018

Based on my proposal in #249, this PR would allow you to publish a package without also creating a git commit with tag. Since both yarn & npm have a way to disable this behavior through --no-git-tag-version I've reused this option name.

This is specifically for the scenario where you want to run a CI/CD build that publishes each build to npm, ideally with a timestamp instead of an automatically incrementing build number, i.e. package@1.1.0-build-1519737350. This has the benefit of giving other CI/CD packages the ability to consume your unstable npm package while it's going through various stages, (i.e. alpha -> beta -> release) without having to manually maintain and update the package version constraint.

Our specific use-case for this is a set-up with separate client and server packages (and teams) that get developed and released simultaneously and would keep MAJOR.MINOR synchronized. This approach would allow us to always be working with eachother's latest compatible CI packages in development.

Without an option like this each commit would be succeeded by a git-tag commit, effectively doubling the number of commits and creating a lot of noise.

This basically enables the inverse scenario of the current --no-publish option (publish to npm, not publish to git).

There's one issue: it leaves your git state dirty, as your package.json gets modified but never gets committed. In the context of a (containerized) CI build this is not an issue, but I can image that with a persistent repo it will involve a manual clean before doing another publish, or have np discard the modified package.json if it detects it's running with --no-git-version.

I'm just opening this PR to get the ball rolling, if you decide not to merge this, no worries, I've built my own release that we can use.

Thanks a lot for you work on this lib :)

@pleunv
Copy link
Author

pleunv commented Feb 27, 2018

Oh, I also couldn't get the tests running locally (on Windows), keep running into:

TimeoutError {                                    
  context: {},                                    
  message: 'Connection to npm registry timed out',
}

@pedro-mass
Copy link

Any traction on this? Not creating the git tag would be ideal in certain scenarios

@sindresorhus
Copy link
Owner

Not creating the git tag would be ideal in certain scenarios

What scenarios? This PR is in the need of use-cases.

@sindresorhus sindresorhus changed the title Add support for --no-git-tag-version. Add --no-git-tag-version flag May 26, 2018
@pedro-mass
Copy link

My use case might be very niche, but here goes:

Using semantic-release to handle auto-publishing, git tagging, and release notes generation.

I like np due to the great CLI experience and easy NPM publications. It would be nice to use np for manual publications of package@next versions. np supports publishing on non-master branches with --any-branch, but pushing up the tag wouldn't be great for semantic-release.

@itaisteinherz
Copy link
Collaborator

This basically enables the inverse scenario of the current --no-publish option (publish to npm, not publish to git).

This could be achieved by not specifying an upstream branch, which would make np skip pushing, and implementing my suggestion in #347.
Anyway, I think this PR can be closed as it adds functionality which currently lacks use-cases.

@sindresorhus
Copy link
Owner

While there are a couple of mentioned use-cases for this feature, I don't think it's a common enough need to warrant a flag. np has always tried to be opinionated about the common workflow. There are other more flexible tools out there for advanced needs, like https://github.com/release-it/release-it

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

Successfully merging this pull request may close these issues.

4 participants