https://github.com/midwayjs/midway-locate
locate your midway or midway-* project
https://github.com/midwayjs/midway-locate
Last synced: 16 days ago
JSON representation
locate your midway or midway-* project
- Host: GitHub
- URL: https://github.com/midwayjs/midway-locate
- Owner: midwayjs
- License: mit
- Created: 2020-01-02T12:40:49.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-04-18T05:07:20.000Z (about 3 years ago)
- Last Synced: 2025-04-04T20:36:30.260Z (3 months ago)
- Language: TypeScript
- Size: 294 KB
- Stars: 3
- Watchers: 20
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: History.md
- License: LICENSE
Awesome Lists containing this project
README
# midway locate
[](https://github.com/midwayjs/midway-locate/blob/master/LICENSE)
[]()
[](https://travis-ci.com/midwayjs/midway-locate)
[](https://codecov.io/gh/midwayjs/midway-locate/branch/master)
[](https://github.com/midwayjs/midway-locate/pulls)扫描仓库目录结构,找出 midway 的代码位置。
## API
```ts
import { Locator } from '@midwayjs/locate';const locator = new Locator();
const result = await locator.run();
console.log(result);
```## Return
- result
- `cwd` 当前命令执行路径,一般是项目根目录
- `midwayRoot` midway 项目根目录,根据 package.json 查找
- `tsCodeRoot` typescript 构建时获取的代码根路径,比如 src/controller/a.ts 和 src/controller/b.ts,tsc 构建时,会在 dist 目录中输出 a.js 和 b.js,这个时候根路径为 src/controller
- `tsConfigFilePath` tsconfig.json 的路径,从 tsCodeRoot 到 midwayRoot 之间的最接近的 tsconfig 文件
- `tsBuildRoot` 根据 tsconfig.json,获取到的构建输出的目录
- `integrationProject`: 是否是一体化项目
- `integrationProjectType`: 项目类型
- `usingDependencies`: 使用的依赖,一体化项目会根据 tsCodeRoot 分析使用的依赖(package.json 的子集),其他项目直接读取 package.json 中的依赖
- `usingDependenciesVersion`: 带版本,同上## 其他
可以在 package.json 中传入 `tsCodeRoot` 和 `tsBuildRoot`,但是以 `run` 的参数为主。
```json
{
"midway-integration": {
"tsCodeRoot": "src/apis",
"tsBuildRoot": "build/faas"
}
}
```## 支持目录
- [x] 纯 midway 项目
- [x] midway + 前端(分目录)
- [x] midway + 前端(合目录)
- [x] 纯 midway-faas
- [x] midway-faas + 前端(分目录)
- [x] midway-faas + 前端(合目录)## License
[MIT](http://github.com/midwayjs/midway-locate/blob/master/LICENSE)