-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
provide a way to list lerna deps as an adjacency matrix #1970
Conversation
This seems a bit too special-cased to be a top-level CLI option, better suited for a third-party tool that reuses existing lerna packages. #!/usr/bin/env node
const { getPackages } = require('@lerna/project');
const PackageGraph = require('@lerna/package-graph');
(async function () {
const cwd = process.cwd(); // or process.argv?
const pkgs = await getPackages(cwd);
const graph = new PackageGraph(pkgs);
const json = {};
graph.forEach((node, name) => {
json[name] = [
...node.externalDependencies.keys(),
...node.localDependencies.keys(),
].sort();
});
console.log(JSON.stringify(json, null, 2));
})(); Copy that code, paste it into a script file, and you can get output like this (when run on the lerna source): Adjacency graph of |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Description
For large monorepo there is a need to show packages dependencies , i added a 'graph' option to lerna 'list' command in order to print out a json showing dependencies for each package.
Dependency graph could then be rendered using a nice tool such as https://www.npmjs.com/package/dependo
Types of changes
Checklist: