Skip to content

Commit

Permalink
Export hardcoded VERSION variable
Browse files Browse the repository at this point in the history
For a less bold approach, the exported VERSION variable is now
hardcoded. Meanwhile, the `scripts/tag` script was improved to
ensure that all versions match.

See #800 (comment).

Resolves #747 and #799.
  • Loading branch information
pgcalixto committed Oct 8, 2020
1 parent 3325dff commit ffd2952
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 16 additions & 5 deletions scripts/tag
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
#!/usr/bin/env bash

abort() {
echo "ERROR: $1"
exit 1
}

PACKAGE_VERSION=$(node -p "require('./package.json').version")
PACKAGE_LOCK_VERSION=$(node -p "require('./package-lock.json').version")
EXPORTED_VERSION=$(grep -oP "(?<=const VERSION = \").*(?=\";)" ./src/luxon.js)

if [ $(git tag -l "$PACKAGE_VERSION") ]; then
echo "tag already exists"
else
git tag $PACKAGE_VERSION
git push origin master $PACKAGE_VERSION
if [ $PACKAGE_VERSION != $PACKAGE_LOCK_VERSION ]; then
abort "package-lock.json's version differs from package.json's"
elif [ $PACKAGE_VERSION != $EXPORTED_VERSION ]; then
abort "exported version differs from package.json's"
elif [ $(git tag -l "$PACKAGE_VERSION") ]; then
abort "tag already exists"
fi

git tag $PACKAGE_VERSION
git push origin master $PACKAGE_VERSION
3 changes: 3 additions & 0 deletions src/luxon.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import InvalidZone from "./zones/invalidZone.js";
import LocalZone from "./zones/localZone.js";
import Settings from "./settings.js";

const VERSION = "1.25.0";

export {
VERSION,
DateTime,
Duration,
Interval,
Expand Down

0 comments on commit ffd2952

Please sign in to comment.