File: version

package info (click to toggle)
node-luxon 3.7.2%2B~3.7.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,560 kB
  • sloc: javascript: 14,996; sh: 195; makefile: 7
file content (28 lines) | stat: -rwxr-xr-x 839 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env bash

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

if [[ -x $(which ggrep) ]]
then
  grepper='ggrep'
else
  grepper='grep'
fi

PACKAGE_VERSION=$(node -p "require('./package.json').version")
PACKAGE_LOCK_VERSION=$(node -p "require('./package-lock.json').version")
MODULE_VERSION=$(node -p "require('./src/package.json').version")
EXPORTED_VERSION=$($grepper -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 [ $PACKAGE_VERSION != $MODULE_VERSION ]; then
  abort "src/package.json differs from package.json's"
elif [ $(git tag -l "$PACKAGE_VERSION") ]; then
  abort "tag already exists"
fi