Skip to content

Commit

Permalink
feat: export new RELEASE_TYPES constant
Browse files Browse the repository at this point in the history
Which will help library consumers better integrate semver into their apps.

Possible usecases of consuming this constant:

- Automatically show a dropdown of available release types that conform to the semver spec
- Validate user inputs where a release type is expected
  • Loading branch information
hcharley authored and wraithgar committed Apr 10, 2023
1 parent f66cc45 commit 48d8f8f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ module.exports = {
src: internalRe.src,
tokens: internalRe.t,
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
RELEASE_TYPES: constants.RELEASE_TYPES,
compareIdentifiers: identifiers.compareIdentifiers,
rcompareIdentifiers: identifiers.rcompareIdentifiers,
}
15 changes: 13 additions & 2 deletions internal/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,20 @@ const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
// Max safe segment length for coercion.
const MAX_SAFE_COMPONENT_LENGTH = 16

const RELEASE_TYPES = [
'major',
'premajor',
'minor',
'preminor',
'patch',
'prepatch',
'prerelease',
]

module.exports = {
SEMVER_SPEC_VERSION,
MAX_LENGTH,
MAX_SAFE_INTEGER,
MAX_SAFE_COMPONENT_LENGTH,
MAX_SAFE_INTEGER,
RELEASE_TYPES,
SEMVER_SPEC_VERSION,
}

0 comments on commit 48d8f8f

Please sign in to comment.