Validate that dependencies have valid licenses (#841)

This commit is contained in:
Kristian Dupont 2017-02-06 11:33:14 +01:00 committed by GitHub
parent bb0dc575c9
commit 9eaba13f12
3 changed files with 15 additions and 1 deletions

View File

@ -66,6 +66,7 @@
"eslint-plugin-jasmine": "^2.1.0",
"eslint-plugin-react": "^6.7.0",
"jsdoc": "^3.4.0",
"license-checker": "^8.0.3",
"mockery": "^2.0.0",
"semver": "^5.1.0"
},

View File

@ -62,7 +62,7 @@ git fetch origin || die 'Failed to fetch from git origin.'
[ -z "$(git rev-list origin/$BRANCH..HEAD)" ] || die 'Local commits are not pushed to origin.'
# Run all tests that must pass before publishing.
for test in eslint jsdoc realmjs react-example react-tests react-tests-android; do
for test in eslint jsdoc license-check realmjs react-example react-tests react-tests-android; do
for configuration in Debug Release; do
echo "RUNNING TEST: $test ($configuration)"
echo '----------------------------------------'

View File

@ -13,6 +13,8 @@ IOS_SIM_DEVICE=${IOS_SIM_DEVICE:-} # use preferentially, otherwise will be set a
ios_sim_default_device_type=${IOS_SIM_DEVICE_TYPE:-iPhone 5s}
ios_sim_default_ios_version=${IOS_SIM_OS:-iOS 10.1}
ACCEPTED_LICENSES='MIT, ISC, BSD, Apache-2.0, BSD-2-Clause, BSD-3-Clause, WTFPL, Unlicense, (MIT AND CC-BY-3.0)'
PATH="/opt/android-sdk-linux/platform-tools:$PATH"
SRCROOT=$(cd "$(dirname "$0")/.." && pwd)
XCPRETTY=$(which xcpretty || true)
@ -247,6 +249,17 @@ case "$TARGET" in
npm install
./node_modules/.bin/eslint -f checkstyle . > eslint.xml || true
;;
"license-check")
[[ $CONFIGURATION == 'Debug' ]] && exit 0
licenses=$(node_modules/.bin/license-checker --exclude "$ACCEPTED_LICENSES");
if [[ $licenses ]]; then
echo "Unknown license detected in dependency:"
node_modules/.bin/license-checker --exclude "$ACCEPTED_LICENSES"
exit 1
else
echo "All licenses are accepted"
fi
;;
"jsdoc")
[[ $CONFIGURATION == 'Debug' ]] && exit 0
npm install