From edf4cb576036d66b99226ded6ea0fcaf00fbdd13 Mon Sep 17 00:00:00 2001 From: blagoev Date: Mon, 20 Mar 2017 22:44:06 +0200 Subject: [PATCH] rewrite most test commands to be platform agnostic --- package.json | 12 +++++++++--- scripts/handle-license-check.js | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 scripts/handle-license-check.js diff --git a/package.json b/package.json index e3f140f9..8c28a109 100644 --- a/package.json +++ b/package.json @@ -44,15 +44,20 @@ "dependencies.list" ], "scripts": { - "get-version": "echo $npm_package_version", + "get-version": "node -p process.env.npm_package_version", "set-version": "scripts/set-version.sh", "get-core-version": "scripts/download-core.sh --version", "get-sync-version": "scripts/download-core.sh --versionSync", - "jsdoc": "rm -rf docs/output && jsdoc -u docs/tutorials -p package.json -c docs/conf.json", "lint": "eslint", "test": "scripts/test.sh", "install": "node-pre-gyp install --fallback-to-build", - "prepublish": "node scripts/prepublish.js" + "prepublish": "node scripts/prepublish.js", + "eslint": "npm install && npm run lint .", + "license-check": "license-checker --exclude MIT,ISC,BSD,Apache-2.0,BSD-2-Clause,BSD-3-Clause,WTFPL,Unlicense,(MIT AND CC-BY-3.0) | node scripts/handle-license-check.js", + "jsdoc:clean": "rimraf ./docs/output", + "jsdoc": "npm install && npm run jsdoc:clean && jsdoc -c docs/conf.json", + "node-tests": "npm install --build-from-source && cd tests && npm install && npm run test-nosync && cd ..", + "node-nosync-tests": "npm install --build-from-source && cd tests && npm install && npm run test-nosync && cd .." }, "dependencies": { "extract-zip": "^1.6.0", @@ -72,6 +77,7 @@ "jsdoc": "^3.4.0", "license-checker": "^8.0.3", "mockery": "^2.0.0", + "rimraf": "^2.6.1", "semver": "^5.1.0" }, "rnpm": { diff --git a/scripts/handle-license-check.js b/scripts/handle-license-check.js new file mode 100644 index 00000000..bacdca73 --- /dev/null +++ b/scripts/handle-license-check.js @@ -0,0 +1,19 @@ +#!/usr/bin/env node + +process.stdin.resume(); +process.stdin.setEncoding('utf8'); + +var licenseCheckerResult; + +process.stdin.on('data', function(data) { + licenseCheckerResult += data; +}); + +process.stdin.on('end', function() { + if (!licenseCheckerResult) { + console.log("All licenses are accepted"); + } else { + console.error("Unknown license detected in dependency:"); + console.error(licenseCheckerResult); + } +}); \ No newline at end of file