Skip to content

Instantly share code, notes, and snippets.

@jacobq
Created March 17, 2017 15:09
Show Gist options
  • Save jacobq/d7e2c718a1bce99146ada8079955c264 to your computer and use it in GitHub Desktop.
Save jacobq/d7e2c718a1bce99146ada8079955c264 to your computer and use it in GitHub Desktop.
Get list of all ember addons in a project
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