tegami 1.2.0 → 1.2.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/cli/index.js +2 -2
- package/dist/{error-BhMYq9iW.js → error-CAsrGb6e.js} +6 -1
- package/dist/{generate-Bg86OJP4.js → generate-Cnd8RiKO.js} +1 -1
- package/dist/index.js +4 -4
- package/dist/{npm-DaUHTtlV.js → npm-4iA03RvC.js} +4 -4
- package/dist/plugins/cargo.js +2 -2
- package/dist/plugins/git.js +1 -1
- package/dist/plugins/github.d.ts +1 -1
- package/dist/plugins/github.js +24 -19
- package/dist/plugins/gitlab.d.ts +1 -1
- package/dist/plugins/gitlab.js +24 -19
- package/dist/plugins/go.js +2 -2
- package/dist/providers/npm.js +1 -1
- package/dist/{publish-v30y8Lwq.js → publish-Bt3e1RPs.js} +1 -1
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +2 -2
- package/dist/{version-request-C24d9RIW.d.ts → version-request-BQwP7EWa.d.ts} +19 -1
- package/dist/{version-request-l6IJdFM6.js → version-request-DvWVAYj2.js} +35 -27
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as generateFromCommits, t as changelogFilename } from "../generate-
|
|
2
|
-
import {
|
|
1
|
+
import { n as generateFromCommits, t as changelogFilename } from "../generate-Cnd8RiKO.js";
|
|
2
|
+
import { i as handlePluginError, s as isCI, t as CancelledError } from "../error-CAsrGb6e.js";
|
|
3
3
|
import { t as renderChangelog } from "../shared-C_iSTp_s.js";
|
|
4
4
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
5
5
|
import path, { join, relative } from "node:path";
|
|
@@ -59,6 +59,11 @@ function execFailure(context, result) {
|
|
|
59
59
|
if (err) lines.push(err);
|
|
60
60
|
return new Error(redactSensitiveTokens(lines.join("\n")));
|
|
61
61
|
}
|
|
62
|
+
async function fetchFailure(context, response) {
|
|
63
|
+
const body = (await response.text()).trim();
|
|
64
|
+
const message = body ? `${context}: ${body}` : context;
|
|
65
|
+
return new Error(redactSensitiveTokens(message));
|
|
66
|
+
}
|
|
62
67
|
function isNodeError(error) {
|
|
63
68
|
return error instanceof Error && "code" in error;
|
|
64
69
|
}
|
|
@@ -86,4 +91,4 @@ async function handlePluginError(plugin, hookName, callback) {
|
|
|
86
91
|
}
|
|
87
92
|
}
|
|
88
93
|
//#endregion
|
|
89
|
-
export {
|
|
94
|
+
export { isNodeError as a, joinPath as c, handlePluginError as i, somePromise as l, execFailure as n, cached as o, fetchFailure as r, isCI as s, CancelledError as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as maxBump, t as bumpDepth } from "./semver-EKJ8yK5U.js";
|
|
2
|
-
import { n as execFailure } from "./error-
|
|
2
|
+
import { n as execFailure } from "./error-CAsrGb6e.js";
|
|
3
3
|
import { t as renderChangelog } from "./shared-C_iSTp_s.js";
|
|
4
4
|
import { x } from "tinyexec";
|
|
5
5
|
//#region src/utils/conventional-commit.ts
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { n as generateFromCommits } from "./generate-
|
|
2
|
-
import {
|
|
3
|
-
import { a as createDraft, c as parseChangelogFile, i as runPublishPlan, l as readChangelogEntries, n as publishPlanStatus, r as runPreflights, t as initPublishPlan } from "./publish-
|
|
4
|
-
import { t as npm } from "./npm-
|
|
1
|
+
import { n as generateFromCommits } from "./generate-Cnd8RiKO.js";
|
|
2
|
+
import { i as handlePluginError } from "./error-CAsrGb6e.js";
|
|
3
|
+
import { a as createDraft, c as parseChangelogFile, i as runPublishPlan, l as readChangelogEntries, n as publishPlanStatus, r as runPreflights, t as initPublishPlan } from "./publish-Bt3e1RPs.js";
|
|
4
|
+
import { t as npm } from "./npm-4iA03RvC.js";
|
|
5
5
|
import { n as WorkspacePackage, t as PackageGraph } from "./graph-BmXTJZxx.js";
|
|
6
6
|
import { mkdir, rm, writeFile } from "node:fs/promises";
|
|
7
7
|
import path, { join } from "node:path";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as isNodeError, c as joinPath, n as execFailure, r as fetchFailure } from "./error-CAsrGb6e.js";
|
|
2
2
|
import { t as _accessExpressionAsString } from "./_accessExpressionAsString-QhbUZzwv.js";
|
|
3
3
|
import { n as _validateReport, t as _createStandardSchema } from "./_createStandardSchema-BGQyz-uA.js";
|
|
4
|
-
import { r as runPreflights, s as parsePublishLock, t as initPublishPlan } from "./publish-
|
|
4
|
+
import { r as runPreflights, s as parsePublishLock, t as initPublishPlan } from "./publish-Bt3e1RPs.js";
|
|
5
5
|
import { t as _assertGuard } from "./_assertGuard-BBn2NbSz.js";
|
|
6
6
|
import { n as WorkspacePackage } from "./graph-BmXTJZxx.js";
|
|
7
7
|
import fs, { readFile, writeFile } from "node:fs/promises";
|
|
@@ -79,7 +79,7 @@ async function resolvePretrustTargets(context) {
|
|
|
79
79
|
async function isPackageOnRegistry(name, registry = "https://registry.npmjs.org") {
|
|
80
80
|
const response = await fetch(joinPath(registry, name), { headers: { Accept: "application/json" } });
|
|
81
81
|
if (response.status === 404) return false;
|
|
82
|
-
if (!response.ok) throw
|
|
82
|
+
if (!response.ok) throw await fetchFailure(`Unable to check whether ${name} exists on the npm registry${registry ? ` "${registry}"` : ""}`, response);
|
|
83
83
|
return true;
|
|
84
84
|
}
|
|
85
85
|
async function publishPlaceholder(pkg) {
|
|
@@ -1120,7 +1120,7 @@ async function publish(client, pkg, distTag) {
|
|
|
1120
1120
|
async function isPackagePublished(name, version, registry) {
|
|
1121
1121
|
const response = await fetch(joinPath(registry, name, version), { headers: { Accept: "application/json" } });
|
|
1122
1122
|
if (response.status === 404) return false;
|
|
1123
|
-
if (!response.ok) throw
|
|
1123
|
+
if (!response.ok) throw await fetchFailure(`Unable to validate ${name}@${version} against the npm registry${registry ? ` "${registry}"` : ""}`, response);
|
|
1124
1124
|
return true;
|
|
1125
1125
|
}
|
|
1126
1126
|
//#endregion
|
package/dist/plugins/cargo.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as execFailure } from "../error-
|
|
1
|
+
import { n as execFailure, r as fetchFailure } from "../error-CAsrGb6e.js";
|
|
2
2
|
import { t as _accessExpressionAsString } from "../_accessExpressionAsString-QhbUZzwv.js";
|
|
3
3
|
import { t as _assertGuard } from "../_assertGuard-BBn2NbSz.js";
|
|
4
4
|
import { n as WorkspacePackage } from "../graph-BmXTJZxx.js";
|
|
@@ -686,7 +686,7 @@ async function isPackagePublished(name, version) {
|
|
|
686
686
|
const response = await fetch(`https://crates.io/api/v1/crates/${encodeURIComponent(name)}/${version}`);
|
|
687
687
|
if (response.status === 200) return true;
|
|
688
688
|
if (response.status === 404) return false;
|
|
689
|
-
throw
|
|
689
|
+
throw await fetchFailure(`Unable to validate ${name}@${version} against crates.io`, response);
|
|
690
690
|
}
|
|
691
691
|
async function buildEntry(dir) {
|
|
692
692
|
try {
|
package/dist/plugins/git.js
CHANGED
package/dist/plugins/github.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { A as WorkspacePackage, b as TegamiContext, s as TegamiPlugin, t as Awaitable, v as PublishPlan } from "../types-BbwOrNZ2.js";
|
|
2
2
|
import { GitPluginOptions } from "./git.js";
|
|
3
|
-
import { t as VersionRequestOptions } from "../version-request-
|
|
3
|
+
import { t as VersionRequestOptions } from "../version-request-BQwP7EWa.js";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/github.d.ts
|
|
6
6
|
interface GithubRelease {
|
package/dist/plugins/github.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { i as formatPackageVersion, r as formatNpmDistTag } from "../semver-EKJ8yK5U.js";
|
|
2
|
-
import { t as changelogFilename } from "../generate-
|
|
3
|
-
import {
|
|
4
|
-
import { a as createDraft, l as readChangelogEntries } from "../publish-
|
|
2
|
+
import { t as changelogFilename } from "../generate-Cnd8RiKO.js";
|
|
3
|
+
import { n as execFailure, o as cached, r as fetchFailure, s as isCI } from "../error-CAsrGb6e.js";
|
|
4
|
+
import { a as createDraft, l as readChangelogEntries } from "../publish-Bt3e1RPs.js";
|
|
5
5
|
import { git } from "./git.js";
|
|
6
|
-
import { t as onVersionRequest } from "../version-request-
|
|
6
|
+
import { t as onVersionRequest } from "../version-request-DvWVAYj2.js";
|
|
7
7
|
import { readFile, writeFile } from "node:fs/promises";
|
|
8
8
|
import { basename, join, relative, resolve } from "node:path";
|
|
9
9
|
import { x } from "tinyexec";
|
|
@@ -33,12 +33,12 @@ async function releaseExistsByTag(repo, tag, token) {
|
|
|
33
33
|
const { owner, repo: name } = parseGitHubRepo(repo);
|
|
34
34
|
const response = await githubRequest(`/repos/${owner}/${name}/releases/tags/${encodeURIComponent(tag)}`, token, { method: "HEAD" });
|
|
35
35
|
if (response.status === 404) return false;
|
|
36
|
-
if (!response.ok) throw
|
|
36
|
+
if (!response.ok) throw await fetchFailure(`Failed to get GitHub release for ${tag}`, response);
|
|
37
37
|
return true;
|
|
38
38
|
}
|
|
39
39
|
async function createRelease(repo, options) {
|
|
40
40
|
const { owner, repo: name } = parseGitHubRepo(repo);
|
|
41
|
-
|
|
41
|
+
const response = await githubRequest(`/repos/${owner}/${name}/releases`, options.token, {
|
|
42
42
|
method: "POST",
|
|
43
43
|
headers: { "Content-Type": "application/json" },
|
|
44
44
|
body: JSON.stringify({
|
|
@@ -47,7 +47,8 @@ async function createRelease(repo, options) {
|
|
|
47
47
|
body: options.notes,
|
|
48
48
|
prerelease: options.prerelease ?? false
|
|
49
49
|
})
|
|
50
|
-
})
|
|
50
|
+
});
|
|
51
|
+
if (!response.ok) throw await fetchFailure(`Failed to create GitHub release for ${options.tag}`, response);
|
|
51
52
|
}
|
|
52
53
|
async function findOpenPullRequest(repo, headBranch, token) {
|
|
53
54
|
const { owner, repo: name } = parseGitHubRepo(repo);
|
|
@@ -55,23 +56,24 @@ async function findOpenPullRequest(repo, headBranch, token) {
|
|
|
55
56
|
head: `${owner}:${headBranch}`,
|
|
56
57
|
state: "open"
|
|
57
58
|
})}`, token);
|
|
58
|
-
if (!response.ok) throw
|
|
59
|
+
if (!response.ok) throw await fetchFailure("Failed to check for an existing version pull request", response);
|
|
59
60
|
return (await response.json())[0]?.number;
|
|
60
61
|
}
|
|
61
62
|
async function updatePullRequest(repo, number, options) {
|
|
62
63
|
const { owner, repo: name } = parseGitHubRepo(repo);
|
|
63
|
-
|
|
64
|
+
const response = await githubRequest(`/repos/${owner}/${name}/pulls/${number}`, options.token, {
|
|
64
65
|
method: "PATCH",
|
|
65
66
|
headers: { "Content-Type": "application/json" },
|
|
66
67
|
body: JSON.stringify({
|
|
67
68
|
title: options.title,
|
|
68
69
|
body: options.body
|
|
69
70
|
})
|
|
70
|
-
})
|
|
71
|
+
});
|
|
72
|
+
if (!response.ok) throw await fetchFailure("Failed to update the version pull request", response);
|
|
71
73
|
}
|
|
72
74
|
async function createPullRequest(repo, options) {
|
|
73
75
|
const { owner, repo: name } = parseGitHubRepo(repo);
|
|
74
|
-
|
|
76
|
+
const response = await githubRequest(`/repos/${owner}/${name}/pulls`, options.token, {
|
|
75
77
|
method: "POST",
|
|
76
78
|
headers: { "Content-Type": "application/json" },
|
|
77
79
|
body: JSON.stringify({
|
|
@@ -80,18 +82,19 @@ async function createPullRequest(repo, options) {
|
|
|
80
82
|
head: options.head,
|
|
81
83
|
base: options.base
|
|
82
84
|
})
|
|
83
|
-
})
|
|
85
|
+
});
|
|
86
|
+
if (!response.ok) throw await fetchFailure("Failed to create the version pull request", response);
|
|
84
87
|
}
|
|
85
88
|
async function listPullRequestsForCommit(repo, commitSha, token) {
|
|
86
89
|
const { owner, repo: name } = parseGitHubRepo(repo);
|
|
87
90
|
const response = await githubRequest(`/repos/${owner}/${name}/commits/${commitSha}/pulls`, token);
|
|
88
|
-
if (!response.ok) throw
|
|
91
|
+
if (!response.ok) throw await fetchFailure(`Failed to list pull requests for commit ${commitSha.slice(0, 7)}`, response);
|
|
89
92
|
return await response.json();
|
|
90
93
|
}
|
|
91
94
|
async function getPullRequest(repo, number, token) {
|
|
92
95
|
const { owner, repo: name } = parseGitHubRepo(repo);
|
|
93
96
|
const response = await githubRequest(`/repos/${owner}/${name}/pulls/${number}`, token);
|
|
94
|
-
if (!response.ok) throw
|
|
97
|
+
if (!response.ok) throw await fetchFailure(`Failed to resolve pull request #${number}`, response);
|
|
95
98
|
const data = await response.json();
|
|
96
99
|
return {
|
|
97
100
|
headRefName: data.head.ref,
|
|
@@ -105,7 +108,7 @@ async function findIssueCommentByPrefix(repo, issueNumber, prefix, token) {
|
|
|
105
108
|
let page = 1;
|
|
106
109
|
while (true) {
|
|
107
110
|
const response = await githubRequest(`/repos/${owner}/${name}/issues/${issueNumber}/comments?per_page=100&page=${page}`, token);
|
|
108
|
-
if (!response.ok) throw
|
|
111
|
+
if (!response.ok) throw await fetchFailure("Failed to list pull request comments", response);
|
|
109
112
|
const batch = await response.json();
|
|
110
113
|
if (batch.length === 0) break;
|
|
111
114
|
const comment = batch.find((comment) => comment.body.startsWith(prefix));
|
|
@@ -116,19 +119,21 @@ async function findIssueCommentByPrefix(repo, issueNumber, prefix, token) {
|
|
|
116
119
|
}
|
|
117
120
|
async function updateIssueComment(repo, commentId, body, token) {
|
|
118
121
|
const { owner, repo: name } = parseGitHubRepo(repo);
|
|
119
|
-
|
|
122
|
+
const response = await githubRequest(`/repos/${owner}/${name}/issues/comments/${commentId}`, token, {
|
|
120
123
|
method: "PATCH",
|
|
121
124
|
headers: { "Content-Type": "application/json" },
|
|
122
125
|
body: JSON.stringify({ body })
|
|
123
|
-
})
|
|
126
|
+
});
|
|
127
|
+
if (!response.ok) throw await fetchFailure("Failed to update pull request comment", response);
|
|
124
128
|
}
|
|
125
129
|
async function createIssueComment(repo, issueNumber, body, token) {
|
|
126
130
|
const { owner, repo: name } = parseGitHubRepo(repo);
|
|
127
|
-
|
|
131
|
+
const response = await githubRequest(`/repos/${owner}/${name}/issues/${issueNumber}/comments`, token, {
|
|
128
132
|
method: "POST",
|
|
129
133
|
headers: { "Content-Type": "application/json" },
|
|
130
134
|
body: JSON.stringify({ body })
|
|
131
|
-
})
|
|
135
|
+
});
|
|
136
|
+
if (!response.ok) throw await fetchFailure("Failed to create pull request comment", response);
|
|
132
137
|
}
|
|
133
138
|
//#endregion
|
|
134
139
|
//#region src/plugins/github/cli.ts
|
package/dist/plugins/gitlab.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { A as WorkspacePackage, b as TegamiContext, s as TegamiPlugin, t as Awaitable, v as PublishPlan } from "../types-BbwOrNZ2.js";
|
|
2
2
|
import { GitPluginOptions } from "./git.js";
|
|
3
|
-
import { t as VersionRequestOptions } from "../version-request-
|
|
3
|
+
import { t as VersionRequestOptions } from "../version-request-BQwP7EWa.js";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/gitlab.d.ts
|
|
6
6
|
interface GitlabRelease {
|
package/dist/plugins/gitlab.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { i as formatPackageVersion, r as formatNpmDistTag } from "../semver-EKJ8yK5U.js";
|
|
2
|
-
import { t as changelogFilename } from "../generate-
|
|
3
|
-
import {
|
|
4
|
-
import { a as createDraft, l as readChangelogEntries } from "../publish-
|
|
2
|
+
import { t as changelogFilename } from "../generate-Cnd8RiKO.js";
|
|
3
|
+
import { c as joinPath, n as execFailure, o as cached, r as fetchFailure, s as isCI } from "../error-CAsrGb6e.js";
|
|
4
|
+
import { a as createDraft, l as readChangelogEntries } from "../publish-Bt3e1RPs.js";
|
|
5
5
|
import { git } from "./git.js";
|
|
6
|
-
import { t as onVersionRequest } from "../version-request-
|
|
6
|
+
import { t as onVersionRequest } from "../version-request-DvWVAYj2.js";
|
|
7
7
|
import { readFile, writeFile } from "node:fs/promises";
|
|
8
8
|
import { basename, join, relative, resolve } from "node:path";
|
|
9
9
|
import { x } from "tinyexec";
|
|
@@ -31,12 +31,12 @@ async function releaseExistsByTag(repo, tag, options = {}) {
|
|
|
31
31
|
const { encodedProjectPath } = parseGitLabRepo(repo);
|
|
32
32
|
const response = await gitlabRequest(options, `/projects/${encodedProjectPath}/releases/${encodeURIComponent(tag)}`, { method: "HEAD" });
|
|
33
33
|
if (response.status === 404) return false;
|
|
34
|
-
if (!response.ok) throw
|
|
34
|
+
if (!response.ok) throw await fetchFailure(`Failed to get GitLab release for ${tag}`, response);
|
|
35
35
|
return true;
|
|
36
36
|
}
|
|
37
37
|
async function createRelease(repo, options) {
|
|
38
38
|
const { encodedProjectPath } = parseGitLabRepo(repo);
|
|
39
|
-
|
|
39
|
+
const response = await gitlabRequest(options, `/projects/${encodedProjectPath}/releases`, {
|
|
40
40
|
method: "POST",
|
|
41
41
|
headers: { "Content-Type": "application/json" },
|
|
42
42
|
body: JSON.stringify({
|
|
@@ -44,7 +44,8 @@ async function createRelease(repo, options) {
|
|
|
44
44
|
name: options.title,
|
|
45
45
|
description: options.notes
|
|
46
46
|
})
|
|
47
|
-
})
|
|
47
|
+
});
|
|
48
|
+
if (!response.ok) throw await fetchFailure(`Failed to create GitLab release for ${options.tag}`, response);
|
|
48
49
|
}
|
|
49
50
|
async function findOpenMergeRequest(repo, options) {
|
|
50
51
|
const { encodedProjectPath } = parseGitLabRepo(repo);
|
|
@@ -54,12 +55,12 @@ async function findOpenMergeRequest(repo, options) {
|
|
|
54
55
|
});
|
|
55
56
|
if (options.base) params.set("target_branch", options.base);
|
|
56
57
|
const response = await gitlabRequest(options, `/projects/${encodedProjectPath}/merge_requests?${params}`);
|
|
57
|
-
if (!response.ok) throw
|
|
58
|
+
if (!response.ok) throw await fetchFailure("Failed to check for an existing version merge request", response);
|
|
58
59
|
return (await response.json())[0]?.iid;
|
|
59
60
|
}
|
|
60
61
|
async function updateMergeRequest(repo, number, options) {
|
|
61
62
|
const { encodedProjectPath } = parseGitLabRepo(repo);
|
|
62
|
-
|
|
63
|
+
const response = await gitlabRequest(options, `/projects/${encodedProjectPath}/merge_requests/${number}`, {
|
|
63
64
|
method: "PUT",
|
|
64
65
|
headers: { "Content-Type": "application/json" },
|
|
65
66
|
body: JSON.stringify({
|
|
@@ -67,11 +68,12 @@ async function updateMergeRequest(repo, number, options) {
|
|
|
67
68
|
description: options.body,
|
|
68
69
|
target_branch: options.base
|
|
69
70
|
})
|
|
70
|
-
})
|
|
71
|
+
});
|
|
72
|
+
if (!response.ok) throw await fetchFailure("Failed to update the version merge request", response);
|
|
71
73
|
}
|
|
72
74
|
async function createMergeRequest(repo, options) {
|
|
73
75
|
const { encodedProjectPath } = parseGitLabRepo(repo);
|
|
74
|
-
|
|
76
|
+
const response = await gitlabRequest(options, `/projects/${encodedProjectPath}/merge_requests`, {
|
|
75
77
|
method: "POST",
|
|
76
78
|
headers: { "Content-Type": "application/json" },
|
|
77
79
|
body: JSON.stringify({
|
|
@@ -80,12 +82,13 @@ async function createMergeRequest(repo, options) {
|
|
|
80
82
|
source_branch: options.head,
|
|
81
83
|
target_branch: options.base
|
|
82
84
|
})
|
|
83
|
-
})
|
|
85
|
+
});
|
|
86
|
+
if (!response.ok) throw await fetchFailure("Failed to create the version merge request", response);
|
|
84
87
|
}
|
|
85
88
|
async function getMergeRequest(repo, number, options = {}) {
|
|
86
89
|
const { encodedProjectPath } = parseGitLabRepo(repo);
|
|
87
90
|
const response = await gitlabRequest(options, `/projects/${encodedProjectPath}/merge_requests/${number}`);
|
|
88
|
-
if (!response.ok) throw
|
|
91
|
+
if (!response.ok) throw await fetchFailure(`Failed to resolve merge request !${number}`, response);
|
|
89
92
|
const data = await response.json();
|
|
90
93
|
let sourceProjectPath;
|
|
91
94
|
if (data.source_project_id !== void 0) {
|
|
@@ -102,7 +105,7 @@ async function getMergeRequest(repo, number, options = {}) {
|
|
|
102
105
|
async function listMergeRequestsForCommit(repo, commitSha, options = {}) {
|
|
103
106
|
const { encodedProjectPath } = parseGitLabRepo(repo);
|
|
104
107
|
const response = await gitlabRequest(options, `/projects/${encodedProjectPath}/repository/commits/${commitSha}/merge_requests`);
|
|
105
|
-
if (!response.ok) throw
|
|
108
|
+
if (!response.ok) throw await fetchFailure(`Failed to list merge requests for commit ${commitSha.slice(0, 7)}`, response);
|
|
106
109
|
return (await response.json()).map((mergeRequest) => ({
|
|
107
110
|
number: mergeRequest.iid,
|
|
108
111
|
title: mergeRequest.title,
|
|
@@ -114,7 +117,7 @@ async function findMergeRequestCommentByPrefix(repo, mergeRequestNumber, prefix,
|
|
|
114
117
|
let page = 1;
|
|
115
118
|
while (true) {
|
|
116
119
|
const response = await gitlabRequest(options, `/projects/${encodedProjectPath}/merge_requests/${mergeRequestNumber}/notes?per_page=100&page=${page}`);
|
|
117
|
-
if (!response.ok) throw
|
|
120
|
+
if (!response.ok) throw await fetchFailure("Failed to list merge request comments", response);
|
|
118
121
|
const batch = await response.json();
|
|
119
122
|
if (batch.length === 0) break;
|
|
120
123
|
const comment = batch.find((comment) => comment.body.startsWith(prefix));
|
|
@@ -125,19 +128,21 @@ async function findMergeRequestCommentByPrefix(repo, mergeRequestNumber, prefix,
|
|
|
125
128
|
}
|
|
126
129
|
async function updateMergeRequestComment(repo, mergeRequestNumber, commentId, body, options = {}) {
|
|
127
130
|
const { encodedProjectPath } = parseGitLabRepo(repo);
|
|
128
|
-
|
|
131
|
+
const response = await gitlabRequest(options, `/projects/${encodedProjectPath}/merge_requests/${mergeRequestNumber}/notes/${commentId}`, {
|
|
129
132
|
method: "PUT",
|
|
130
133
|
headers: { "Content-Type": "application/json" },
|
|
131
134
|
body: JSON.stringify({ body })
|
|
132
|
-
})
|
|
135
|
+
});
|
|
136
|
+
if (!response.ok) throw await fetchFailure("Failed to update merge request comment", response);
|
|
133
137
|
}
|
|
134
138
|
async function createMergeRequestComment(repo, mergeRequestNumber, body, options = {}) {
|
|
135
139
|
const { encodedProjectPath } = parseGitLabRepo(repo);
|
|
136
|
-
|
|
140
|
+
const response = await gitlabRequest(options, `/projects/${encodedProjectPath}/merge_requests/${mergeRequestNumber}/notes`, {
|
|
137
141
|
method: "POST",
|
|
138
142
|
headers: { "Content-Type": "application/json" },
|
|
139
143
|
body: JSON.stringify({ body })
|
|
140
|
-
})
|
|
144
|
+
});
|
|
145
|
+
if (!response.ok) throw await fetchFailure("Failed to create merge request comment", response);
|
|
141
146
|
}
|
|
142
147
|
//#endregion
|
|
143
148
|
//#region src/plugins/gitlab/cli.ts
|
package/dist/plugins/go.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as isNodeError, n as execFailure, r as fetchFailure } from "../error-CAsrGb6e.js";
|
|
2
2
|
import { n as _validateReport, t as _createStandardSchema } from "../_createStandardSchema-BGQyz-uA.js";
|
|
3
3
|
import { n as WorkspacePackage } from "../graph-BmXTJZxx.js";
|
|
4
4
|
import { relative, resolve } from "node:path";
|
|
@@ -524,7 +524,7 @@ async function isModulePublished(module, version) {
|
|
|
524
524
|
const response = await fetch(`https://proxy.golang.org/${encodeURIComponent(module)}/@v/${formatted}.info`);
|
|
525
525
|
if (response.status === 200) return true;
|
|
526
526
|
if (response.status === 404) return false;
|
|
527
|
-
throw
|
|
527
|
+
throw await fetchFailure(`Unable to validate ${module}@${formatted} against proxy.golang.org`, response);
|
|
528
528
|
}
|
|
529
529
|
//#endregion
|
|
530
530
|
export { GoPackage, go };
|
package/dist/providers/npm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as NpmPackage, t as npm } from "../npm-
|
|
1
|
+
import { n as NpmPackage, t as npm } from "../npm-4iA03RvC.js";
|
|
2
2
|
export { NpmPackage, npm };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as maxBump } from "./semver-EKJ8yK5U.js";
|
|
2
|
-
import {
|
|
2
|
+
import { i as handlePluginError, l as somePromise } from "./error-CAsrGb6e.js";
|
|
3
3
|
import { t as _accessExpressionAsString } from "./_accessExpressionAsString-QhbUZzwv.js";
|
|
4
4
|
import { n as _validateReport, t as _createStandardSchema } from "./_createStandardSchema-BGQyz-uA.js";
|
|
5
5
|
import { n as validateChangelogFrontmatter, t as renderChangelog } from "./shared-C_iSTp_s.js";
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -2,9 +2,10 @@ import { Result } from "tinyexec";
|
|
|
2
2
|
|
|
3
3
|
//#region src/utils/error.d.ts
|
|
4
4
|
declare function execFailure(context: string, result: Awaited<Result>): Error;
|
|
5
|
+
declare function fetchFailure(context: string, response: Response): Promise<Error>;
|
|
5
6
|
//#endregion
|
|
6
7
|
//#region src/utils/common.d.ts
|
|
7
8
|
declare const isCI: () => boolean;
|
|
8
9
|
declare function joinPath(...paths: string[]): string;
|
|
9
10
|
//#endregion
|
|
10
|
-
export { execFailure, isCI, joinPath };
|
|
11
|
+
export { execFailure, fetchFailure, isCI, joinPath };
|
package/dist/utils/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as execFailure,
|
|
2
|
-
export { execFailure, isCI, joinPath };
|
|
1
|
+
import { c as joinPath, n as execFailure, r as fetchFailure, s as isCI } from "../error-CAsrGb6e.js";
|
|
2
|
+
export { execFailure, fetchFailure, isCI, joinPath };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as TegamiContext, j as Draft, t as Awaitable, v as PublishPlan } from "./types-BbwOrNZ2.js";
|
|
1
|
+
import { b as TegamiContext, j as Draft, m as PublishLock, t as Awaitable, v as PublishPlan } from "./types-BbwOrNZ2.js";
|
|
2
2
|
|
|
3
3
|
//#region src/utils/version-request.d.ts
|
|
4
4
|
interface VersionRequestOptions {
|
|
@@ -27,6 +27,17 @@ interface VersionRequestOptions {
|
|
|
27
27
|
title?: string;
|
|
28
28
|
body?: string;
|
|
29
29
|
}>;
|
|
30
|
+
/** Override commit summary & message. */
|
|
31
|
+
commit?: (this: TegamiContext, opts: {
|
|
32
|
+
type: "version-packages";
|
|
33
|
+
} | {
|
|
34
|
+
type: "update-lock";
|
|
35
|
+
store: PublishGroupStore;
|
|
36
|
+
updatedLock: PublishLock;
|
|
37
|
+
}) => Awaitable<{
|
|
38
|
+
title?: string;
|
|
39
|
+
body?: string;
|
|
40
|
+
} | undefined>;
|
|
30
41
|
}
|
|
31
42
|
interface VersionRequestContext {
|
|
32
43
|
draft: Draft;
|
|
@@ -35,5 +46,12 @@ interface VersionRequestContext {
|
|
|
35
46
|
getPreviousVersion(packageId: string): string | undefined;
|
|
36
47
|
}
|
|
37
48
|
/** adapter over the version request API of a git provider */
|
|
49
|
+
interface PublishGroupStore {
|
|
50
|
+
/**
|
|
51
|
+
* - active: groups whose version request was merged, they stay listed until the lock is removed
|
|
52
|
+
* - pending: groups still waiting for their version request to be merged
|
|
53
|
+
*/
|
|
54
|
+
groups: Record<string, "pending" | "active">;
|
|
55
|
+
}
|
|
38
56
|
//#endregion
|
|
39
57
|
export { VersionRequestOptions as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as formatNpmDistTag } from "./semver-EKJ8yK5U.js";
|
|
2
|
-
import { n as execFailure,
|
|
2
|
+
import { n as execFailure, s as isCI } from "./error-CAsrGb6e.js";
|
|
3
3
|
import { t as _accessExpressionAsString } from "./_accessExpressionAsString-QhbUZzwv.js";
|
|
4
4
|
import { n as _validateReport, t as _createStandardSchema } from "./_createStandardSchema-BGQyz-uA.js";
|
|
5
|
-
import { o as PublishLock, r as runPreflights, s as parsePublishLock, t as initPublishPlan } from "./publish-
|
|
5
|
+
import { o as PublishLock, r as runPreflights, s as parsePublishLock, t as initPublishPlan } from "./publish-Bt3e1RPs.js";
|
|
6
6
|
import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
|
7
7
|
import { join, relative } from "node:path";
|
|
8
8
|
import { x } from "tinyexec";
|
|
@@ -71,7 +71,7 @@ function onVersionRequest(provider) {
|
|
|
71
71
|
const snapshots = /* @__PURE__ */ new Map();
|
|
72
72
|
function resolveConfig(graph) {
|
|
73
73
|
if (provider.options === false) return;
|
|
74
|
-
const { forceCreate = false, branch = "tegami/version-packages", base = "main", groups,
|
|
74
|
+
const { forceCreate = false, branch = "tegami/version-packages", base = "main", groups, ...rest } = provider.options ?? {};
|
|
75
75
|
const groupMap = /* @__PURE__ */ new Map();
|
|
76
76
|
if (groups?.length) {
|
|
77
77
|
const unlistedPackages = /* @__PURE__ */ new Set();
|
|
@@ -90,7 +90,7 @@ function onVersionRequest(provider) {
|
|
|
90
90
|
branch,
|
|
91
91
|
base,
|
|
92
92
|
groupMap,
|
|
93
|
-
|
|
93
|
+
...rest
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
@@ -98,16 +98,16 @@ function onVersionRequest(provider) {
|
|
|
98
98
|
*
|
|
99
99
|
* Returns `true` and skips the push when the branch on `remote` already matches.
|
|
100
100
|
*/
|
|
101
|
-
async function syncGroupBranch(context,
|
|
102
|
-
const lock = new PublishLock(baseLock);
|
|
101
|
+
async function syncGroupBranch(context, opts) {
|
|
102
|
+
const lock = new PublishLock(opts.baseLock);
|
|
103
103
|
while (lock.read(namespace));
|
|
104
104
|
lock.write(namespace, opts.store);
|
|
105
|
-
const commit = await createLockCommit(context, {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
});
|
|
110
|
-
if (opts.remote
|
|
105
|
+
const commit = await createLockCommit(context, opts.parent, lock.serialize(), await opts.config.commit?.call(context, {
|
|
106
|
+
type: "update-lock",
|
|
107
|
+
store: opts.store,
|
|
108
|
+
updatedLock: lock
|
|
109
|
+
}));
|
|
110
|
+
if (opts.remote && opts.remote.get(opts.branch) === commit) return true;
|
|
111
111
|
await run(context.cwd, [
|
|
112
112
|
"push",
|
|
113
113
|
"--force",
|
|
@@ -151,7 +151,7 @@ function onVersionRequest(provider) {
|
|
|
151
151
|
packages: Array.from(updatedPackages.values())
|
|
152
152
|
});
|
|
153
153
|
if (requests.length === 0) return;
|
|
154
|
-
await createVersionCommit(this.cwd, "
|
|
154
|
+
await createVersionCommit(this.cwd, await config.commit?.call(this, { type: "version-packages" }));
|
|
155
155
|
let baseLock;
|
|
156
156
|
let parent;
|
|
157
157
|
const tasks = [];
|
|
@@ -173,7 +173,9 @@ function onVersionRequest(provider) {
|
|
|
173
173
|
if (!req.publishGroup) continue;
|
|
174
174
|
newGroups[req.publishGroup] = req.publishGroup !== publishGroup ? "pending" : "active";
|
|
175
175
|
}
|
|
176
|
-
const inSync = await syncGroupBranch(this,
|
|
176
|
+
const inSync = await syncGroupBranch(this, {
|
|
177
|
+
baseLock,
|
|
178
|
+
config,
|
|
177
179
|
branch,
|
|
178
180
|
parent,
|
|
179
181
|
store: { groups: newGroups }
|
|
@@ -246,10 +248,12 @@ function onVersionRequest(provider) {
|
|
|
246
248
|
for (const id of pending) {
|
|
247
249
|
const newGroups = Object.fromEntries(publishGroups.entries());
|
|
248
250
|
newGroups[id] = "active";
|
|
249
|
-
await syncGroupBranch(this,
|
|
251
|
+
await syncGroupBranch(this, {
|
|
250
252
|
branch: `${config.branch}/${id}`,
|
|
253
|
+
baseLock,
|
|
251
254
|
parent,
|
|
252
255
|
remote,
|
|
256
|
+
config,
|
|
253
257
|
store: { groups: newGroups }
|
|
254
258
|
});
|
|
255
259
|
}
|
|
@@ -301,12 +305,12 @@ function renderRequestBody(ctx, { draft, getPreviousVersion, plan }) {
|
|
|
301
305
|
* working tree. Commit dates are pinned to the parent, so unchanged content always produces
|
|
302
306
|
* the exact same commit.
|
|
303
307
|
*/
|
|
304
|
-
async function createLockCommit(context,
|
|
308
|
+
async function createLockCommit(context, parent, content, commit = {}) {
|
|
305
309
|
const { cwd } = context;
|
|
306
310
|
const dir = await mkdtemp(join(tmpdir(), "tegami-"));
|
|
307
311
|
try {
|
|
308
312
|
const blobFile = join(dir, "lock");
|
|
309
|
-
await writeFile(blobFile,
|
|
313
|
+
await writeFile(blobFile, content);
|
|
310
314
|
const blob = await run(cwd, [
|
|
311
315
|
"hash-object",
|
|
312
316
|
"-w",
|
|
@@ -317,24 +321,26 @@ async function createLockCommit(context, opts) {
|
|
|
317
321
|
...process.env,
|
|
318
322
|
GIT_INDEX_FILE: join(dir, "index")
|
|
319
323
|
};
|
|
320
|
-
await run(cwd, ["read-tree",
|
|
324
|
+
await run(cwd, ["read-tree", parent.commit], "Failed to read the current git tree.", env);
|
|
321
325
|
await run(cwd, [
|
|
322
326
|
"update-index",
|
|
323
327
|
"--add",
|
|
324
328
|
"--cacheinfo",
|
|
325
329
|
`100644,${blob},${path}`
|
|
326
330
|
], "Failed to update the lock file entry.", env);
|
|
327
|
-
|
|
331
|
+
const args = [
|
|
328
332
|
"commit-tree",
|
|
329
333
|
await run(cwd, ["write-tree"], "Failed to write the updated git tree.", env),
|
|
330
334
|
"-p",
|
|
331
|
-
|
|
335
|
+
parent.commit,
|
|
332
336
|
"-m",
|
|
333
|
-
|
|
334
|
-
]
|
|
337
|
+
commit.title ?? "Update lock file"
|
|
338
|
+
];
|
|
339
|
+
if (commit.body) args.push("-m", commit.body);
|
|
340
|
+
return await run(cwd, args, "Failed to commit the lock file update.", {
|
|
335
341
|
...env,
|
|
336
|
-
GIT_AUTHOR_DATE:
|
|
337
|
-
GIT_COMMITTER_DATE:
|
|
342
|
+
GIT_AUTHOR_DATE: parent.date,
|
|
343
|
+
GIT_COMMITTER_DATE: parent.date
|
|
338
344
|
});
|
|
339
345
|
} finally {
|
|
340
346
|
await rm(dir, {
|
|
@@ -375,14 +381,16 @@ async function hasGitChanges(cwd) {
|
|
|
375
381
|
return (await run(cwd, ["status", "--porcelain"], "Failed to check git status.")).length > 0;
|
|
376
382
|
}
|
|
377
383
|
/** commit the working tree changes onto a detached HEAD */
|
|
378
|
-
async function createVersionCommit(cwd, title) {
|
|
384
|
+
async function createVersionCommit(cwd, { title = "Version Packages", body } = {}) {
|
|
379
385
|
await run(cwd, ["checkout", "--detach"], "Failed to detach HEAD for version branches.");
|
|
380
386
|
await run(cwd, ["add", "-A"], "Failed to stage version changes.");
|
|
381
|
-
|
|
387
|
+
const args = [
|
|
382
388
|
"commit",
|
|
383
389
|
"-m",
|
|
384
390
|
title
|
|
385
|
-
]
|
|
391
|
+
];
|
|
392
|
+
if (body) args.push("-m", body);
|
|
393
|
+
await run(cwd, args, "Failed to commit version changes.");
|
|
386
394
|
}
|
|
387
395
|
async function pushBranch(cwd, branch) {
|
|
388
396
|
await run(cwd, [
|