chore: replace all cn comments of fe to en version by volc api (#320)

This commit is contained in:
tecvan
2025-07-31 10:32:15 +08:00
committed by GitHub
parent 716ec0cba8
commit 71f6245a01
2960 changed files with 15545 additions and 15545 deletions

View File

@@ -1,79 +1,79 @@
# @coze-arch/monorepo-kits
## 功能概述
/* Function Overview */
`@coze-arch/monorepo-kits` 是一个用于管理 monorepo 项目的工具包,提供了基于 Rush 框架的项目查找、依赖分析和配置管理功能。
/* "@Coze-arch/monorepo-kits" is a toolkit for managing monorepo projects, providing project lookup, dependency analysis, and configuration management capabilities based on the Rush framework. */
## 主要功能模块
/* Main Functional Modules */
### 1. 子包管理 (sub-packages.ts)
/* ###1. Subpackage management (sub-packages.ts) */
#### lookupSubPackages(packageName: string): string[]
- **功能**: 递归查找指定包的所有子依赖包
- **特性**: 使用缓存机制避免重复计算
- **返回**: 所有依赖包的名称数组(去重后)
/* - ** Function **: Recursively find all child dependencies of the specified package */
/* - ** Features **: Use caching mechanism to avoid double counting */
/* - ** Returns **: Array of names of all dependent packages (after deduplicate) */
#### getPackageLocation(packageName: string): string
- **功能**: 获取指定包的文件系统路径
- **返回**: 包的项目文件夹路径
/* - ** Function **: Get the file system path of the specified package */
/* - ** return **: the project folder path of the package */
#### getPackageJson(packageName: string): RushConfigurationProject['packageJson']
- **功能**: 获取指定包的 package.json 配置信息
- **返回**: 包的 package.json 对象
/* - ** Function **: Get the package.json configuration information of the specified package */
/* - ** returns **: package's package.json object */
### 2. Rush 配置管理 (rush-config.ts)
/* ###2. Rush configuration management (rush-config.ts) */
#### getRushConfiguration(): RushConfiguration
- **功能**: 获取 Rush 配置实例
- **特性**: 单例模式,首次调用时从默认位置加载配置,后续调用复用实例
- **返回**: RushConfiguration 对象
/* - ** Features **: Get Rush Configuration Instance */
/* - ** Features **: Singleton mode, first call loads configuration from default location, subsequent calls reuse instance */
/* - ** returns **: RushConfiguration object */
### 3. 项目查找 (lookup.ts)
/* ###3. Project lookup (lookup.ts) */
#### lookupTo(to: string): string[]
- **功能**: 查找指定包的直接依赖项
- **参数**: 目标包名称
- **返回**: 依赖包名称数组
/* - ** Features **: Find direct dependencies of a specified package */
/* - ** Parameter **: Target package name */
/* - ** Returns **: Array of dependency package names */
#### lookupFrom(from: string): void
- **功能**: 查找从指定包出发的相关信息(当前实现不完整)
- **参数**: 源包名称
/* - ** Features **: Find information about outgoing from a specified package (current implementation is incomplete) */
/* - ** parameter **: source package name */
#### lookupOnly(packageName: string): RushConfigurationProject
- **功能**: 查找并返回指定包的项目配置对象
- **参数**: 包名称
- **返回**: 完整的项目配置对象
/* - ** Features **: Find and return the project configuration object of the specified package */
/* - ** parameter **: package name */
/* - ** Return **: complete project configuration object */
## 依赖关系
/* ##dependencies */
- **主要依赖**: `@rushstack/rush-sdk@5.100.2`
- **开发依赖**: 包含 ESLintTypeScriptVitest 等工具链
/* - ** Major dependencies **: '@rushstack/rush-sdk@5.100.2' */
/* - ** Development dependencies **: Includes ESLint, TypeScript, Vitest and other toolchains */
## 使用场景
/* ##usage scenario */
1. **依赖分析**: 分析 monorepo 中包之间的依赖关系
2. **路径解析**: 获取包在文件系统中的实际位置
3. **配置查询**: 查询包的配置信息和元数据
4. **自动化工具**: 为构建脚本、部署工具等提供 monorepo 项目信息
/* 1. ** Dependency Analysis **: Analyze the dependencies between packages in Monorepo */
/* 2. ** Path parsing **: Get the actual location of the package in the file system */
/* 3. ** Configuration query **: Query the configuration information and metadata of the package */
/* 4. ** Automation Tools **: Provide monorepo project information for build scripts, deployment tools, etc */
## 架构特点
/* ##Architecture Features */
- **缓存优化**: 对递归依赖查找进行缓存,提高性能
- **错误处理**: 包含完善的包不存在异常处理
- **单例模式**: Rush 配置采用单例模式,避免重复加载
- **类型安全**: 基于 TypeScript提供完整的类型定义
/* - ** Cache optimization **: Cache recursive dependency lookups to improve performance */
/* - ** Error Handling **: Includes perfect package without exception handling */
/* - ** Singleton mode **: Rush configuration adopts singleton mode to avoid repeated loading */
/* Type safety: Based on TypeScript, complete type definition is provided */
## 代码结构
/* ##Code structure */
```
src/
├── index.ts # 主入口文件,导出所有公共 API
├─sub-packages.ts # 子包管理和依赖查找功能
├── rush-config.ts # Rush 配置管理
└── lookup.ts # 项目查找相关功能
/* < unk > ─ index.ts #Main entry file, export all public APIs */
/* < unk > Sub-packages.ts #Subpackage management and dependency lookup function */
/* 🥰 ─ rush-config.ts #Rush configuration management */
/* 🥰 ─ ─ lookup.ts #Project lookup related functions */
```
## API 导出
/* ##API export */
```typescript
export {
@@ -87,4 +87,4 @@ export { getRushConfiguration } from './rush-config';
export { lookupTo, lookupFrom, lookupOnly } from './lookup';
```
这个工具包为 monorepo 环境下的包管理、依赖分析和自动化工具开发提供了基础支持。
/* This toolkit provides fundamental support for package management, dependency analysis, and automated tool development in Monorepo environments. */