From 58fe46dc8377aaa43686831e36ba6c2d874e90d9 Mon Sep 17 00:00:00 2001 From: hacksalot Date: Fri, 9 Feb 2018 21:32:44 -0500 Subject: [PATCH] feat: introduce FRESH version regex --- dist/utils/fresh-version-regex.js | 14 ++++++++++++++ src/utils/fresh-version-regex.coffee | 23 +++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 dist/utils/fresh-version-regex.js create mode 100644 src/utils/fresh-version-regex.coffee diff --git a/dist/utils/fresh-version-regex.js b/dist/utils/fresh-version-regex.js new file mode 100644 index 0000000..1f27393 --- /dev/null +++ b/dist/utils/fresh-version-regex.js @@ -0,0 +1,14 @@ + +/** +Defines a regex suitable for matching FRESH versions. +@module file-contains.js + */ + +(function() { + module.exports = function() { + return RegExp('^(FRESH|FRESCA|JRS)(?:@(\\d+(?:\\.\\d+)?(?:\\.\\d+)?))?$'); + }; + +}).call(this); + +//# sourceMappingURL=fresh-version-regex.js.map diff --git a/src/utils/fresh-version-regex.coffee b/src/utils/fresh-version-regex.coffee new file mode 100644 index 0000000..1c7f25b --- /dev/null +++ b/src/utils/fresh-version-regex.coffee @@ -0,0 +1,23 @@ +###* +Defines a regex suitable for matching FRESH versions. +@module file-contains.js +### + +# Set up a regex that matches all of the following: +# +# - FRESH +# - JRS +# - FRESCA +# - FRESH@1.0.0 +# - FRESH@1.0 +# - FRESH@1 +# - JRS@0.16.0 +# - JRS@0.16 +# - JRS@0 +# +# Don't use a SEMVER regex (eg, NPM's semver-regex) because a) we want to +# support partial semvers like "0" or "1.2" and b) we'll expand this later to +# support fully scoped FRESH versions. + +module.exports = () -> + RegExp '^(FRESH|FRESCA|JRS)(?:@(\\d+(?:\\.\\d+)?(?:\\.\\d+)?))?$'