Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export VERSION information #794

Merged
merged 4 commits into from
Nov 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.

2 changes: 2 additions & 0 deletions scripts/release
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env bash
./scripts/version || exit $?

npm run build
npm run docs
npm run site
Expand Down
9 changes: 3 additions & 6 deletions scripts/tag
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#!/usr/bin/env bash
./scripts/version || exit $?

PACKAGE_VERSION=$(node -p "require('./package.json').version")

if [ $(git tag -l "$PACKAGE_VERSION") ]; then
echo "tag already exists"
else
git tag $PACKAGE_VERSION
git push origin master $PACKAGE_VERSION
fi
git tag $PACKAGE_VERSION
git push origin master $PACKAGE_VERSION
18 changes: 18 additions & 0 deletions scripts/version
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/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 [ $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
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