Coder Social home page Coder Social logo

next-ver's Introduction

next-ver

Tells you the next semantic version for your local package

NPM

Build status semantic-release js-standard-style

Install and use

Imagine a local package with current version 2.3.0 and a single semantic commit fix(something): fix the login. This tools computes the next version that should be used.

npm install -g next-ver
next-ver
next version should be 2.3.1

Then you can publish, for example using npm version command or one of the good helper CLI tools, like publish-please, np or ci-publish.

npm version 2.3.1

Incrementing version in package file

If there is a new version, you can update the version in the "package.json" file and commit the change, including creating a tag, just like the command npm version <new version> does.

Just add --go to the next-ver command

next-ver --go

Semantic version rules

A semantic version has form "major.minor.patch"

A typical semantic commit has message of the form "type(scope): message". Commits that do not follow this format are ignored when computing next version.

If there is a commit fix(something): ... then new version should increment the "patch" number. A commit feat(something): ... will increment the "minor" number. Finally, a commit with text "BREAKING" anywhere in the message or the message body text will increment the "major" number.

When there are multiple numbers, the will be only the highest single digit increment. For example, these 4 commits will increment the "minor" number only.

fix(this): ...
fix(that): ...
feat(log): ...
feat(server): ...

CLI options

  • --go increments the version in the current folder's package.json
  • --version, -v shows the version of next-ver itself

Related

I recommend enforcing commit message format using pre-git with its default simple-commit-message format validator. They work great with semantic-release tool.

Testing and development

Uses separate repo next-ver-test for testing this tool via dont-break

Small print

Author: Gleb Bahmutov <[email protected]> © 2016

License: MIT - do anything with the code, but don't blame me if it does not work.

Support: if you find any problems with this module, email / tweet / open issue on Github

MIT License

Copyright (c) 2016 Gleb Bahmutov <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

next-ver's People

Contributors

bahmutov avatar lirantal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

next-ver's Issues

Deprecated warning

on Node 8

(node:64547) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.

Better message

Instead of just saying next version should be 1.22.0 it should say
next version should be 1.22.0 (1 feature, 2 fixes) for example

Add npm version set option

Add command line option to perform npm version <new version> if next-ver determines that there is a new version

next-ver --go
incrementing 1.0.0 by major +1ms
next version should be 2.0.0
running "npm version 2.0.0"

Not working if main branch is not named "master"

I renamed master branch to main and it stopped working:

GitHub Actions output:

Run yarn next-ver --go
yarn run v1.22.18
$ /home/runner/work/magic/magic/node_modules/.bin/next-ver --go

/home/runner/work/magic/magic/node_modules/q/q.js:87[6](https://github.com/Frank-Mayer/magic/runs/6032304461?check_suite_focus=true#step:7:6)
    throw error;
    ^
fatal: couldn't find remote ref master

(Use `node --trace-uncaught ...` to show where the exception was thrown)

Node.js v1[7](https://github.com/Frank-Mayer/magic/runs/6032304461?check_suite_focus=true#step:7:7).[9](https://github.com/Frank-Mayer/magic/runs/6032304461?check_suite_focus=true#step:7:9).0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Process completed with exit code 1.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.