-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(build): fix script to fix sem-ver
- Loading branch information
Showing
3 changed files
with
27 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,23 @@ | ||
#! /bin/bash | ||
latest_version=$(npm info node version); | ||
|
||
# Thanks to Night Train: | ||
# https://stackoverflow.com/questions/48250235/how-to-setup-travis-to-skip-script-on-particular-nodejs-version | ||
# https://docs.travis-ci.com/user/customizing-the-build/#Implementing-Complex-Build-Steps | ||
# | ||
# To use this, create this file (e.g. under scripts folder: ./scripts/run-on-node-version.sh) | ||
# and give it execution permission: chmod ugo+x scripts/run-on-node-version.sh | ||
# Then you can use it in CI configurations, e.g. .travis.yml: | ||
# - ./scripts/run-on-node-version.sh latest "npm install --no-save coveralls && npm run coveralls" | ||
|
||
if [ $1 = 'latest' ]; then | ||
target_version=$(npm info node version); | ||
else | ||
target_version=$1; | ||
fi | ||
node_version=$(node -v); | ||
if [ ${node_version:1:1} = ${latest_version:0:1} ]; then | ||
eval $1; | ||
if [ ${node_version:1:1} = ${target_version:0:1} ]; then | ||
echo "Detected ${node_version}, satisfying ${target_version}. Executing command"; | ||
eval $2; | ||
else | ||
echo "NodeJS ${node_version} instead of latest (${latest_version:0:1}) is detected. Skipping command"; | ||
echo "NodeJS ${node_version} instead of latest (${target_version:0:1}) is detected. Skipping command"; | ||
fi |