{"id":16296101,"url":"https://github.com/imsnif/nmtree","last_synced_at":"2025-03-16T13:31:45.176Z","repository":{"id":48015904,"uuid":"111134961","full_name":"imsnif/nmtree","owner":"imsnif","description":"Get a (flat) tree representation of the modules in your node_modules folder","archived":false,"fork":false,"pushed_at":"2022-12-07T09:31:21.000Z","size":5210,"stargazers_count":14,"open_issues_count":5,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-02T02:25:44.047Z","etag":null,"topics":["javascript","nodejs","npm-package","npm-scripts"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imsnif.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-17T18:02:20.000Z","updated_at":"2023-09-06T18:51:10.000Z","dependencies_parsed_at":"2023-01-24T16:31:17.835Z","dependency_job_id":null,"html_url":"https://github.com/imsnif/nmtree","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imsnif%2Fnmtree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imsnif%2Fnmtree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imsnif%2Fnmtree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imsnif%2Fnmtree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imsnif","download_url":"https://codeload.github.com/imsnif/nmtree/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243817251,"owners_count":20352525,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","nodejs","npm-package","npm-scripts"],"created_at":"2024-10-10T20:21:17.593Z","updated_at":"2025-03-16T13:31:42.352Z","avatar_url":"https://github.com/imsnif.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nmtree\n\n[![Build Status](https://travis-ci.org/imsnif/nmtree.svg?branch=master)](https://travis-ci.org/imsnif/nmtree) [![Coverage Status](https://coveralls.io/repos/github/imsnif/nmtree/badge.svg?branch=master)](https://coveralls.io/github/imsnif/nmtree?branch=master) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\nGet a node_modules directory with all its `package.json` files as a parsable flat tree.\n\n![alt text](https://github.com/imsnif/nmtree/raw/master/docs/tty.gif )\n\n### what is this?\nGiven an npm library, this tool would recursively go through its `node_modules` and create a flat tree with the paths of libraries as keys and their parsed `package.json` files as values.\neg.\n```javascript\n{\n  \"myLib\": \u003cmyPackageJson\u003e,\n  \"myLib/node_modules/myDep\": \u003cdepPackageJson\u003e,\n  \"myLib/node_modules/myDep/node_modules/myOtherDep\": \u003cotherDepPackageJson\u003e\n}\n```\n### install\n`npm install -g nmtree` - for the cli tool\n\n`npm install nmtree` for the `require`-able library\n\n### usage\n```javascript\nconst nmtree = require('nmtree')\n\nconst libPath = '/path/to/my/lib'\nconst tree = nmtree(libPath)\n\nconst installedReactVersions = Object.keys(tree).reduce((versions, libPath) =\u003e {\n  const { name, version } = tree[libPath]\n  if (name === 'react') versions.push(version)\n  return versions\n}, [])\n// or whatever else you can think of!\n```\n\n### command line usage\n```\nnmtree /path/to/my/lib \u003e my-lib-node-modules.json\n```\n\n### License\nMIT\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimsnif%2Fnmtree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimsnif%2Fnmtree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimsnif%2Fnmtree/lists"}