Function nextVersion

  • return the next version, Only version types with no more than 3 digits are supported. (Follow the npm version rules)

    Parameters

    • version: string

      version(like: 1.0.0)

    • Optionaltype:
          | "major"
          | "minor"
          | "patch"
          | "premajor"
          | "preminor"
          | "prepatch"
          | "prerelease"

      optional, version type

    • preid: string = ''

      optional, prerelease id

    Returns string

    • new version
    nextVersion('1.2.33') // 1.2.34

    nextVersion('1.2.33', 'major') // 2.0.0

    nextVersion('1.2.33', 'premajor', 'alpha') // 2.0.0-alpha.1

    5.10.0