/auto-version

It will auto update package version when build your application.

Primary LanguageJavaScriptMIT LicenseMIT

auto-vers

Auto update version for your application

auto-vers is helpful to your work. It will auto update package version when build your application.

When you iterate over your application, updating the version is a trivial but indispensable little thing. You can run it while packaging your app, and then will do more with less.

Feature

  • upgrade major, minor, patch or prerelease
  • confirm update in cli

Usage

npm i auto-vers

Cli

package.json

{
    ...
    "version": "1.0.0"
    ...
}

bash

./bin/auto-vers -i

package.json

{
    ...
    "version": "1.0.1"
    ...
}

options

-i --increment [<level>]
        Increment a version by the specified level.  Level can
        be one of: major, minor, patch or prerelease.
        Default level is 'patch'.
        Only one version may be specified.
-e --extra [<value>]
        This is for prerelease extra data
        Such as 'beta','alpha'

Node

package.json

{
    ...
    "version": "1.0.0"
    ...
}

index.js

const autoVers = require('auto-vers');

autoVers({type: 'patch'}); // 1.0.1
node index.js

update package.json

{
    ...
    "version": "1.0.1"
    ...
}

options

{
    type: major | minor | patch | prerelease,
    url?: package.json's url,
    extra?: alpha | beta | ...
}

Practices

It is a good choice to pack and upgrade the version at the same time.

"script": {
    "build": "babel ./src --out-dir ./dist && ./bin/auto-vers -i",
    "build-m": "babel ./src --out-dir ./dist && ./bin/auto-vers -i minor",
    "build-a": "babel ./src --out-dir ./dist && ./bin/auto-vers -i major",
    "build-t": "babel ./src --out-dir ./dist && ./bin/auto-vers -i prerelease"
}

License

MIT

Copyright (c) 2018 蓝色的秋风