2.3.4 • Published 2 months ago

@sliit-foss/automatic-versioning v2.3.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

@sliit-foss/automatic-versioning

A script which will automatically increment your app package version in accordance with conventional commits


Why automatic-versioning

  • Most version bumping scripts only focus on just the version bumping. automatic-versioning takes into account your git changes and automatically increments the version number based on your last commit message only if there are changes in your directory, a feature which is highly useful in monorepos.

Prerequisites

  • Git installed and configured

Installation

# using npm
npm install @sliit-foss/automatic-versioning

# using yarn
yarn add @sliit-foss/automatic-versioning

Usage

  • Add the following script to your package.json
  "scripts": {
      "bump-version": "npx automatic-versioning --name=<package_name>"
  }
  • then:
# using npm
npm run bump-version

# using yarn
yarn bump-version

Usage with commitlint and husky

  • Install the following dependencies

  "dependencies": {
    "@commitlint/cli": "^17.0.1",
    "@commitlint/config-conventional": "^17.0.0",
    "husky": "^4.3.8"
  }
  • Add the following to your package.json

  "config": {
    "commitizen": {
      "path": "cz-conventional-changelog"
    }
  },
  "husky": {
    "hooks": {
      "commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
      "post-commit": "HUSKY_SKIP_HOOKS=1 yarn bump-version",
    }
  },
  "commitlint": {
    "extends": [
      "@commitlint/config-conventional"
    ]
  }

Commit message prefixes and associated version bumping

    - Feature! | Feat! | Fix! | Patch!     - bump major version
    - Feature | Feat                       - bump minor version
    - Fix | Patch                          - bump patch version

Skip commit

  • By default automatic-versioning will commit the newly incremented version to source control. To disable this behavior, add the following to your script: "--skip-commit"
  npx automatic-versioning --name=<package_name> --skip-commit

Disable version bumping for specific commit

  git commit -m "Feat: some feature --no-bump"

Custom app directory to run versioning script

  npx automatic-versioning --name=<package_name> --root=<custom_dir>

Recursively search commit history to find a supporting prefix to trigger a version bump

  npx automatic-versioning --name=<package_name> --recursive

Prerelease branch

  • If this option is specified and the current branch matches it, the versioning will be evaluated as follows

    • Feat! --> Premajor
    • Feat --> Preminor
    • Fix --> Prepatch
  npx automatic-versioning --name=<package_name> --prerelease-branch=<branch_name>

Prerelease

  • If this is specified, the versioning will always be one of prerelease, premajor, preminor or prepatch depending on the above commit mapping
  npx automatic-versioning --name=<package_name> --prerelease

Custom prerelease tag

  npx automatic-versioning --name=<package_name> --prerelease-tag=<name>

Ignore prefixes

  • A list of comma separated prefixes to ignore when evaluating the commit message. By default we stop searching for commits once we come across any prefix considered by commitlint as valid prefixes. You can use this option to ignore a few of them if the need arises
  npx automatic-versioning --name=<package_name> --ignore-prefixes=ci,docs

Migration from V1 to V2

  • --no-commit-edit option has been removed as commits no longer cause problems with the versioning script
  • --no-commit option has been renamed to --skip-commit
2.3.2

2 months ago

2.3.4

2 months ago

2.3.3

2 months ago

2.3.1

2 months ago

2.3.0

3 months ago

2.2.0

3 months ago

2.1.1

3 months ago

2.1.0

3 months ago

2.0.2

4 months ago

2.0.1

5 months ago

2.0.0

5 months ago

2.0.1-blizzard.0

5 months ago

2.0.0-blizzard.0

5 months ago

1.2.0

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.4.6

8 months ago

1.4.4

12 months ago

1.4.3

12 months ago

1.1.6

1 year ago

1.4.5-blizzard.0

5 months ago

1.4.2

12 months ago

1.1.5

1 year ago

1.4.1

12 months ago

1.1.4

1 year ago

1.4.0

12 months ago

1.1.3

1 year ago

1.3.0

12 months ago

1.2.1

1 year ago

1.1.2

1 year ago

1.4.4-blizzard.0

12 months ago

1.1.3-alpha.0

1 year ago

1.4.3-blizzard.1

12 months ago

1.4.7-blizzard.0

5 months ago

1.4.3-blizzard.2

12 months ago

1.4.3-blizzard.0

12 months ago

1.4.2-blizzard.2

12 months ago

1.4.2-blizzard.3

12 months ago

1.4.2-blizzard.0

12 months ago

1.4.7

5 months ago

1.4.2-blizzard.1

12 months ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

0.0.8

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.1.0

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago