New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

automatic-versioning

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

automatic-versioning

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

latest
Source
npmnpm
Version
1.4.9
Version published
Weekly downloads
22
22.22%
Maintainers
1
Weekly downloads
 
Created
Source

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.

  • automatic-versioning by default, skips version bumping for special commits such as merge and revert commits.

Prerequisites

  • Git installed and configured

Installation

# using npm
npm install automatic-versioning

# using yarn
yarn add automatic-versioning

Usage

  • Add the following script to your package.json
  "scripts": {
      "bump-version": "yarn --cwd ./node_modules/automatic-versioning/ run bump-version --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

    - feat! - bump major version
    - feat  - bump minor version
    - fix   - bump patch version

Disable version bumping for specific commit

  • Add the following to your commit message: "--no-bump"
  // example command
  git commit -m "feat: some feature --no-bump"

Disable --no-bump commit message edit

  • By default automatic-versioning will edit the commit message in no-bump commits and remove the no-bump part from the commit message. Sometimes such as in the case of monorepos, this can prove to be a problem. To disable this behavior, add the following to your script: "--no-commit-edit"
  // example script:
  yarn --cwd ./node_modules/automatic-versioning/ run bump-version --name=<package_name> --no-commit-edit

Custom app directory to run incrementing script

  • Add the following argument to your bump script: "--rootDir=<custom_dir>"
  // example script:
  yarn --cwd ./node_modules/automatic-versioning/ run bump-version --name=<package_name> --rootDir=<custom_dir>

Keywords

automatic-versioning

FAQs

Package last updated on 13 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts