{"id":17398497,"url":"https://github.com/vweevers/common-roots","last_synced_at":"2025-03-29T20:15:42.102Z","repository":{"id":55828368,"uuid":"93436132","full_name":"vweevers/common-roots","owner":"vweevers","description":"Find root directories (containing .git or other)","archived":false,"fork":false,"pushed_at":"2021-09-08T14:51:21.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T21:39:05.371Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/vweevers.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":"2017-06-05T18:49:04.000Z","updated_at":"2021-09-08T14:51:24.000Z","dependencies_parsed_at":"2022-08-15T07:31:19.481Z","dependency_job_id":null,"html_url":"https://github.com/vweevers/common-roots","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fcommon-roots","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fcommon-roots/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fcommon-roots/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fcommon-roots/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vweevers","download_url":"https://codeload.github.com/vweevers/common-roots/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246237436,"owners_count":20745348,"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-10-16T14:57:34.872Z","updated_at":"2025-03-29T20:15:42.065Z","avatar_url":"https://github.com/vweevers.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# common-roots\n\n**Given some files, find their root directories (containing some identifying file like `.git`, `package.json`, etc). For files in the same root directory, it does a single lookup.**\n\n[![npm status](http://img.shields.io/npm/v/common-roots.svg?style=flat-square)](https://www.npmjs.org/package/common-roots) [![node](https://img.shields.io/node/v/common-roots.svg?style=flat-square)](https://www.npmjs.org/package/common-roots) [![Travis build status](https://img.shields.io/travis/vweevers/common-roots.svg?style=flat-square\u0026label=travis)](http://travis-ci.org/vweevers/common-roots) [![AppVeyor build status](https://img.shields.io/appveyor/ci/vweevers/common-roots.svg?style=flat-square\u0026label=appveyor)](https://ci.appveyor.com/project/vweevers/common-roots) [![Dependency status](https://img.shields.io/david/vweevers/common-roots.svg?style=flat-square)](https://david-dm.org/vweevers/common-roots)\n\n## example\n\n```js\nconst roots = require('common-roots')\nconst files = ['/repo1/a.js', '/repo2/lib', '/repo1/a/b/c']\n\nroots(files, '.git', (err, roots) =\u003e {\n  // roots is ['/repo1', '/repo2']\n})\n```\n\n## `roots(files, id, done)`\n\n- files: array of files (relative paths are resolved from cwd)\n- id: relative path to some file that identifies the root directory\n- callback: receives an error (if one of the files has no root directory) or an array of absolute root directories.\n\n## install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install common-roots\n```\n\n## license\n\n[MIT](http://opensource.org/licenses/MIT) © Vincent Weevers\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvweevers%2Fcommon-roots","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvweevers%2Fcommon-roots","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvweevers%2Fcommon-roots/lists"}