框架检测
。
安装
tnpm install @tencent/framework-detect
使用方法
本地检测
import { describeFramework } from '@tencent/framework-detect';
// 检测项目框架
const frameworkInfo = await describeFramework('./my-project');
console.log(frameworkInfo);
远程仓库检测
· GitHub、Gitee、GitLab、Bitbucket 四大平台的远程仓库检测。
GitHub 图像
import { describeFrameworkRemote } from '@tencent/framework-detect';
// 公开仓库(无认证,有速率限制)
const result = await describeFrameworkRemote({
Provider: "Github",
Namespace: "vercel",
RepoName: "next.js",
RootDir: "examples/blog",
});
// 私有仓库(需要 Token)
const result = await describeFrameworkRemote({
Provider: "Github",
Namespace: "your-org",
RepoName: "your-repo",
}, {
Token: "ghp_xxxxx", // GitHub Personal Access Token
});
齿轮
const result = await describeFrameworkRemote({
Provider: "Gitee",
Namespace: "oschina",
RepoName: "gitee",
}, {
Token: "your_gitee_token",
});
吉特拉布语Name
// 支持 gitlab.com 和自建实例
const result = await describeFrameworkRemote({
Provider: "Gitlab",
Namespace: "gitlab-org",
RepoName: "gitlab",
Branch: "master",
}, {
Token: "glpat-xxxxx",
BaseUrl: "https://gitlab.com", // 自建实例请修改此 URL
});
键盘
// Bitbucket Cloud
const result = await describeFrameworkRemote({
Provider: "Bitbucket",
Namespace: "atlassian",
RepoName: "stash-example-plugin",
Branch: "master",
}, {
Token: "your_app_password", // App Password 或 OAuth Token
});
// Bitbucket Data Center(自建)
const result = await describeFrameworkRemote({
Provider: "Bitbucket",
Namespace: "PROJECT_KEY",
RepoName: "repo-slug",
}, {
Token: "your_personal_access_token",
BaseUrl: "https://bitbucket.example.com",
});
零点点数 (原始内容存档于2013-10-12). Bitbucket Guide.md
API 密码
describeFramework(projectRoot: string): Promise<FrameworkInfo>
{\fn黑体\fs22\bord1\shad0\3aHBE\4aH00\fscx67\fscy66\2cHFFFFFF\3cH808080}你觉得怎么样。
参数:
projectRoot(字符串): 项目根目录路径
返回值:
Promise<FrameworkInfo>时间轴:
describeFrameworkRemote(body: GitProviderBody, auth?: any): Promise<FrameworkInfo>
」。
参数:
body(吉特普罗维德·博迪):Provider数字 :"Github"|"Gitee"|"Gitlab"|"Bitbucket"Namespace: 用户名/组织名/工作空间ID/项目密钥RepoName时间轴:RootDir?页:1Branch?页:1
auth?(任何):- GitHub : (中文(简体) )
{ Token: "ghp_xxxxx" }/ 八角星 *** - 枪:
{ Token: "your_token" } - GitLab: (英语)
{ Token: "glpat-xxxxx", BaseUrl?: "https://gitlab.com" } - 键盘 :
{ Token: "your_token", BaseUrl?: "https://api.bitbucket.org" }
- GitHub : (中文(简体) )
返回值:
Promise<FrameworkInfo>时间轴:
返回对象结构:
interface FrameworkInfo {
Framework: string; // 框架名称
BuildCmd: string; // 构建命令
InstallCmd: string; // 安装命令
OutputDir: string; // 输出目录
IconPath?: string; // 图标路径(可选)
}
支持的框架
- 下一个.js
- 盖茨比
- 重混合
- 反应路由器
- 天体
- 十六岁
- 十一号
- 多龙
- 固态
- 阴道
- 角质
- 丝绒
- 反应
- 坚果
- 齐克
- 浩诺
- 维特
{\fn黑体\fs22\bord1\shad0\3aHBE\4aH00\fscx67\fscy66\2cHFFFFFF\3cH808080}你觉得呢
| +++++++++++++++ | 公开仓库 | 私有仓库 | 自建实例 | 认证方式 |
|---|---|---|---|---|
| GitHub 图像 | ✅ | ✅ | ✅ | 个人访问托肯 |
| 齿轮 | ✅ | ✅ | ❌ | 个人访问托肯 |
| 吉特拉布语Name | ✅ | ✅ | ✅ | 个人访问托肯 |
| 键盘 | ✅ | ✅ | ✅ | OAuth 2.0 / App 密码/ PAT |
开发
# 安装依赖
npm install
# 构建
npm run build
# 运行测试
npm run test
# 测试远程检测
bun testRemote.ts