Skip to content

Commit

Permalink
feat: upgrades check_version
Browse files Browse the repository at this point in the history
  • Loading branch information
tuliomir committed Nov 22, 2024
1 parent 324c04a commit 548551b
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions scripts/check_version
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
#!/bin/bash

SRC_VERSION=`grep "const VERSION " ./src/constants.js | cut -d"'" -f2`
set -e # Exit on any command failure.
set -u # Exit on unset variables.

PACKAGE_VERSION=`grep '"version":' ./package.json | cut -d '"' -f4`
PACKAGE_LOCK_VERSION=`node -p "require('./package-lock.json').version"`
PACKAGE_LOCK_VERSION_2=`node -p "require('./package-lock.json').packages[''].version"`

# For debugging:
# echo x${SRC_VERSION}x
# echo x${PACKAGE_VERSION}x
# echo x${PACKAGE_LOCK_VERSION}x
# echo x${PACKAGE_LOCK_VERSION_2}x

EXITCODE=0

if [[ x${PACKAGE_VERSION}x != x${SRC_VERSION}x ]]; then
echo Version different in package.json and src/constants.js
if [[ x${PACKAGE_VERSION}x != x${PACKAGE_LOCK_VERSION}x ]]; then
echo Version different in package.json and package-lock.json
EXITCODE=-1
fi

if [[ x${PACKAGE_VERSION}x != x${PACKAGE_LOCK_VERSION_2}x ]]; then
echo Version different in package.json and the packages property in package-lock.json
EXITCODE=-1
fi

exit $EXITCODE
exit $EXITCODE

0 comments on commit 548551b

Please sign in to comment.