Skip to content

Commit 48d8f8f

Browse files
hcharleywraithgar
authored andcommittedApr 10, 2023
feat: export new RELEASE_TYPES constant
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
1 parent f66cc45 commit 48d8f8f

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed
 

‎index.js

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ module.exports = {
8383
src: internalRe.src,
8484
tokens: internalRe.t,
8585
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
86+
RELEASE_TYPES: constants.RELEASE_TYPES,
8687
compareIdentifiers: identifiers.compareIdentifiers,
8788
rcompareIdentifiers: identifiers.rcompareIdentifiers,
8889
}

‎internal/constants.js

+13-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,20 @@ const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
99
// Max safe segment length for coercion.
1010
const MAX_SAFE_COMPONENT_LENGTH = 16
1111

12+
const RELEASE_TYPES = [
13+
'major',
14+
'premajor',
15+
'minor',
16+
'preminor',
17+
'patch',
18+
'prepatch',
19+
'prerelease',
20+
]
21+
1222
module.exports = {
13-
SEMVER_SPEC_VERSION,
1423
MAX_LENGTH,
15-
MAX_SAFE_INTEGER,
1624
MAX_SAFE_COMPONENT_LENGTH,
25+
MAX_SAFE_INTEGER,
26+
RELEASE_TYPES,
27+
SEMVER_SPEC_VERSION,
1728
}

0 commit comments

Comments
 (0)
Please sign in to comment.