Skip to content

Instantly share code, notes, and snippets.

@juristr
Created September 27, 2023 13:44
Show Gist options
  • Save juristr/16455ddcaf38676c9ebb87d561b4d705 to your computer and use it in GitHub Desktop.
Save juristr/16455ddcaf38676c9ebb87d561b4d705 to your computer and use it in GitHub Desktop.
const { createProjectGraphAsync } = require('@nx/devkit');
const projectName = 'reactapp1'; // <<<< change this to your app name or parameterize
createProjectGraphAsync().then((projectGraph) => {
const project = projectGraph.nodes[projectName];
if (!project) {
throw new Error(`Project '${projectName}' not found in the workspace.`);
}
const dependencies = projectGraph.dependencies[projectName];
if (!dependencies) {
console.log('no deps found');
}
const npmPackages = dependencies
.filter((dep) => dep.target.startsWith('npm:'))
.map((dep) => dep.target);
console.log(npmPackages);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment