tegami 1.0.0-beta.5 → 1.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/cli/index.d.ts +1 -1
- package/dist/cli/index.js +3 -2
- package/dist/{draft-DtFyGxe8.js → draft-BqHcSCeX.js} +32 -23
- package/dist/{error-We7chQVJ.js → error-BhMYq9iW.js} +14 -1
- package/dist/{generate-BfYdNTFi.js → generate-Rvz4Lu98.js} +3 -33
- package/dist/generators/simple.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -141
- package/dist/npm-1iEegfHg.js +684 -0
- package/dist/plugins/cargo.d.ts +97 -0
- package/dist/{cargo-hlZX2akE.js → plugins/cargo.js} +43 -27
- package/dist/plugins/git.d.ts +1 -1
- package/dist/plugins/git.js +1 -1
- package/dist/plugins/github.d.ts +1 -1
- package/dist/plugins/github.js +4 -4
- package/dist/plugins/gitlab.d.ts +1 -1
- package/dist/plugins/gitlab.js +18 -25
- package/dist/plugins/go.d.ts +8 -7
- package/dist/plugins/go.js +34 -20
- package/dist/providers/npm.d.ts +1 -1
- package/dist/providers/npm.js +1 -1
- package/dist/shared-C92toqVI.js +32 -0
- package/dist/{types-C1rEqeM4.d.ts → types-DItu_YCc.d.ts} +100 -178
- package/dist/utils/index.js +1 -1
- package/dist/{version-request-DKvR3_xb.js → version-request-oxy16TJ1.js} +1 -1
- package/package.json +2 -2
- package/dist/npm-CMOyacwf.js +0 -371
- package/dist/providers/cargo.d.ts +0 -2
- package/dist/providers/cargo.js +0 -2
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { O as BumpType, s as TegamiPlugin, w as WorkspacePackage } from "../types-DItu_YCc.js";
|
|
2
|
+
import z from "zod";
|
|
3
|
+
|
|
4
|
+
//#region src/plugins/cargo/schema.d.ts
|
|
5
|
+
declare const cargoManifestSchema: z.ZodObject<{
|
|
6
|
+
package: z.ZodObject<{
|
|
7
|
+
name: z.ZodString;
|
|
8
|
+
version: z.ZodOptional<z.ZodString>;
|
|
9
|
+
publish: z.ZodOptional<z.ZodBoolean>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
workspace: z.ZodOptional<z.ZodObject<{
|
|
12
|
+
members: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
13
|
+
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
14
|
+
package: z.ZodOptional<z.ZodObject<{
|
|
15
|
+
version: z.ZodOptional<z.ZodString>;
|
|
16
|
+
}, z.core.$strip>>;
|
|
17
|
+
}, z.core.$strip>>;
|
|
18
|
+
dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
19
|
+
version: z.ZodString;
|
|
20
|
+
package: z.ZodOptional<z.ZodString>;
|
|
21
|
+
path: z.ZodOptional<z.ZodString>;
|
|
22
|
+
}, z.core.$strip>]>>>;
|
|
23
|
+
"dev-dependencies": z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
24
|
+
version: z.ZodString;
|
|
25
|
+
package: z.ZodOptional<z.ZodString>;
|
|
26
|
+
path: z.ZodOptional<z.ZodString>;
|
|
27
|
+
}, z.core.$strip>]>>>;
|
|
28
|
+
"build-dependencies": z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
29
|
+
version: z.ZodString;
|
|
30
|
+
package: z.ZodOptional<z.ZodString>;
|
|
31
|
+
path: z.ZodOptional<z.ZodString>;
|
|
32
|
+
}, z.core.$strip>]>>>;
|
|
33
|
+
target: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
34
|
+
dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
35
|
+
version: z.ZodString;
|
|
36
|
+
package: z.ZodOptional<z.ZodString>;
|
|
37
|
+
path: z.ZodOptional<z.ZodString>;
|
|
38
|
+
}, z.core.$strip>]>>>;
|
|
39
|
+
"dev-dependencies": z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
40
|
+
version: z.ZodString;
|
|
41
|
+
package: z.ZodOptional<z.ZodString>;
|
|
42
|
+
path: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, z.core.$strip>]>>>;
|
|
44
|
+
"build-dependencies": z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
45
|
+
version: z.ZodString;
|
|
46
|
+
package: z.ZodOptional<z.ZodString>;
|
|
47
|
+
path: z.ZodOptional<z.ZodString>;
|
|
48
|
+
}, z.core.$strip>]>>>;
|
|
49
|
+
}, z.core.$strip>>>;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
type CargoManifest = z.infer<typeof cargoManifestSchema>;
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/plugins/cargo.d.ts
|
|
54
|
+
declare const DEP_FIELDS: readonly ["dependencies", "dev-dependencies", "build-dependencies"];
|
|
55
|
+
declare class CargoPackage extends WorkspacePackage {
|
|
56
|
+
readonly path: string;
|
|
57
|
+
readonly manifest: CargoManifest;
|
|
58
|
+
private content;
|
|
59
|
+
private readonly workspaceManifest?;
|
|
60
|
+
readonly manager = "cargo";
|
|
61
|
+
constructor(path: string, manifest: CargoManifest, content: string, workspaceManifest?: CargoManifest | undefined);
|
|
62
|
+
get name(): string;
|
|
63
|
+
get version(): string | undefined;
|
|
64
|
+
setVersion(version: string): void;
|
|
65
|
+
write(): Promise<void>;
|
|
66
|
+
patch(path: string, value: unknown): void;
|
|
67
|
+
get packageInfo(): {
|
|
68
|
+
name: string;
|
|
69
|
+
version?: string | undefined;
|
|
70
|
+
publish?: boolean | undefined;
|
|
71
|
+
};
|
|
72
|
+
private get workspaceVersion();
|
|
73
|
+
}
|
|
74
|
+
interface DependentRef {
|
|
75
|
+
dependent: CargoPackage;
|
|
76
|
+
kind: (typeof DEP_FIELDS)[number];
|
|
77
|
+
name: string;
|
|
78
|
+
version: string;
|
|
79
|
+
}
|
|
80
|
+
interface CargoPluginOptions {
|
|
81
|
+
/**
|
|
82
|
+
* Update lock file after versioning.
|
|
83
|
+
*
|
|
84
|
+
* @default true
|
|
85
|
+
*/
|
|
86
|
+
updateLockFile?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Decide how to bump the dependents of a bumped package.
|
|
89
|
+
*/
|
|
90
|
+
bumpDep?: (opts: DependentRef) => BumpType | false;
|
|
91
|
+
}
|
|
92
|
+
declare function cargo({
|
|
93
|
+
updateLockFile,
|
|
94
|
+
bumpDep: getBumpDepType
|
|
95
|
+
}?: CargoPluginOptions): TegamiPlugin;
|
|
96
|
+
//#endregion
|
|
97
|
+
export { CargoPackage, CargoPluginOptions, cargo };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { n as execFailure } from "
|
|
2
|
-
import { n as WorkspacePackage } from "
|
|
1
|
+
import { n as execFailure } from "../error-BhMYq9iW.js";
|
|
2
|
+
import { n as WorkspacePackage } from "../graph-gThXu8Cz.js";
|
|
3
3
|
import { readFile, writeFile } from "node:fs/promises";
|
|
4
4
|
import { join, normalize } from "node:path";
|
|
5
5
|
import { x } from "tinyexec";
|
|
6
6
|
import * as semver$1 from "semver";
|
|
7
7
|
import z from "zod";
|
|
8
|
-
import initToml, { edit, parse as parse$1 } from "@rainbowatcher/toml-edit-js";
|
|
9
8
|
import { glob } from "tinyglobby";
|
|
10
|
-
|
|
9
|
+
import initToml, { edit, parse as parse$1 } from "@rainbowatcher/toml-edit-js";
|
|
10
|
+
//#region src/plugins/cargo/schema.ts
|
|
11
11
|
const cargoDependencySchema = z.union([z.string(), z.object({
|
|
12
12
|
version: z.string(),
|
|
13
13
|
package: z.string().optional(),
|
|
@@ -37,7 +37,7 @@ const cargoManifestSchema = z.object({
|
|
|
37
37
|
target: z.record(z.string(), cargoTargetConfigSchema).optional()
|
|
38
38
|
});
|
|
39
39
|
//#endregion
|
|
40
|
-
//#region src/
|
|
40
|
+
//#region src/plugins/cargo.ts
|
|
41
41
|
const DEP_FIELDS = [
|
|
42
42
|
"dependencies",
|
|
43
43
|
"dev-dependencies",
|
|
@@ -111,6 +111,7 @@ function cargo({ updateLockFile = true, bumpDep: getBumpDepType } = {}) {
|
|
|
111
111
|
};
|
|
112
112
|
},
|
|
113
113
|
resolvePlanStatus({ plan }) {
|
|
114
|
+
if (!active) return;
|
|
114
115
|
return Array.from(plan.packages, async ([id, { preflight }]) => {
|
|
115
116
|
if (!preflight.shouldPublish) return;
|
|
116
117
|
const pkg = this.graph.get(id);
|
|
@@ -173,32 +174,47 @@ function depsPolicy({ graph }, getBumpDepType = ({ kind }) => {
|
|
|
173
174
|
case "dev-dependencies": return false;
|
|
174
175
|
}
|
|
175
176
|
}) {
|
|
177
|
+
const dependentMap = /* @__PURE__ */ new Map();
|
|
178
|
+
for (const pkg of graph.getPackages()) {
|
|
179
|
+
if (!(pkg instanceof CargoPackage)) continue;
|
|
180
|
+
for (const { table, kind } of dependencyTables(pkg.manifest, "")) for (const [rawName, rawSpec] of Object.entries(table)) {
|
|
181
|
+
const spec = parseSpec(rawSpec);
|
|
182
|
+
if (!spec || !semver$1.validRange(spec.version)) continue;
|
|
183
|
+
const name = spec.package ?? rawName;
|
|
184
|
+
const id = `cargo:${name}`;
|
|
185
|
+
const refs = dependentMap.get(id);
|
|
186
|
+
if (refs) refs.push({
|
|
187
|
+
dependent: pkg,
|
|
188
|
+
kind,
|
|
189
|
+
name,
|
|
190
|
+
version: spec.version
|
|
191
|
+
});
|
|
192
|
+
else dependentMap.set(id, [{
|
|
193
|
+
dependent: pkg,
|
|
194
|
+
kind,
|
|
195
|
+
name,
|
|
196
|
+
version: spec.version
|
|
197
|
+
}]);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
176
200
|
return {
|
|
177
201
|
id: "cargo:deps",
|
|
178
202
|
onUpdate({ pkg, packageDraft: plan }) {
|
|
179
203
|
if (!(pkg instanceof CargoPackage)) return;
|
|
204
|
+
const deps = dependentMap.get(pkg.id);
|
|
205
|
+
if (!deps) return;
|
|
180
206
|
const group = graph.getPackageGroup(pkg.id);
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
dependent,
|
|
193
|
-
name: pkg.name,
|
|
194
|
-
version: spec.version
|
|
195
|
-
});
|
|
196
|
-
if (bumpType === false) continue;
|
|
197
|
-
this.bumpPackage(dependent, {
|
|
198
|
-
type: bumpType,
|
|
199
|
-
reason: `update dependency "${rawName}"`
|
|
200
|
-
});
|
|
201
|
-
}
|
|
207
|
+
const bumped = plan.bumpVersion(pkg);
|
|
208
|
+
if (!bumped) return;
|
|
209
|
+
for (const dep of deps) {
|
|
210
|
+
if (group?.options.syncBump && graph.getPackageGroup(dep.dependent.id) === group) continue;
|
|
211
|
+
if (semver$1.satisfies(bumped, dep.version)) continue;
|
|
212
|
+
const bumpType = getBumpDepType(dep);
|
|
213
|
+
if (bumpType === false) continue;
|
|
214
|
+
this.bumpPackage(dep.dependent, {
|
|
215
|
+
type: bumpType,
|
|
216
|
+
reason: `update dependency "${dep.name}"`
|
|
217
|
+
});
|
|
202
218
|
}
|
|
203
219
|
}
|
|
204
220
|
};
|
|
@@ -289,4 +305,4 @@ function parseSpec(v) {
|
|
|
289
305
|
};
|
|
290
306
|
}
|
|
291
307
|
//#endregion
|
|
292
|
-
export {
|
|
308
|
+
export { CargoPackage, cargo };
|
package/dist/plugins/git.d.ts
CHANGED
package/dist/plugins/git.js
CHANGED
package/dist/plugins/github.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { T as Draft, s as TegamiPlugin, t as Awaitable, w as WorkspacePackage, x as TegamiContext, y as PublishPlan } from "../types-DItu_YCc.js";
|
|
2
2
|
import { GitPluginOptions } from "./git.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugins/github.d.ts
|
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 { a as cached, n as execFailure, o as isCI } from "../error-
|
|
4
|
-
import { n as createDraft, o as readChangelogEntries } from "../draft-
|
|
2
|
+
import { t as changelogFilename } from "../generate-Rvz4Lu98.js";
|
|
3
|
+
import { a as cached, n as execFailure, o as isCI } from "../error-BhMYq9iW.js";
|
|
4
|
+
import { n as createDraft, o as readChangelogEntries } from "../draft-BqHcSCeX.js";
|
|
5
5
|
import { git } from "./git.js";
|
|
6
|
-
import { n as createVersionRequestBody, r as hasGitChanges, t as commitVersionBranchChanges } from "../version-request-
|
|
6
|
+
import { n as createVersionRequestBody, r as hasGitChanges, t as commitVersionBranchChanges } from "../version-request-oxy16TJ1.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";
|
package/dist/plugins/gitlab.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { T as Draft, s as TegamiPlugin, t as Awaitable, w as WorkspacePackage, x as TegamiContext, y as PublishPlan } from "../types-DItu_YCc.js";
|
|
2
2
|
import { GitPluginOptions } from "./git.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugins/gitlab.d.ts
|
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 { a as cached, n as execFailure, o as isCI } from "../error-
|
|
4
|
-
import { n as createDraft, o as readChangelogEntries } from "../draft-
|
|
2
|
+
import { t as changelogFilename } from "../generate-Rvz4Lu98.js";
|
|
3
|
+
import { a as cached, n as execFailure, o as isCI, s as joinPath } from "../error-BhMYq9iW.js";
|
|
4
|
+
import { n as createDraft, o as readChangelogEntries } from "../draft-BqHcSCeX.js";
|
|
5
5
|
import { git } from "./git.js";
|
|
6
|
-
import { n as createVersionRequestBody, r as hasGitChanges, t as commitVersionBranchChanges } from "../version-request-
|
|
6
|
+
import { n as createVersionRequestBody, r as hasGitChanges, t as commitVersionBranchChanges } from "../version-request-oxy16TJ1.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";
|
|
@@ -18,17 +18,11 @@ function parseGitLabRepo(repo) {
|
|
|
18
18
|
encodedProjectPath: encodeURIComponent(projectPath)
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
function gitlabApiUrl(apiUrl = "https://gitlab.com/api/v4") {
|
|
22
|
-
return apiUrl.replace(/\/+$/, "");
|
|
23
|
-
}
|
|
24
|
-
function gitlabWebUrl(webUrl = "https://gitlab.com") {
|
|
25
|
-
return webUrl.replace(/\/+$/, "");
|
|
26
|
-
}
|
|
27
21
|
async function gitlabRequest(options, path, init = {}) {
|
|
28
22
|
const headers = new Headers(init.headers);
|
|
29
23
|
headers.set("Accept", "application/json");
|
|
30
24
|
if (options.token) headers.set(options.token.type === "job-token" ? "JOB-TOKEN" : "PRIVATE-TOKEN", options.token.value);
|
|
31
|
-
return fetch(
|
|
25
|
+
return fetch(joinPath(options.apiUrl ?? "https://gitlab.com/api/v4", path), {
|
|
32
26
|
...init,
|
|
33
27
|
headers
|
|
34
28
|
});
|
|
@@ -227,7 +221,7 @@ async function buildMrPreview(context, draft, options = {}) {
|
|
|
227
221
|
return lines.join("\n");
|
|
228
222
|
}
|
|
229
223
|
async function postMrComment(context, body, options = {}) {
|
|
230
|
-
const { repo } = context.gitlab
|
|
224
|
+
const { repo, apiUrl, token } = context.gitlab;
|
|
231
225
|
if (!repo) {
|
|
232
226
|
outro("GITLAB_REPOSITORY or CI_PROJECT_PATH is required.");
|
|
233
227
|
return;
|
|
@@ -238,8 +232,8 @@ async function postMrComment(context, body, options = {}) {
|
|
|
238
232
|
return;
|
|
239
233
|
}
|
|
240
234
|
const api = {
|
|
241
|
-
apiUrl
|
|
242
|
-
token
|
|
235
|
+
apiUrl,
|
|
236
|
+
token
|
|
243
237
|
};
|
|
244
238
|
const markedBody = `${COMMENT_MARKER}\n${body}`;
|
|
245
239
|
const existingId = await findMergeRequestCommentByPrefix(repo, number, COMMENT_MARKER, api);
|
|
@@ -250,11 +244,11 @@ async function postMrComment(context, body, options = {}) {
|
|
|
250
244
|
await createMergeRequestComment(repo, number, markedBody, api);
|
|
251
245
|
}
|
|
252
246
|
async function resolveMergeRequest(context, options) {
|
|
253
|
-
const { repo } = context.gitlab
|
|
247
|
+
const { repo, apiUrl, token } = context.gitlab;
|
|
254
248
|
if (!repo) throw new Error("GITLAB_REPOSITORY or CI_PROJECT_PATH is required.");
|
|
255
249
|
const api = {
|
|
256
|
-
apiUrl
|
|
257
|
-
token
|
|
250
|
+
apiUrl,
|
|
251
|
+
token
|
|
258
252
|
};
|
|
259
253
|
if (options.number !== void 0) {
|
|
260
254
|
const data = await getMergeRequest(repo, options.number, api);
|
|
@@ -299,7 +293,7 @@ function createChangelogUrl(context, repo, branch, filename) {
|
|
|
299
293
|
const filePath = join(relative(context.cwd, context.changelogDir), filename).replaceAll("\\", "/");
|
|
300
294
|
const branchPath = branch.split("/").map(encodeURIComponent).join("/");
|
|
301
295
|
const params = new URLSearchParams({ file_name: filePath });
|
|
302
|
-
return
|
|
296
|
+
return joinPath(context.gitlab.webUrl, repo, "-/new", branchPath) + `?${params}`;
|
|
303
297
|
}
|
|
304
298
|
function parsePositiveInt(value, option) {
|
|
305
299
|
const number = Number(value);
|
|
@@ -322,8 +316,8 @@ function gitlab(options = {}) {
|
|
|
322
316
|
this.gitlab = {
|
|
323
317
|
repo: options.repo ?? process.env.GITLAB_REPOSITORY ?? process.env.CI_PROJECT_PATH,
|
|
324
318
|
token: resolveGitLabToken(options.token),
|
|
325
|
-
apiUrl: options.apiUrl ?? process.env.GITLAB_API_URL ?? process.env.CI_API_V4_URL,
|
|
326
|
-
webUrl: options.webUrl ?? process.env.GITLAB_SERVER_URL ?? process.env.CI_SERVER_URL
|
|
319
|
+
apiUrl: options.apiUrl ?? process.env.GITLAB_API_URL ?? process.env.CI_API_V4_URL ?? "https://gitlab.com/api/v4",
|
|
320
|
+
webUrl: options.webUrl ?? process.env.GITLAB_SERVER_URL ?? process.env.CI_SERVER_URL ?? "https://gitlab.com"
|
|
327
321
|
};
|
|
328
322
|
},
|
|
329
323
|
async resolvePlanStatus({ plan }) {
|
|
@@ -389,7 +383,7 @@ function gitlab(options = {}) {
|
|
|
389
383
|
async initCli(cli) {
|
|
390
384
|
registerMrCli(cli);
|
|
391
385
|
if (!isCI()) return;
|
|
392
|
-
const { repo, token, webUrl } = this.gitlab
|
|
386
|
+
const { repo, token, webUrl } = this.gitlab;
|
|
393
387
|
if (!token || !repo) return;
|
|
394
388
|
const result = await x("git", [
|
|
395
389
|
"remote",
|
|
@@ -442,7 +436,6 @@ function gitlab(options = {}) {
|
|
|
442
436
|
function createChangelogRenderer(context) {
|
|
443
437
|
const { repo, webUrl } = context.gitlab;
|
|
444
438
|
const api = gitLabApiOptions(context.gitlab);
|
|
445
|
-
const baseUrl = gitlabWebUrl(webUrl);
|
|
446
439
|
const resolveFileCommit = cached((filename) => filename, async (filename) => {
|
|
447
440
|
const result = await x("git", [
|
|
448
441
|
"log",
|
|
@@ -470,7 +463,7 @@ function createChangelogRenderer(context) {
|
|
|
470
463
|
if (meta.mergeRequests.length === 0) return;
|
|
471
464
|
const lines = [];
|
|
472
465
|
for (const mr of meta.mergeRequests) {
|
|
473
|
-
let line = repo ? `- [!${mr.number} ${mr.title}](${
|
|
466
|
+
let line = repo ? `- [!${mr.number} ${mr.title}](${joinPath(webUrl, repo, "-/merge_requests", String(mr.number))})` : `- #${mr.number} ${mr.title}`;
|
|
474
467
|
if (mr.user) line += ` by @${mr.user.login}`;
|
|
475
468
|
lines.push(line);
|
|
476
469
|
}
|
|
@@ -488,7 +481,7 @@ function createChangelogRenderer(context) {
|
|
|
488
481
|
let commitSuffix = "";
|
|
489
482
|
if (meta.commit) {
|
|
490
483
|
const short = meta.commit.slice(0, 7);
|
|
491
|
-
const link = repo ? `[${short}](${
|
|
484
|
+
const link = repo ? `[${short}](${joinPath(webUrl, repo, "-/commit", meta.commit)})` : `\`${short}\``;
|
|
492
485
|
commitSuffix += ` (${link})`;
|
|
493
486
|
}
|
|
494
487
|
const lines = [];
|
|
@@ -548,7 +541,7 @@ function resolveGitLabToken(optionToken) {
|
|
|
548
541
|
}
|
|
549
542
|
function gitlabRemoteUrl(repo, token, webUrl) {
|
|
550
543
|
const username = token.type === "job-token" ? "gitlab-ci-token" : "oauth2";
|
|
551
|
-
return
|
|
544
|
+
return joinPath(webUrl.replace(/^https?:\/\//, `https://${username}:${token.value}@`), `${repo}.git`);
|
|
552
545
|
}
|
|
553
546
|
//#endregion
|
|
554
547
|
export { gitlab };
|
package/dist/plugins/go.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { O as BumpType, s as TegamiPlugin, w as WorkspacePackage } from "../types-DItu_YCc.js";
|
|
2
2
|
|
|
3
3
|
//#region src/plugins/go.d.ts
|
|
4
4
|
interface GoModFile {
|
|
@@ -24,6 +24,11 @@ declare class GoPackage extends WorkspacePackage {
|
|
|
24
24
|
setRequire(module: string, version: string): void;
|
|
25
25
|
write(): Promise<void>;
|
|
26
26
|
}
|
|
27
|
+
interface DependentRef {
|
|
28
|
+
dependent: GoPackage;
|
|
29
|
+
name: string;
|
|
30
|
+
version: string;
|
|
31
|
+
}
|
|
27
32
|
interface GoPluginOptions {
|
|
28
33
|
/**
|
|
29
34
|
* Run `go work sync` or `go mod tidy` after versioning.
|
|
@@ -31,14 +36,10 @@ interface GoPluginOptions {
|
|
|
31
36
|
* @default true
|
|
32
37
|
*/
|
|
33
38
|
updateLockFile?: boolean;
|
|
34
|
-
bumpDep?: (opts:
|
|
35
|
-
dependent: GoPackage;
|
|
36
|
-
name: string;
|
|
37
|
-
version: string;
|
|
38
|
-
}) => BumpType | false;
|
|
39
|
+
bumpDep?: (opts: DependentRef) => BumpType | false;
|
|
39
40
|
}
|
|
40
41
|
/**
|
|
41
|
-
*
|
|
42
|
+
* Plugin for Golang, the release flow of Golang is pretty special, there's some exceptions for it:
|
|
42
43
|
*
|
|
43
44
|
* - Version is stored in lock file, normally, it should prefer to store versions in a file like `package.json` & `Cargo.toml`, but for Golang, there is no such file.
|
|
44
45
|
* - Publishing is handed to Git plugin, because Golang uses Git tag for publishing.
|
package/dist/plugins/go.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as isNodeError, n as execFailure } from "../error-
|
|
1
|
+
import { i as isNodeError, n as execFailure } from "../error-BhMYq9iW.js";
|
|
2
2
|
import { n as WorkspacePackage } from "../graph-gThXu8Cz.js";
|
|
3
3
|
import { relative, resolve } from "node:path";
|
|
4
4
|
import { x } from "tinyexec";
|
|
@@ -66,7 +66,7 @@ const packageLockSchema = z.object({
|
|
|
66
66
|
version: z.string()
|
|
67
67
|
});
|
|
68
68
|
/**
|
|
69
|
-
*
|
|
69
|
+
* Plugin for Golang, the release flow of Golang is pretty special, there's some exceptions for it:
|
|
70
70
|
*
|
|
71
71
|
* - Version is stored in lock file, normally, it should prefer to store versions in a file like `package.json` & `Cargo.toml`, but for Golang, there is no such file.
|
|
72
72
|
* - Publishing is handed to Git plugin, because Golang uses Git tag for publishing.
|
|
@@ -153,6 +153,7 @@ function go({ updateLockFile = true, bumpDep: getBumpDepType } = {}) {
|
|
|
153
153
|
};
|
|
154
154
|
},
|
|
155
155
|
resolvePlanStatus({ plan }) {
|
|
156
|
+
if (!active) return;
|
|
156
157
|
return Array.from(plan.packages, async ([id, { preflight }]) => {
|
|
157
158
|
if (!preflight.shouldPublish) return;
|
|
158
159
|
const pkg = this.graph.get(id);
|
|
@@ -180,29 +181,42 @@ function go({ updateLockFile = true, bumpDep: getBumpDepType } = {}) {
|
|
|
180
181
|
};
|
|
181
182
|
}
|
|
182
183
|
function depsPolicy({ graph }, getBumpDepType = () => "patch") {
|
|
184
|
+
const dependentMap = /* @__PURE__ */ new Map();
|
|
185
|
+
for (const pkg of graph.getPackages()) {
|
|
186
|
+
if (!(pkg instanceof GoPackage)) continue;
|
|
187
|
+
for (const [name, version] of pkg.mod.requires) {
|
|
188
|
+
const id = `go:${name}`;
|
|
189
|
+
const refs = dependentMap.get(id);
|
|
190
|
+
if (refs) refs.push({
|
|
191
|
+
dependent: pkg,
|
|
192
|
+
name,
|
|
193
|
+
version
|
|
194
|
+
});
|
|
195
|
+
else dependentMap.set(id, [{
|
|
196
|
+
dependent: pkg,
|
|
197
|
+
name,
|
|
198
|
+
version
|
|
199
|
+
}]);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
183
202
|
return {
|
|
184
203
|
id: "go:deps",
|
|
185
204
|
onUpdate({ pkg, packageDraft: plan }) {
|
|
186
205
|
if (!(pkg instanceof GoPackage)) return;
|
|
206
|
+
const deps = dependentMap.get(pkg.id);
|
|
207
|
+
if (!deps) return;
|
|
187
208
|
const group = graph.getPackageGroup(pkg.id);
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
});
|
|
200
|
-
if (bumpType === false) continue;
|
|
201
|
-
this.bumpPackage(dependent, {
|
|
202
|
-
type: bumpType,
|
|
203
|
-
reason: `update require "${moduleName}"`
|
|
204
|
-
});
|
|
205
|
-
}
|
|
209
|
+
const bumped = plan.bumpVersion(pkg);
|
|
210
|
+
if (!bumped) return;
|
|
211
|
+
for (const dep of deps) {
|
|
212
|
+
if (group?.options.syncBump && graph.getPackageGroup(dep.dependent.id) === group) continue;
|
|
213
|
+
if (semver$1.satisfies(bumped, stripGoVersion(dep.version))) continue;
|
|
214
|
+
const bumpType = getBumpDepType?.(dep);
|
|
215
|
+
if (bumpType === false) continue;
|
|
216
|
+
this.bumpPackage(dep.dependent, {
|
|
217
|
+
type: bumpType,
|
|
218
|
+
reason: `update require "${dep.name}"`
|
|
219
|
+
});
|
|
206
220
|
}
|
|
207
221
|
}
|
|
208
222
|
};
|
package/dist/providers/npm.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as npm, l as NpmPackage, u as NpmPluginOptions } from "../types-DItu_YCc.js";
|
|
2
2
|
export { NpmPackage, NpmPluginOptions, npm };
|
package/dist/providers/npm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as npm, t as NpmPackage } from "../npm-
|
|
1
|
+
import { n as npm, t as NpmPackage } from "../npm-1iEegfHg.js";
|
|
2
2
|
export { NpmPackage, npm };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { dump } from "js-yaml";
|
|
3
|
+
//#region src/changelog/shared.ts
|
|
4
|
+
const bumpTypeSchema = z.enum([
|
|
5
|
+
"major",
|
|
6
|
+
"minor",
|
|
7
|
+
"patch"
|
|
8
|
+
]);
|
|
9
|
+
const changelogPackageConfigSchema = z.object({
|
|
10
|
+
type: bumpTypeSchema.optional(),
|
|
11
|
+
replay: z.array(z.string().min(1)).optional()
|
|
12
|
+
});
|
|
13
|
+
const changelogFrontmatterSchema = z.object({
|
|
14
|
+
subject: z.string().optional(),
|
|
15
|
+
packages: z.union([z.array(z.string()), z.record(z.string(), z.union([
|
|
16
|
+
bumpTypeSchema,
|
|
17
|
+
z.null(),
|
|
18
|
+
changelogPackageConfigSchema
|
|
19
|
+
]))]).optional()
|
|
20
|
+
});
|
|
21
|
+
function renderChangelog(frontmatter, body) {
|
|
22
|
+
return [
|
|
23
|
+
"---",
|
|
24
|
+
dump(frontmatter).trim(),
|
|
25
|
+
"---",
|
|
26
|
+
"",
|
|
27
|
+
body.trim(),
|
|
28
|
+
""
|
|
29
|
+
].join("\n");
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { renderChangelog as n, changelogFrontmatterSchema as t };
|