Created
March 17, 2017 15:09
-
-
Save jacobq/d7e2c718a1bce99146ada8079955c264 to your computer and use it in GitHub Desktop.
Get list of all ember addons in a project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
const rootPackage = require('./package.json'); | |
let output = ""; | |
['dependencies', 'devDependencies'].forEach((depType) => { | |
let deps = rootPackage[depType]; | |
if (!deps) | |
return; | |
Object.keys(deps).forEach((name) => { | |
try { | |
let depPackage = require(path.resolve('node_modules', name, 'package.json')); | |
if (depPackage.keywords instanceof Array && depPackage.keywords.includes('ember-addon')) | |
output += `${name}\n`; | |
else | |
console.log(`Skipping ${name} since it is not an ember addon`); | |
} catch (err) { | |
console.warn(`Caught error while processing ${name}`, err); | |
} | |
}); | |
}); | |
console.log(output); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment