Browse Source

Stop using Babel for types/make.js

replace-snapshot
Mark Wubben 8 years ago
parent
commit
95ff309a4f
  1. 3
      package.json
  2. 8
      types/make.js

3
package.json

@ -47,7 +47,7 @@
"test-win": "tap --no-cov --reporter=classic --timeout=150 test/*.js test/reporters/*.js", "test-win": "tap --no-cov --reporter=classic --timeout=150 test/*.js test/reporters/*.js",
"visual": "node test/visual/run-visual-tests.js", "visual": "node test/visual/run-visual-tests.js",
"prepublish": "npm run make-ts", "prepublish": "npm run make-ts",
"make-ts": "babel-node --presets=babel-preset-es2015-node4 --plugins=transform-runtime types/make.js" "make-ts": "node types/make.js"
}, },
"files": [ "files": [
"lib", "lib",
@ -168,7 +168,6 @@
"update-notifier": "^1.0.0" "update-notifier": "^1.0.0"
}, },
"devDependencies": { "devDependencies": {
"babel-cli": "^6.10.1",
"babel-preset-react": "^6.5.0", "babel-preset-react": "^6.5.0",
"cli-table2": "^0.2.0", "cli-table2": "^0.2.0",
"coveralls": "^2.11.4", "coveralls": "^2.11.4",

8
types/make.js

@ -16,7 +16,7 @@ const path = require('path');
const fs = require('fs'); const fs = require('fs');
const runner = require('../lib/runner'); const runner = require('../lib/runner');
const arrayHas = parts => part => parts.includes(part); const arrayHas = parts => part => parts.indexOf(part) > -1;
const base = fs.readFileSync(path.join(__dirname, 'base.d.ts'), 'utf8'); const base = fs.readFileSync(path.join(__dirname, 'base.d.ts'), 'utf8');
@ -35,7 +35,7 @@ function generatePrefixed(prefix) {
for (const part of allParts) { for (const part of allParts) {
const parts = prefix.concat([part]); const parts = prefix.concat([part]);
if (prefix.includes(part) || !verify(parts, true)) { if (prefix.indexOf(part) > -1 || !verify(parts, true)) {
// Function already in prefix or not allowed here // Function already in prefix or not allowed here
continue; continue;
} }
@ -55,7 +55,7 @@ function generatePrefixed(prefix) {
// `always` is a valid prefix, for instance of `always.after`, // `always` is a valid prefix, for instance of `always.after`,
// but not a valid function name. // but not a valid function name.
if (verify(parts, false)) { if (verify(parts, false)) {
if (parts.includes('todo')) { if (parts.indexOf('todo') > -1) {
output += '\t' + writeFunction(part, 'name: string', 'void'); output += '\t' + writeFunction(part, 'name: string', 'void');
} else { } else {
const type = testType(parts); const type = testType(parts);
@ -139,7 +139,7 @@ function exists(parts) {
// Valid prefix, check whether it has members // Valid prefix, check whether it has members
for (const prefix of allParts) { for (const prefix of allParts) {
if (!parts.includes(prefix) && exists(parts.concat([prefix]))) { if (parts.indexOf(prefix) === -1 && exists(parts.concat([prefix]))) {
return true; return true;
} }
} }

Loading…
Cancel
Save