Skip to content

Instantly share code, notes, and snippets.

@ygalanter
Created February 16, 2023 00:56
Show Gist options
  • Save ygalanter/b67569388e844c5d83bad4f5df9adaa5 to your computer and use it in GitHub Desktop.
Save ygalanter/b67569388e844c5d83bad4f5df9adaa5 to your computer and use it in GitHub Desktop.
Script validating that curren version of a package is not the same as published version
#!/bin/bash
exit_status=0
# getting current version of the package
VER_NEW=$(node -e "console.log(require('./package.json').version);")
# getting version of published package
VER_OLD=$(npm view . version)
# the package has changed but the working version is the same as main version: failing test
if [ "$VER_NEW" = "$VER_OLD" ]
then
echo "FAILED: Same version as published package"
exit_status=1
# working version was bumped: test pass
else
echo "PASSED: Version bump OK"
fi
exit ${exit_status}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment