{"id":20806324,"url":"https://github.com/nodesource/universal-module-tree","last_synced_at":"2025-05-11T17:31:48.376Z","repository":{"id":55145909,"uuid":"150324128","full_name":"nodesource/universal-module-tree","owner":"nodesource","description":"Get a module tree from package-lock.json / yarn.lock / node_modules","archived":true,"fork":false,"pushed_at":"2021-01-07T07:08:18.000Z","size":290,"stargazers_count":11,"open_issues_count":0,"forks_count":3,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-04-19T22:16:54.082Z","etag":null,"topics":[],"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/nodesource.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-25T20:18:11.000Z","updated_at":"2025-02-03T16:49:23.000Z","dependencies_parsed_at":"2022-08-14T13:30:32.444Z","dependency_job_id":null,"html_url":"https://github.com/nodesource/universal-module-tree","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodesource%2Funiversal-module-tree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodesource%2Funiversal-module-tree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodesource%2Funiversal-module-tree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodesource%2Funiversal-module-tree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nodesource","download_url":"https://codeload.github.com/nodesource/universal-module-tree/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253604877,"owners_count":21934912,"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":[],"created_at":"2024-11-17T19:19:18.970Z","updated_at":"2025-05-11T17:31:48.044Z","avatar_url":"https://github.com/nodesource.png","language":"JavaScript","readme":"# universal-module-tree\n\n[![Build Status](https://travis-ci.org/nodesource/universal-module-tree.svg?branch=master)](https://travis-ci.org/nodesource/universal-module-tree)\n\nGet a full module tree from `package-lock.json`, `yarn.lock` or `node_modules/**`.\n\n## Usage\n\n```js\nconst getTree = require('universal-module-tree')\n\nconst tree = await getTree(__dirname)\nconsole.log(JSON.stringify(tree, null, 2))\n```\n\n```bash\n$ node example.js | head -n25\n{\n  \"children\": [\n    {\n      \"data\": {\n        \"name\": \"@yarnpkg/lockfile\",\n        \"version\": \"1.1.0\"\n      },\n      \"children\": []\n    },\n    {\n      \"data\": {\n        \"name\": \"read-package-tree\",\n        \"version\": \"5.2.1\"\n      },\n      \"children\": [\n        {\n          \"data\": {\n            \"name\": \"debuglog\",\n            \"version\": \"1.0.1\"\n          },\n          \"children\": []\n        },\n        {\n          \"data\": {\n            \"name\": \"dezalgo\",\n\n```\n\nOr with [NSolid](https://nodesource.com/products/nsolid):\n\n```js\nconst getTree = require('universal-module-tree')\n\nnsolid.packages((err, packages) =\u003e {\n  if (err) throw err\n  const tree = getTree.fromNSolid(packages)\n  console.log(JSON.stringify(tree, null, 2))\n})\n```\n\n## Installation\n\n```bash\n$ npm install universal-module-tree\n```\n\n## API\n\n### getTree(dir, { noDev = false }) =\u003e `Promise`\n### getTree.fromPackageLock({ packageLock, packageJSON, noDev = false }) =\u003e `Object`\n### getTree.fromYarnLock({ yarnLock, packageJSON, noDev = false }) =\u003e `Object`\n### getTree.fromNodeModules(path, { noDev = false }) =\u003e `Promise`\n### getTree.fromNSolid(packages) =\u003e `Object`\n### getTree.flatten(tree) =\u003e `Array`\n\n### Options\n\n- `noDev`: exclude `devDependencies`\n\n## License \u0026 copyright\n\nCopyright \u0026copy; NodeSource.\n\nLicensed under the MIT open source license, see the LICENSE file for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodesource%2Funiversal-module-tree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnodesource%2Funiversal-module-tree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodesource%2Funiversal-module-tree/lists"}