@canyonjs/git-provider 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -16
- package/package.json +23 -17
package/README.md
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
## 能力与现状
|
|
6
6
|
|
|
7
|
-
| 能力
|
|
8
|
-
|
|
|
9
|
-
| `getRepoInfo` | 支持(Project API)
|
|
10
|
-
| `getCompare`
|
|
7
|
+
| 能力 | GitLab | GitHub |
|
|
8
|
+
| ------------- | ------------------------------------------------ | ---------------------------------- |
|
|
9
|
+
| `getRepoInfo` | 支持(Project API) | 支持(`owner/repo` 或数字仓库 id) |
|
|
10
|
+
| `getCompare` | **已实现**:比较 API + 逐文件 Raw 内容与行级差异 | **未实现**(调用会抛错) |
|
|
11
11
|
|
|
12
12
|
`getCompare` 返回结构化结果 **`Compare`**:
|
|
13
13
|
|
|
@@ -37,11 +37,7 @@ pnpm run build
|
|
|
37
37
|
## 用法示例
|
|
38
38
|
|
|
39
39
|
```ts
|
|
40
|
-
import {
|
|
41
|
-
createScmAdapter,
|
|
42
|
-
type Compare,
|
|
43
|
-
type ScmConfig,
|
|
44
|
-
} from "@canyonjs/git-provider";
|
|
40
|
+
import { createScmAdapter, type Compare, type ScmConfig } from "@canyonjs/git-provider";
|
|
45
41
|
|
|
46
42
|
const config: ScmConfig = {
|
|
47
43
|
type: "gitlab",
|
|
@@ -66,13 +62,13 @@ GitHub 仅 token、`base` 固定为 `https://api.github.com`。
|
|
|
66
62
|
|
|
67
63
|
## 开发与脚本
|
|
68
64
|
|
|
69
|
-
| 脚本
|
|
70
|
-
|
|
|
71
|
-
| `pnpm run build`
|
|
72
|
-
| `pnpm run dev`
|
|
73
|
-
| `pnpm run typecheck` | TypeScript 检查
|
|
74
|
-
| `pnpm run test`
|
|
75
|
-
| `pnpm run debug`
|
|
65
|
+
| 脚本 | 说明 |
|
|
66
|
+
| -------------------- | --------------------------------------------------------- |
|
|
67
|
+
| `pnpm run build` | 使用 tsdown 产出 `dist` |
|
|
68
|
+
| `pnpm run dev` | 监听构建 |
|
|
69
|
+
| `pnpm run typecheck` | TypeScript 检查 |
|
|
70
|
+
| `pnpm run test` | Vitest |
|
|
71
|
+
| `pnpm run debug` | 本地脚本 `src/debug.ts`(可自行改为写 token、仓库与 ref) |
|
|
76
72
|
|
|
77
73
|
目录概览:**`src/adapter.ts`** 定义 **`ScmAdapter`**;**`src/gitlab.ts`** / **`src/github.ts`** 为实现;**`src/diff-line.ts`** 为行号计算与扩展名判定;**`src/types.ts`** 为配置与各数据结构类型。
|
|
78
74
|
|
package/package.json
CHANGED
|
@@ -1,47 +1,53 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canyonjs/git-provider",
|
|
3
|
-
"
|
|
4
|
-
"version": "0.0.2",
|
|
3
|
+
"version": "0.0.3",
|
|
5
4
|
"description": "GitLab provider client with adapter architecture.",
|
|
6
5
|
"keywords": [
|
|
6
|
+
"api",
|
|
7
7
|
"git",
|
|
8
|
-
"gitlab"
|
|
9
|
-
"api"
|
|
8
|
+
"gitlab"
|
|
10
9
|
],
|
|
11
|
-
"author": "canyonjs",
|
|
12
|
-
"license": "MIT",
|
|
13
10
|
"homepage": "https://github.com/canyon-project/git-provider#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/canyon-project/git-provider/issues"
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"author": "canyonjs",
|
|
14
16
|
"repository": {
|
|
15
17
|
"type": "git",
|
|
16
18
|
"url": "git+https://github.com/canyon-project/git-provider.git"
|
|
17
19
|
},
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
23
|
+
"type": "module",
|
|
24
|
+
"sideEffects": false,
|
|
21
25
|
"types": "./dist/index.d.ts",
|
|
22
26
|
"exports": {
|
|
23
27
|
".": "./dist/index.mjs",
|
|
24
28
|
"./package.json": "./package.json"
|
|
25
29
|
},
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
"sideEffects": false,
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"diff": "^9.0.0"
|
|
32
|
+
},
|
|
30
33
|
"devDependencies": {
|
|
31
34
|
"@types/node": "^25.5.0",
|
|
32
35
|
"@typescript/native-preview": "7.0.0-dev.20260505.1",
|
|
36
|
+
"oxfmt": "^0.48.0",
|
|
37
|
+
"oxlint": "^1.63.0",
|
|
33
38
|
"tsdown": "^0.21.7",
|
|
34
39
|
"tsx": "^4.21.0",
|
|
35
40
|
"vitest": "^4.1.2"
|
|
36
41
|
},
|
|
37
|
-
"dependencies": {
|
|
38
|
-
"diff": "^9.0.0"
|
|
39
|
-
},
|
|
40
42
|
"scripts": {
|
|
41
43
|
"build": "tsdown",
|
|
42
44
|
"dev": "tsdown --watch",
|
|
43
45
|
"test": "vitest run",
|
|
44
46
|
"typecheck": "tsgo --noEmit",
|
|
45
|
-
"debug": "tsx src/debug.ts"
|
|
47
|
+
"debug": "tsx src/debug.ts",
|
|
48
|
+
"lint": "oxlint",
|
|
49
|
+
"lint:fix": "oxlint --fix",
|
|
50
|
+
"fmt": "oxfmt",
|
|
51
|
+
"fmt:check": "oxfmt --check"
|
|
46
52
|
}
|
|
47
53
|
}
|