Created
September 27, 2023 13:44
-
-
Save juristr/16455ddcaf38676c9ebb87d561b4d705 to your computer and use it in GitHub Desktop.
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 { 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