{"id":18262894,"url":"https://github.com/midwayjs/midway-locate","last_synced_at":"2025-06-10T19:37:19.557Z","repository":{"id":42020012,"uuid":"231379609","full_name":"midwayjs/midway-locate","owner":"midwayjs","description":"locate your midway or midway-* project","archived":false,"fork":false,"pushed_at":"2022-04-18T05:07:20.000Z","size":301,"stargazers_count":3,"open_issues_count":1,"forks_count":4,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-04-04T20:36:30.260Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/midwayjs.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","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":"2020-01-02T12:40:49.000Z","updated_at":"2021-10-11T02:33:15.000Z","dependencies_parsed_at":"2022-07-24T23:32:18.371Z","dependency_job_id":null,"html_url":"https://github.com/midwayjs/midway-locate","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/midwayjs%2Fmidway-locate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/midwayjs%2Fmidway-locate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/midwayjs%2Fmidway-locate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/midwayjs%2Fmidway-locate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/midwayjs","download_url":"https://codeload.github.com/midwayjs/midway-locate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/midwayjs%2Fmidway-locate/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":257420559,"owners_count":22544113,"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-05T11:09:12.501Z","updated_at":"2025-06-10T19:37:19.503Z","avatar_url":"https://github.com/midwayjs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# midway locate\n\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/midwayjs/midway-locate/blob/master/LICENSE)\n[![GitHub tag](https://img.shields.io/github/tag/midwayjs/midway-locate.svg)]()\n[![Build Status](https://travis-ci.com/midwayjs/midway-locate.svg?branch=develop)](https://travis-ci.com/midwayjs/midway-locate)\n[![Test Coverage](https://img.shields.io/codecov/c/github/midwayjs/midway-locate/master.svg)](https://codecov.io/gh/midwayjs/midway-locate/branch/master)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/midwayjs/midway-locate/pulls)\n\n\n扫描仓库目录结构，找出 midway 的代码位置。\n\n## API\n\n```ts\nimport { Locator } from '@midwayjs/locate';\n\nconst locator = new Locator();\nconst result = await locator.run();\nconsole.log(result);\n```\n\n## Return\n\n- result\n  - `cwd` 当前命令执行路径，一般是项目根目录\n  - `midwayRoot` midway 项目根目录，根据 package.json 查找\n  - `tsCodeRoot` typescript 构建时获取的代码根路径，比如 src/controller/a.ts 和 src/controller/b.ts，tsc 构建时，会在 dist 目录中输出 a.js 和 b.js，这个时候根路径为 src/controller\n  - `tsConfigFilePath` tsconfig.json 的路径，从 tsCodeRoot 到 midwayRoot 之间的最接近的 tsconfig 文件\n  - `tsBuildRoot` 根据 tsconfig.json，获取到的构建输出的目录\n  - `integrationProject`: 是否是一体化项目\n  - `integrationProjectType`: 项目类型\n  - `usingDependencies`: 使用的依赖，一体化项目会根据 tsCodeRoot 分析使用的依赖（package.json 的子集），其他项目直接读取 package.json 中的依赖\n  - `usingDependenciesVersion`: 带版本，同上\n\n## 其他\n\n可以在 package.json 中传入 `tsCodeRoot` 和 `tsBuildRoot`，但是以 `run` 的参数为主。\n\n```json\n{\n  \"midway-integration\": {\n    \"tsCodeRoot\": \"src/apis\",\n    \"tsBuildRoot\": \"build/faas\"\n  }\n}\n```\n\n## 支持目录\n\n- [x] 纯 midway 项目\n- [x] midway + 前端（分目录）\n- [x] midway + 前端（合目录）\n- [x] 纯 midway-faas\n- [x] midway-faas + 前端（分目录）\n- [x] midway-faas + 前端（合目录）\n\n## License\n\n[MIT](http://github.com/midwayjs/midway-locate/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmidwayjs%2Fmidway-locate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmidwayjs%2Fmidway-locate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmidwayjs%2Fmidway-locate/lists"}