@icebreakers/changelog-github 2.0.0 → 2.0.1
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/dist/index.cjs +34 -3
- package/dist/index.d.cts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +31 -1
- package/package.json +5 -4
package/dist/index.cjs
CHANGED
|
@@ -2,9 +2,40 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
+
let dotenv = require("dotenv");
|
|
5
6
|
let _changesets_get_github_info = require("@changesets/get-github-info");
|
|
7
|
+
//#region src/github-info.ts
|
|
8
|
+
async function getInfo(options) {
|
|
9
|
+
const info = await (0, _changesets_get_github_info.getCommitInfo)(options);
|
|
10
|
+
if (!info) return;
|
|
11
|
+
return {
|
|
12
|
+
commit: info.commit.sha,
|
|
13
|
+
pull: info.pull?.number ?? null,
|
|
14
|
+
user: info.author?.login ?? null,
|
|
15
|
+
links: {
|
|
16
|
+
commit: info.commit.markdownLink,
|
|
17
|
+
pull: info.pull?.markdownLink ?? null,
|
|
18
|
+
user: info.author?.markdownLink ?? null
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
async function getInfoFromPullRequest(options) {
|
|
23
|
+
const info = await (0, _changesets_get_github_info.getPullRequestInfo)(options);
|
|
24
|
+
if (!info) return;
|
|
25
|
+
return {
|
|
26
|
+
commit: info.commit?.sha ?? null,
|
|
27
|
+
pull: info.pull.number,
|
|
28
|
+
user: info.author?.login ?? null,
|
|
29
|
+
links: {
|
|
30
|
+
commit: info.commit?.markdownLink ?? null,
|
|
31
|
+
pull: info.pull.markdownLink,
|
|
32
|
+
user: info.author?.markdownLink ?? null
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
6
37
|
//#region src/index.ts
|
|
7
|
-
(0,
|
|
38
|
+
(0, dotenv.config)();
|
|
8
39
|
const releaseTypeMap = {
|
|
9
40
|
major: {
|
|
10
41
|
icon: "🚀",
|
|
@@ -60,7 +91,7 @@ function isOptionalGitHubMetadataError(error) {
|
|
|
60
91
|
}
|
|
61
92
|
async function getOptionalInfo(request) {
|
|
62
93
|
try {
|
|
63
|
-
return await
|
|
94
|
+
return await getInfo(request);
|
|
64
95
|
} catch (error) {
|
|
65
96
|
if (isOptionalGitHubMetadataError(error)) return null;
|
|
66
97
|
throw error;
|
|
@@ -68,7 +99,7 @@ async function getOptionalInfo(request) {
|
|
|
68
99
|
}
|
|
69
100
|
async function getOptionalInfoFromPullRequest(request) {
|
|
70
101
|
try {
|
|
71
|
-
return await
|
|
102
|
+
return await getInfoFromPullRequest(request);
|
|
72
103
|
} catch (error) {
|
|
73
104
|
if (isOptionalGitHubMetadataError(error)) return null;
|
|
74
105
|
throw error;
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
|
-
import { getInfo, getInfoFromPullRequest } from "@changesets/get-github-info";
|
|
2
1
|
import { config } from "dotenv";
|
|
2
|
+
import { getCommitInfo, getPullRequestInfo } from "@changesets/get-github-info";
|
|
3
|
+
//#region src/github-info.ts
|
|
4
|
+
async function getInfo(options) {
|
|
5
|
+
const info = await getCommitInfo(options);
|
|
6
|
+
if (!info) return;
|
|
7
|
+
return {
|
|
8
|
+
commit: info.commit.sha,
|
|
9
|
+
pull: info.pull?.number ?? null,
|
|
10
|
+
user: info.author?.login ?? null,
|
|
11
|
+
links: {
|
|
12
|
+
commit: info.commit.markdownLink,
|
|
13
|
+
pull: info.pull?.markdownLink ?? null,
|
|
14
|
+
user: info.author?.markdownLink ?? null
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
async function getInfoFromPullRequest(options) {
|
|
19
|
+
const info = await getPullRequestInfo(options);
|
|
20
|
+
if (!info) return;
|
|
21
|
+
return {
|
|
22
|
+
commit: info.commit?.sha ?? null,
|
|
23
|
+
pull: info.pull.number,
|
|
24
|
+
user: info.author?.login ?? null,
|
|
25
|
+
links: {
|
|
26
|
+
commit: info.commit?.markdownLink ?? null,
|
|
27
|
+
pull: info.pull.markdownLink,
|
|
28
|
+
user: info.author?.markdownLink ?? null
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
3
33
|
//#region src/index.ts
|
|
4
34
|
config();
|
|
5
35
|
const releaseTypeMap = {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icebreakers/changelog-github",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.1",
|
|
5
5
|
"description": "Changesets GitHub changelog formatter for Icebreaker's dev-configs",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -39,16 +39,17 @@
|
|
|
39
39
|
"tsd": {
|
|
40
40
|
"directory": "test-d",
|
|
41
41
|
"compilerOptions": {
|
|
42
|
+
"module": "node16",
|
|
42
43
|
"skipLibCheck": true
|
|
43
44
|
}
|
|
44
45
|
},
|
|
45
46
|
"dependencies": {
|
|
46
|
-
"@changesets/get-github-info": "^0.
|
|
47
|
-
"@changesets/types": "^
|
|
47
|
+
"@changesets/get-github-info": "^1.0.0",
|
|
48
|
+
"@changesets/types": "^7.0.0",
|
|
48
49
|
"dotenv": "^17.4.2"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
|
-
"@changesets/parse": "^0.
|
|
52
|
+
"@changesets/parse": "^1.0.0"
|
|
52
53
|
},
|
|
53
54
|
"scripts": {
|
|
54
55
|
"dev": "tsdown --watch --sourcemap",
|