diff --git a/scripts/generate-missing-apis-list b/scripts/generate-missing-apis-list new file mode 100755 index 0000000..2eb6cdb --- /dev/null +++ b/scripts/generate-missing-apis-list @@ -0,0 +1,54 @@ +#!/usr/bin/env node + +const got = require('got'); +const chalk = require("chalk"); + +const globals = require("../globals.json"); + +got('http://builds.emberjs.com/canary/ember-docs.json').then(response => { + let json = JSON.parse(response.body); + processJSON(json); + +}).catch(error => { + console.error(chalk.red(error)); +}); + +function processJSON(json) { + let staticClasses = Object.keys(json.classes) + .map(it => json.classes[it]) + .filter(it => it.static) + .map(it => it.name); + + json.classitems + .filter(it => it.access === 'public') + .filter(it => staticClasses.indexOf(it.class) !== -1) + .forEach(it => { + if (!it.name) { return; } + + let globalName = `${it.class}.${it.name}`; + let globalsKey = globalName.replace(/^Ember\./, ''); + let newImport = globals[globalsKey]; + + if (newImport) { + console.log(chalk.green(`${globalName} -> ${newImport}`)); + } else { + console.log(chalk.red(`${globalName} -> ?`)); + } + }); + + Object.keys(json.classes) + .map(it => json.classes[it]) + .filter(it => !it.static) + .filter(it => it.access === 'public') + .forEach(it => { + let globalName = it.name; + let globalsKey = globalName.replace(/^Ember\./, ''); + let newImport = globals[globalsKey]; + + if (newImport) { + console.log(chalk.green(`${globalName} -> ${newImport}`)); + } else { + console.log(chalk.red(`${globalName} -> ?`)); + } + }) +}