From 2e8478a13685c51fd9c52ed86411464dd28edc56 Mon Sep 17 00:00:00 2001 From: Bart van der Schoor Date: Tue, 7 Oct 2014 22:56:19 +0200 Subject: [PATCH] enabled tsc 1.1.0-1 updated definition-tester to 0.1.x updated npm run scripts added basic definition-tester semver check to runner.js --- _infrastructure/runner.js | 21 +++++++++++++++++++++ package.json | 18 +++++++++++------- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/_infrastructure/runner.js b/_infrastructure/runner.js index b9b9446ec..7d3f231c3 100644 --- a/_infrastructure/runner.js +++ b/_infrastructure/runner.js @@ -1 +1,22 @@ +var path = require('path'); +var fs = require('fs'); + +function readJSON(target) { + return JSON.parse(fs.readFileSync(target, 'utf8')); +} + +function getSemFloat(str) { + var m = /^[^\d]*(\d+)\.(\d+)/.exec(str); + return parseFloat(m[1] + '.' + m[2]); +} + +var repo = readJSON(path.resolve(__dirname, '..', 'package.json')); +var test = readJSON(path.resolve(__dirname, '..', 'node_modules', 'definition-tester', 'package.json')); + +// ultra lame semver major/minor check +if (getSemFloat(repo.dependencies['definition-tester']) > getSemFloat(test.version)) { + console.log('DefinitelyTyped tester needs an update!\n\n please run \'npm install\'\n'); + process.exit(1); +} + require('definition-tester'); diff --git a/package.json b/package.json index bd7966447..e5c3f2e26 100644 --- a/package.json +++ b/package.json @@ -20,16 +20,20 @@ "node": ">= 0.10.0" }, "scripts": { - "test": "node ./_infrastructure/runner.js --test-changes", - "changes": "node ./_infrastructure/runner.js --test-changes", - "lint": "node ./_infrastructure/runner.js --lint-changes", - "all": "node ./_infrastructure/runner.js", - "dry": "node ./_infrastructure/runner.js --skip-tests --test-changes", - "list": "node ./_infrastructure/runner.js --skip-tests --print-files --print-refmap", + "test": "node ./_infrastructure/runner.js --changes", + "changes": "node ./_infrastructure/runner.js --changes", + "lint": "node ./_infrastructure/runner.js --lint", + "tscparams": "node ./_infrastructure/runner.js --tscparams --no-tests --no-headers", + "all": "node ./_infrastructure/runner.js ", + "dry": "node ./_infrastructure/runner.js --dry --changes", + "list": "node ./_infrastructure/runner.js --dry --print-files --print-refmap", + "last": "node ./_infrastructure/runner.js --dry --print-files --print-refmap --changes", + "files": "node ./_infrastructure/runner.js --dry --print-files", + "refmap": "node ./_infrastructure/runner.js --dry --print-refmap", "help": "node ./_infrastructure/runner.js -h" }, "dependencies": { - "definition-tester": "~0.0.4" + "definition-tester": "~0.1.4" }, "devDependencies": {} }