tegami 1.2.2 → 1.2.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/dist/{_accessExpressionAsString-QhbUZzwv.js → _accessExpressionAsString-DW_6Xqcp.js} +1 -1
- package/dist/{_assertGuard-BBn2NbSz.js → _assertGuard-CFFC1Up9.js} +2 -2
- package/dist/{_createStandardSchema-BGQyz-uA.js → _createStandardSchema-CrRqJgaE.js} +2 -2
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +2 -3
- package/dist/{generate-Cnd8RiKO.js → generate-Cgl2G5ea.js} +2 -2
- package/dist/generators/simple.d.ts +1 -1
- package/dist/generators/simple.js +1 -1
- package/dist/{graph-BmXTJZxx.js → graph-DaJ28Y4f.js} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -4
- package/dist/{npm-cS-D2xGI.js → npm-uJA8deYA.js} +214 -124
- package/dist/plugins/cargo.d.ts +1 -1
- package/dist/plugins/cargo.js +3 -3
- package/dist/plugins/git.d.ts +1 -1
- package/dist/plugins/github.d.ts +2 -2
- package/dist/plugins/github.js +8 -46
- package/dist/plugins/gitlab.d.ts +2 -2
- package/dist/plugins/gitlab.js +8 -45
- package/dist/plugins/go.d.ts +1 -1
- package/dist/plugins/go.js +2 -2
- package/dist/providers/npm.d.ts +1 -1
- package/dist/providers/npm.js +1 -1
- package/dist/{publish-Bt3e1RPs.js → publish-BEYIILK5.js} +6 -12
- package/dist/{semver-EKJ8yK5U.js → semver-DrtaCCZK.js} +15 -3
- package/dist/{shared-C_iSTp_s.js → shared-pTOZU5UZ.js} +11 -3
- package/dist/{types-C_vz41r2.d.ts → types-Kj7Nxbjz.d.ts} +26 -23
- package/dist/{version-request-DXk_B7O_.d.ts → version-request-C5vtakPE.d.ts} +1 -1
- package/dist/{version-request-DvWVAYj2.js → version-request-C89RO85i.js} +73 -27
- package/package.json +5 -4
package/dist/{_accessExpressionAsString-QhbUZzwv.js → _accessExpressionAsString-DW_6Xqcp.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/typia@12.1.1_@types+node@26.
|
|
1
|
+
//#region ../../node_modules/.pnpm/typia@12.1.1_@types+node@26.1.0_typescript@6.0.3/node_modules/typia/lib/internal/_accessExpressionAsString.mjs
|
|
2
2
|
const _accessExpressionAsString = (str) => variable(str) ? `.${str}` : `[${JSON.stringify(str)}]`;
|
|
3
3
|
const variable = (str) => reserved(str) === false && /^[a-zA-Z_$][a-zA-Z_$0-9]*$/g.test(str);
|
|
4
4
|
const reserved = (str) => RESERVED.has(str);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/typia@12.1.1_@types+node@26.
|
|
1
|
+
//#region ../../node_modules/.pnpm/typia@12.1.1_@types+node@26.1.0_typescript@6.0.3/node_modules/typia/lib/TypeGuardError.mjs
|
|
2
2
|
/**
|
|
3
3
|
* Error thrown when type assertion fails.
|
|
4
4
|
*
|
|
@@ -81,7 +81,7 @@ var TypeGuardError = class extends Error {
|
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
//#endregion
|
|
84
|
-
//#region ../../node_modules/.pnpm/typia@12.1.1_@types+node@26.
|
|
84
|
+
//#region ../../node_modules/.pnpm/typia@12.1.1_@types+node@26.1.0_typescript@6.0.3/node_modules/typia/lib/internal/_assertGuard.mjs
|
|
85
85
|
const _assertGuard = (exceptionable, props, factory) => {
|
|
86
86
|
if (exceptionable === true) if (factory) throw factory(props);
|
|
87
87
|
else throw new TypeGuardError(props);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/typia@12.1.1_@types+node@26.
|
|
1
|
+
//#region ../../node_modules/.pnpm/typia@12.1.1_@types+node@26.1.0_typescript@6.0.3/node_modules/typia/lib/internal/_validateReport.mjs
|
|
2
2
|
const _validateReport = (array) => {
|
|
3
3
|
const reportable = (path) => {
|
|
4
4
|
if (array.length === 0) return true;
|
|
@@ -18,7 +18,7 @@ const _validateReport = (array) => {
|
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
//#endregion
|
|
21
|
-
//#region ../../node_modules/.pnpm/typia@12.1.1_@types+node@26.
|
|
21
|
+
//#region ../../node_modules/.pnpm/typia@12.1.1_@types+node@26.1.0_typescript@6.0.3/node_modules/typia/lib/internal/_createStandardSchema.mjs
|
|
22
22
|
const _createStandardSchema = (fn) => Object.assign(fn, { "~standard": {
|
|
23
23
|
version: 1,
|
|
24
24
|
vendor: "typia",
|
package/dist/cli/index.d.ts
CHANGED
package/dist/cli/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as generateFromCommits, t as changelogFilename } from "../generate-
|
|
1
|
+
import { n as generateFromCommits, t as changelogFilename } from "../generate-Cgl2G5ea.js";
|
|
2
2
|
import { i as handlePluginError, s as isCI, t as CancelledError } from "../error-CAsrGb6e.js";
|
|
3
|
-
import {
|
|
3
|
+
import { n as renderChangelog } from "../shared-pTOZU5UZ.js";
|
|
4
4
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
5
5
|
import path, { join, relative } from "node:path";
|
|
6
6
|
import { x } from "tinyexec";
|
|
@@ -42,7 +42,6 @@ function resolveChangedPackages(graph, files, cwd) {
|
|
|
42
42
|
//#region src/cli/changelog.ts
|
|
43
43
|
async function runChangelogTui(tegami) {
|
|
44
44
|
const context = await tegami._internal.context();
|
|
45
|
-
if (await tegami.publishStatus() === "pending") throw new Error(`Publish lock at ${context.lockPath} is still pending. Publish it before applying a new draft.`);
|
|
46
45
|
intro("Create changelogs");
|
|
47
46
|
let selectedPackages = [];
|
|
48
47
|
if (!isCI()) selectedPackages = await promptPackageSelection(context.graph, context.cwd);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as maxBump, t as bumpDepth } from "./semver-DrtaCCZK.js";
|
|
2
2
|
import { n as execFailure } from "./error-CAsrGb6e.js";
|
|
3
|
-
import {
|
|
3
|
+
import { n as renderChangelog } from "./shared-pTOZU5UZ.js";
|
|
4
4
|
import { x } from "tinyexec";
|
|
5
5
|
//#region src/utils/conventional-commit.ts
|
|
6
6
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as PackageGroup, F as BumpType, M as Draft, N as DraftPolicy, P as PackageDraft, _ as PackagePublishResult, a as PublishPreflight, b as CommitChangelog, c as TegamiPluginOption, d as GenerateChangelogOptions, f as Tegami, g as PackagePublishPlan, h as PublishLock, i as PackageOptions, k as PackageGraph, m as tegami, n as GroupOptions, o as TegamiOptions, p as WorkspacePackage, r as LogGenerator, s as TegamiPlugin, v as PublishOptions, x as TegamiContext, y as PublishPlan } from "./types-Kj7Nxbjz.js";
|
|
2
2
|
export { type BumpType, type CommitChangelog, type Draft, type DraftPolicy, GenerateChangelogOptions, type GroupOptions, type LogGenerator, type PackageDraft, PackageGraph, type PackageGroup, type PackageOptions, type PackagePublishPlan, type PackagePublishResult, type PublishLock, type PublishOptions, type PublishPlan, type PublishPreflight, Tegami, type TegamiContext, type TegamiOptions, type TegamiPlugin, type TegamiPluginOption, WorkspacePackage, tegami };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as generateFromCommits } from "./generate-
|
|
1
|
+
import { n as generateFromCommits } from "./generate-Cgl2G5ea.js";
|
|
2
2
|
import { i as handlePluginError } from "./error-CAsrGb6e.js";
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
5
|
-
import { n as WorkspacePackage, t as PackageGraph } from "./graph-
|
|
3
|
+
import { t as npm } from "./npm-uJA8deYA.js";
|
|
4
|
+
import { a as createDraft, c as parseChangelogFile, i as runPublishPlan, l as readChangelogEntries, n as publishPlanStatus, r as runPreflights, t as initPublishPlan } from "./publish-BEYIILK5.js";
|
|
5
|
+
import { n as WorkspacePackage$1, t as PackageGraph } from "./graph-DaJ28Y4f.js";
|
|
6
6
|
import { mkdir, rm, writeFile } from "node:fs/promises";
|
|
7
7
|
import path, { join } from "node:path";
|
|
8
8
|
//#region src/context.ts
|
|
@@ -55,6 +55,7 @@ function resolvePlugins(plugins = []) {
|
|
|
55
55
|
}
|
|
56
56
|
//#endregion
|
|
57
57
|
//#region src/index.ts
|
|
58
|
+
const WorkspacePackage = WorkspacePackage$1;
|
|
58
59
|
/** Create a Tegami project handle. */
|
|
59
60
|
function tegami(options = {}) {
|
|
60
61
|
let $context;
|
|
@@ -1,18 +1,178 @@
|
|
|
1
1
|
import { a as isNodeError, c as joinPath, n as execFailure, r as fetchFailure } from "./error-CAsrGb6e.js";
|
|
2
|
-
import { t as _accessExpressionAsString } from "./_accessExpressionAsString-
|
|
3
|
-
import { n as _validateReport, t as _createStandardSchema } from "./_createStandardSchema-
|
|
4
|
-
import { r as runPreflights, s as parsePublishLock, t as initPublishPlan } from "./publish-
|
|
5
|
-
import { t as _assertGuard } from "./_assertGuard-
|
|
6
|
-
import { n as WorkspacePackage } from "./graph-
|
|
2
|
+
import { t as _accessExpressionAsString } from "./_accessExpressionAsString-DW_6Xqcp.js";
|
|
3
|
+
import { n as _validateReport, t as _createStandardSchema } from "./_createStandardSchema-CrRqJgaE.js";
|
|
4
|
+
import { r as runPreflights, s as parsePublishLock, t as initPublishPlan } from "./publish-BEYIILK5.js";
|
|
5
|
+
import { t as _assertGuard } from "./_assertGuard-CFFC1Up9.js";
|
|
6
|
+
import { n as WorkspacePackage } from "./graph-DaJ28Y4f.js";
|
|
7
7
|
import fs, { readFile, writeFile } from "node:fs/promises";
|
|
8
8
|
import path, { join } from "node:path";
|
|
9
9
|
import { x } from "tinyexec";
|
|
10
10
|
import * as semver$1 from "semver";
|
|
11
|
-
import { parseDocument } from "yaml";
|
|
12
|
-
import
|
|
11
|
+
import { isSeq, parseDocument } from "yaml";
|
|
12
|
+
import process from "node:process";
|
|
13
13
|
import { tmpdir } from "node:os";
|
|
14
14
|
import { intro, note, outro } from "@clack/prompts";
|
|
15
15
|
import { glob } from "tinyglobby";
|
|
16
|
+
//#region ../../node_modules/.pnpm/package-manager-detector@1.7.0/node_modules/package-manager-detector/dist/constants.mjs
|
|
17
|
+
const AGENTS = [
|
|
18
|
+
"npm",
|
|
19
|
+
"yarn",
|
|
20
|
+
"yarn@berry",
|
|
21
|
+
"pnpm",
|
|
22
|
+
"pnpm@6",
|
|
23
|
+
"bun",
|
|
24
|
+
"deno",
|
|
25
|
+
"nub",
|
|
26
|
+
"aube"
|
|
27
|
+
];
|
|
28
|
+
const LOCKS = {
|
|
29
|
+
"aube-lock.yaml": "aube",
|
|
30
|
+
"aube-workspace.yaml": "aube",
|
|
31
|
+
"bun.lock": "bun",
|
|
32
|
+
"bun.lockb": "bun",
|
|
33
|
+
"deno.lock": "deno",
|
|
34
|
+
"pnpm-lock.yaml": "pnpm",
|
|
35
|
+
"pnpm-workspace.yaml": "pnpm",
|
|
36
|
+
"yarn.lock": "yarn",
|
|
37
|
+
"package-lock.json": "npm",
|
|
38
|
+
"npm-shrinkwrap.json": "npm"
|
|
39
|
+
};
|
|
40
|
+
const INSTALL_METADATA = {
|
|
41
|
+
"node_modules/.aube/": "aube",
|
|
42
|
+
"node_modules/.deno/": "deno",
|
|
43
|
+
"node_modules/.pnpm/": "pnpm",
|
|
44
|
+
"node_modules/.yarn-state.yml": "yarn",
|
|
45
|
+
"node_modules/.yarn_integrity": "yarn",
|
|
46
|
+
"node_modules/.package-lock.json": "npm",
|
|
47
|
+
".pnp.cjs": "yarn",
|
|
48
|
+
".pnp.js": "yarn",
|
|
49
|
+
"bun.lock": "bun",
|
|
50
|
+
"bun.lockb": "bun"
|
|
51
|
+
};
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region ../../node_modules/.pnpm/package-manager-detector@1.7.0/node_modules/package-manager-detector/dist/detect.mjs
|
|
54
|
+
async function pathExists(path2, type) {
|
|
55
|
+
try {
|
|
56
|
+
const stat = await fs.stat(path2);
|
|
57
|
+
return type === "file" ? stat.isFile() : stat.isDirectory();
|
|
58
|
+
} catch {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function* lookup(cwd = process.cwd()) {
|
|
63
|
+
let directory = path.resolve(cwd);
|
|
64
|
+
const { root } = path.parse(directory);
|
|
65
|
+
while (directory && directory !== root) {
|
|
66
|
+
yield directory;
|
|
67
|
+
directory = path.dirname(directory);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async function parsePackageJson(filepath, options) {
|
|
71
|
+
if (!filepath || !await pathExists(filepath, "file")) return null;
|
|
72
|
+
return await handlePackageManager(filepath, options);
|
|
73
|
+
}
|
|
74
|
+
async function detect(options = {}) {
|
|
75
|
+
const { cwd, strategies = [
|
|
76
|
+
"lockfile",
|
|
77
|
+
"packageManager-field",
|
|
78
|
+
"devEngines-field"
|
|
79
|
+
] } = options;
|
|
80
|
+
let stopDir;
|
|
81
|
+
if (typeof options.stopDir === "string") {
|
|
82
|
+
const resolved = path.resolve(options.stopDir);
|
|
83
|
+
stopDir = (dir) => dir === resolved;
|
|
84
|
+
} else stopDir = options.stopDir;
|
|
85
|
+
for (const directory of lookup(cwd)) {
|
|
86
|
+
for (const strategy of strategies) switch (strategy) {
|
|
87
|
+
case "lockfile":
|
|
88
|
+
for (const lock of Object.keys(LOCKS)) if (await pathExists(path.join(directory, lock), "file")) {
|
|
89
|
+
const name = LOCKS[lock];
|
|
90
|
+
const result = await parsePackageJson(path.join(directory, "package.json"), options);
|
|
91
|
+
if (result) return result;
|
|
92
|
+
else return {
|
|
93
|
+
name,
|
|
94
|
+
agent: name
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
break;
|
|
98
|
+
case "packageManager-field":
|
|
99
|
+
case "devEngines-field": {
|
|
100
|
+
const result = await parsePackageJson(path.join(directory, "package.json"), options);
|
|
101
|
+
if (result) return result;
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
case "install-metadata":
|
|
105
|
+
for (const metadata of Object.keys(INSTALL_METADATA)) {
|
|
106
|
+
const fileOrDir = metadata.endsWith("/") ? "dir" : "file";
|
|
107
|
+
if (await pathExists(path.join(directory, metadata), fileOrDir)) {
|
|
108
|
+
const name = INSTALL_METADATA[metadata];
|
|
109
|
+
return {
|
|
110
|
+
name,
|
|
111
|
+
agent: name === "yarn" ? isMetadataYarnClassic(metadata) ? "yarn" : "yarn@berry" : name
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
if (stopDir?.(directory)) break;
|
|
118
|
+
}
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
function getNameAndVer(pkg) {
|
|
122
|
+
const handelVer = (version) => version?.match(/\d+(\.\d+){0,2}/)?.[0] ?? version;
|
|
123
|
+
if (typeof pkg.packageManager === "string") {
|
|
124
|
+
const [name, ver] = pkg.packageManager.replace(/^\^/, "").split("@");
|
|
125
|
+
return {
|
|
126
|
+
name,
|
|
127
|
+
ver: handelVer(ver)
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
if (typeof pkg.devEngines?.packageManager?.name === "string") return {
|
|
131
|
+
name: pkg.devEngines.packageManager.name,
|
|
132
|
+
ver: handelVer(pkg.devEngines.packageManager.version)
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
async function handlePackageManager(filepath, options) {
|
|
136
|
+
try {
|
|
137
|
+
const content = await fs.readFile(filepath, "utf8");
|
|
138
|
+
const pkg = options.packageJsonParser ? await options.packageJsonParser(content, filepath) : JSON.parse(content);
|
|
139
|
+
let agent;
|
|
140
|
+
const nameAndVer = getNameAndVer(pkg);
|
|
141
|
+
if (nameAndVer) {
|
|
142
|
+
const name = nameAndVer.name;
|
|
143
|
+
const ver = nameAndVer.ver;
|
|
144
|
+
let version = ver;
|
|
145
|
+
if (name === "yarn" && ver && Number.parseInt(ver) > 1) {
|
|
146
|
+
agent = "yarn@berry";
|
|
147
|
+
version = "berry";
|
|
148
|
+
return {
|
|
149
|
+
name,
|
|
150
|
+
agent,
|
|
151
|
+
version
|
|
152
|
+
};
|
|
153
|
+
} else if (name === "pnpm" && ver && Number.parseInt(ver) < 7) {
|
|
154
|
+
agent = "pnpm@6";
|
|
155
|
+
return {
|
|
156
|
+
name,
|
|
157
|
+
agent,
|
|
158
|
+
version
|
|
159
|
+
};
|
|
160
|
+
} else if (AGENTS.includes(name)) {
|
|
161
|
+
agent = name;
|
|
162
|
+
return {
|
|
163
|
+
name,
|
|
164
|
+
agent,
|
|
165
|
+
version
|
|
166
|
+
};
|
|
167
|
+
} else return options.onUnknown?.(pkg.packageManager) ?? null;
|
|
168
|
+
}
|
|
169
|
+
} catch {}
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
function isMetadataYarnClassic(metadataPath) {
|
|
173
|
+
return metadataPath.endsWith(".yarn_integrity");
|
|
174
|
+
}
|
|
175
|
+
//#endregion
|
|
16
176
|
//#region src/providers/npm/cli.ts
|
|
17
177
|
const PLACEHOLDER_VERSION = "0.0.0-tegami-trusted-publish-setup";
|
|
18
178
|
const PLACEHOLDER_DIST_TAG = "temp";
|
|
@@ -188,99 +348,6 @@ var NpmPackage = class extends WorkspacePackage {
|
|
|
188
348
|
return this.dependencies ??= listDependencies(graph, this);
|
|
189
349
|
}
|
|
190
350
|
};
|
|
191
|
-
const assertPnpmWorkspace = (() => {
|
|
192
|
-
const _io0 = (input) => (void 0 === input.packages || Array.isArray(input.packages) && input.packages.every((elem) => "string" === typeof elem)) && (void 0 === input.catalog || "object" === typeof input.catalog && null !== input.catalog && false === Array.isArray(input.catalog) && _io1(input.catalog)) && (void 0 === input.catalogs || "object" === typeof input.catalogs && null !== input.catalogs && false === Array.isArray(input.catalogs) && _io2(input.catalogs));
|
|
193
|
-
const _io1 = (input) => Object.keys(input).every((key) => {
|
|
194
|
-
const value = input[key];
|
|
195
|
-
if (void 0 === value) return true;
|
|
196
|
-
return "string" === typeof value;
|
|
197
|
-
});
|
|
198
|
-
const _io2 = (input) => Object.keys(input).every((key) => {
|
|
199
|
-
const value = input[key];
|
|
200
|
-
if (void 0 === value) return true;
|
|
201
|
-
return "object" === typeof value && null !== value && false === Array.isArray(value) && _io1(value);
|
|
202
|
-
});
|
|
203
|
-
const _ao0 = (input, _path, _exceptionable = true) => (void 0 === input.packages || (Array.isArray(input.packages) || _assertGuard(_exceptionable, {
|
|
204
|
-
method: "typia.createAssert",
|
|
205
|
-
path: _path + ".packages",
|
|
206
|
-
expected: "(Array<string> | undefined)",
|
|
207
|
-
value: input.packages
|
|
208
|
-
}, _errorFactory)) && input.packages.every((elem, _index2) => "string" === typeof elem || _assertGuard(_exceptionable, {
|
|
209
|
-
method: "typia.createAssert",
|
|
210
|
-
path: _path + ".packages[" + _index2 + "]",
|
|
211
|
-
expected: "string",
|
|
212
|
-
value: elem
|
|
213
|
-
}, _errorFactory)) || _assertGuard(_exceptionable, {
|
|
214
|
-
method: "typia.createAssert",
|
|
215
|
-
path: _path + ".packages",
|
|
216
|
-
expected: "(Array<string> | undefined)",
|
|
217
|
-
value: input.packages
|
|
218
|
-
}, _errorFactory)) && (void 0 === input.catalog || ("object" === typeof input.catalog && null !== input.catalog && false === Array.isArray(input.catalog) || _assertGuard(_exceptionable, {
|
|
219
|
-
method: "typia.createAssert",
|
|
220
|
-
path: _path + ".catalog",
|
|
221
|
-
expected: "(Record<string, string> | undefined)",
|
|
222
|
-
value: input.catalog
|
|
223
|
-
}, _errorFactory)) && _ao1(input.catalog, _path + ".catalog", _exceptionable) || _assertGuard(_exceptionable, {
|
|
224
|
-
method: "typia.createAssert",
|
|
225
|
-
path: _path + ".catalog",
|
|
226
|
-
expected: "(Record<string, string> | undefined)",
|
|
227
|
-
value: input.catalog
|
|
228
|
-
}, _errorFactory)) && (void 0 === input.catalogs || ("object" === typeof input.catalogs && null !== input.catalogs && false === Array.isArray(input.catalogs) || _assertGuard(_exceptionable, {
|
|
229
|
-
method: "typia.createAssert",
|
|
230
|
-
path: _path + ".catalogs",
|
|
231
|
-
expected: "(Record<string, Record<string, string>> | undefined)",
|
|
232
|
-
value: input.catalogs
|
|
233
|
-
}, _errorFactory)) && _ao2(input.catalogs, _path + ".catalogs", _exceptionable) || _assertGuard(_exceptionable, {
|
|
234
|
-
method: "typia.createAssert",
|
|
235
|
-
path: _path + ".catalogs",
|
|
236
|
-
expected: "(Record<string, Record<string, string>> | undefined)",
|
|
237
|
-
value: input.catalogs
|
|
238
|
-
}, _errorFactory));
|
|
239
|
-
const _ao1 = (input, _path, _exceptionable = true) => false === _exceptionable || Object.keys(input).every((key) => {
|
|
240
|
-
const value = input[key];
|
|
241
|
-
if (void 0 === value) return true;
|
|
242
|
-
return "string" === typeof value || _assertGuard(_exceptionable, {
|
|
243
|
-
method: "typia.createAssert",
|
|
244
|
-
path: _path + _accessExpressionAsString(key),
|
|
245
|
-
expected: "string",
|
|
246
|
-
value
|
|
247
|
-
}, _errorFactory);
|
|
248
|
-
});
|
|
249
|
-
const _ao2 = (input, _path, _exceptionable = true) => false === _exceptionable || Object.keys(input).every((key) => {
|
|
250
|
-
const value = input[key];
|
|
251
|
-
if (void 0 === value) return true;
|
|
252
|
-
return ("object" === typeof value && null !== value && false === Array.isArray(value) || _assertGuard(_exceptionable, {
|
|
253
|
-
method: "typia.createAssert",
|
|
254
|
-
path: _path + _accessExpressionAsString(key),
|
|
255
|
-
expected: "Record<string, string>",
|
|
256
|
-
value
|
|
257
|
-
}, _errorFactory)) && _ao1(value, _path + _accessExpressionAsString(key), _exceptionable) || _assertGuard(_exceptionable, {
|
|
258
|
-
method: "typia.createAssert",
|
|
259
|
-
path: _path + _accessExpressionAsString(key),
|
|
260
|
-
expected: "Record<string, string>",
|
|
261
|
-
value
|
|
262
|
-
}, _errorFactory);
|
|
263
|
-
});
|
|
264
|
-
const __is = (input) => "object" === typeof input && null !== input && false === Array.isArray(input) && _io0(input);
|
|
265
|
-
let _errorFactory;
|
|
266
|
-
return (input, errorFactory) => {
|
|
267
|
-
if (false === __is(input)) {
|
|
268
|
-
_errorFactory = errorFactory;
|
|
269
|
-
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input && false === Array.isArray(input) || _assertGuard(true, {
|
|
270
|
-
method: "typia.createAssert",
|
|
271
|
-
path: _path + "",
|
|
272
|
-
expected: "PnpmWorkspace",
|
|
273
|
-
value: input
|
|
274
|
-
}, _errorFactory)) && _ao0(input, _path + "", true) || _assertGuard(true, {
|
|
275
|
-
method: "typia.createAssert",
|
|
276
|
-
path: _path + "",
|
|
277
|
-
expected: "PnpmWorkspace",
|
|
278
|
-
value: input
|
|
279
|
-
}, _errorFactory))(input, "$input", true);
|
|
280
|
-
}
|
|
281
|
-
return input;
|
|
282
|
-
};
|
|
283
|
-
})();
|
|
284
351
|
const assertPackageManifest = (() => {
|
|
285
352
|
const _io0 = (input) => "string" === typeof input.name && (void 0 === input.version || "string" === typeof input.version) && (void 0 === input["private"] || "boolean" === typeof input["private"]) && (void 0 === input.publishConfig || "object" === typeof input.publishConfig && null !== input.publishConfig && false === Array.isArray(input.publishConfig) && _io1(input.publishConfig)) && (void 0 === input.scripts || "object" === typeof input.scripts && null !== input.scripts && false === Array.isArray(input.scripts) && _io2(input.scripts)) && null !== input.workspaces && (void 0 === input.workspaces || Array.isArray(input.workspaces) && input.workspaces.every((elem) => "string" === typeof elem) || "object" === typeof input.workspaces && null !== input.workspaces && false === Array.isArray(input.workspaces) && _io3(input.workspaces)) && (void 0 === input.catalog || "object" === typeof input.catalog && null !== input.catalog && false === Array.isArray(input.catalog) && _io2(input.catalog)) && (void 0 === input.catalogs || "object" === typeof input.catalogs && null !== input.catalogs && false === Array.isArray(input.catalogs) && _io4(input.catalogs)) && (void 0 === input.dependencies || "object" === typeof input.dependencies && null !== input.dependencies && false === Array.isArray(input.dependencies) && _io2(input.dependencies)) && (void 0 === input.devDependencies || "object" === typeof input.devDependencies && null !== input.devDependencies && false === Array.isArray(input.devDependencies) && _io2(input.devDependencies)) && (void 0 === input.peerDependencies || "object" === typeof input.peerDependencies && null !== input.peerDependencies && false === Array.isArray(input.peerDependencies) && _io2(input.peerDependencies)) && (void 0 === input.optionalDependencies || "object" === typeof input.optionalDependencies && null !== input.optionalDependencies && false === Array.isArray(input.optionalDependencies) && _io2(input.optionalDependencies));
|
|
286
353
|
const _io1 = (input) => (void 0 === input.access || "public" === input.access || "restricted" === input.access) && (void 0 === input.registry || "string" === typeof input.registry) && (void 0 === input.tag || "string" === typeof input.tag);
|
|
@@ -613,22 +680,36 @@ async function resolveNpmGraph(cwd, client) {
|
|
|
613
680
|
if (Array.isArray(rootManifest.workspaces)) patterns.push(...rootManifest.workspaces);
|
|
614
681
|
else if (rootManifest.workspaces?.packages) patterns.push(...rootManifest.workspaces.packages);
|
|
615
682
|
}
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
683
|
+
let workspaceFiles;
|
|
684
|
+
switch (client) {
|
|
685
|
+
case "pnpm":
|
|
686
|
+
workspaceFiles = ["pnpm-workspace.yaml"];
|
|
687
|
+
break;
|
|
688
|
+
case "nub":
|
|
689
|
+
workspaceFiles = ["pnpm-workspace.yaml"];
|
|
690
|
+
break;
|
|
691
|
+
case "aube":
|
|
692
|
+
workspaceFiles = ["pnpm-workspace.yaml", "aube-workspace.yaml"];
|
|
693
|
+
break;
|
|
694
|
+
case "yarn":
|
|
695
|
+
const yarnCatalog = await readYarnCatalog(cwd);
|
|
696
|
+
if (yarnCatalog) catalogSources.push(yarnCatalog);
|
|
697
|
+
break;
|
|
698
|
+
}
|
|
699
|
+
if (workspaceFiles) await Promise.all(workspaceFiles.map(async (name) => {
|
|
700
|
+
const filePath = path.join(cwd, name);
|
|
701
|
+
const content = await readFile(filePath, "utf8").catch((error) => {
|
|
619
702
|
if (isNodeError(error) && error.code === "ENOENT") return void 0;
|
|
620
703
|
throw error;
|
|
621
704
|
});
|
|
622
|
-
if (content)
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
705
|
+
if (!content) return;
|
|
706
|
+
const doc = parseDocument(content);
|
|
707
|
+
const packages = doc.get("packages");
|
|
708
|
+
catalogSources.push(createWorkspaceCatalogSource(filePath, doc));
|
|
709
|
+
if (isSeq(packages)) {
|
|
710
|
+
for (const pkg of packages.toJSON()) if (typeof pkg === "string") patterns.push(pkg);
|
|
627
711
|
}
|
|
628
|
-
}
|
|
629
|
-
const yarnCatalog = await readYarnCatalog(cwd);
|
|
630
|
-
if (yarnCatalog) catalogSources.push(yarnCatalog);
|
|
631
|
-
}
|
|
712
|
+
}));
|
|
632
713
|
if (patterns?.length) {
|
|
633
714
|
const candidatePaths = await expandWorkspacePatterns(cwd, patterns);
|
|
634
715
|
await Promise.all(candidatePaths.map(async (packagePath) => {
|
|
@@ -714,7 +795,7 @@ async function readManifest(packagePath) {
|
|
|
714
795
|
assertPackageManifest(parsed);
|
|
715
796
|
return parsed;
|
|
716
797
|
}
|
|
717
|
-
function
|
|
798
|
+
function createWorkspaceCatalogSource(filePath, doc) {
|
|
718
799
|
return {
|
|
719
800
|
resolve(name, catalogName) {
|
|
720
801
|
const value = doc.getIn(catalogName === "default" ? ["catalog", name] : [
|
|
@@ -886,7 +967,6 @@ function npm({ client: defaultClient, onBreakPeerDep = "set", updateLockFile = t
|
|
|
886
967
|
return "major";
|
|
887
968
|
}
|
|
888
969
|
} } = {}) {
|
|
889
|
-
let active = false;
|
|
890
970
|
return {
|
|
891
971
|
name: "npm",
|
|
892
972
|
enforce: "pre",
|
|
@@ -909,7 +989,6 @@ function npm({ client: defaultClient, onBreakPeerDep = "set", updateLockFile = t
|
|
|
909
989
|
if (graph.packages.size === 0) return;
|
|
910
990
|
this.npm.graph = graph;
|
|
911
991
|
for (const pkg of graph.packages.values()) this.graph.add(pkg);
|
|
912
|
-
active = true;
|
|
913
992
|
},
|
|
914
993
|
async publishPreflight({ pkg }) {
|
|
915
994
|
if (!(pkg instanceof NpmPackage) || !this.npm?.graph) return;
|
|
@@ -921,7 +1000,7 @@ function npm({ client: defaultClient, onBreakPeerDep = "set", updateLockFile = t
|
|
|
921
1000
|
};
|
|
922
1001
|
},
|
|
923
1002
|
resolvePlanStatus({ plan }) {
|
|
924
|
-
if (!
|
|
1003
|
+
if (!this.npm?.graph) return;
|
|
925
1004
|
return Array.from(plan.packages, async ([id, { preflight }]) => {
|
|
926
1005
|
if (!preflight.shouldPublish) return;
|
|
927
1006
|
const pkg = this.graph.get(id);
|
|
@@ -979,11 +1058,11 @@ function npm({ client: defaultClient, onBreakPeerDep = "set", updateLockFile = t
|
|
|
979
1058
|
return result;
|
|
980
1059
|
},
|
|
981
1060
|
initDraft(plan) {
|
|
982
|
-
if (!
|
|
1061
|
+
if (!this.npm?.graph) return;
|
|
983
1062
|
plan.addPolicy(depsPolicy(this, getBumpDepType));
|
|
984
1063
|
},
|
|
985
1064
|
async applyDraft(draft) {
|
|
986
|
-
if (!
|
|
1065
|
+
if (!this.npm?.graph) return;
|
|
987
1066
|
const npmGraph = this.npm.graph;
|
|
988
1067
|
const writes = [];
|
|
989
1068
|
for (const pkg of npmGraph.packages.values()) {
|
|
@@ -1010,11 +1089,13 @@ function npm({ client: defaultClient, onBreakPeerDep = "set", updateLockFile = t
|
|
|
1010
1089
|
await Promise.all(writes);
|
|
1011
1090
|
},
|
|
1012
1091
|
async applyCliDraft() {
|
|
1013
|
-
if (!this.npm || !
|
|
1092
|
+
if (!this.npm?.graph || !updateLockFile) return;
|
|
1014
1093
|
let args;
|
|
1015
1094
|
switch (this.npm.agent) {
|
|
1016
1095
|
case "pnpm":
|
|
1017
1096
|
case "pnpm@6":
|
|
1097
|
+
case "aube":
|
|
1098
|
+
case "nub":
|
|
1018
1099
|
args = [
|
|
1019
1100
|
"install",
|
|
1020
1101
|
"--lockfile-only",
|
|
@@ -1137,11 +1218,20 @@ async function publish(client, pkg, distTag) {
|
|
|
1137
1218
|
let command;
|
|
1138
1219
|
const args = ["publish"];
|
|
1139
1220
|
if (distTag) args.push("--tag", distTag);
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1221
|
+
switch (client) {
|
|
1222
|
+
case "pnpm":
|
|
1223
|
+
command = "pnpm";
|
|
1224
|
+
args.push("--no-git-checks");
|
|
1225
|
+
break;
|
|
1226
|
+
case "aube":
|
|
1227
|
+
case "nub":
|
|
1228
|
+
case "yarn":
|
|
1229
|
+
command = client;
|
|
1230
|
+
break;
|
|
1231
|
+
default:
|
|
1232
|
+
command = "npm";
|
|
1233
|
+
break;
|
|
1234
|
+
}
|
|
1145
1235
|
const result = await x(command, args, { nodeOptions: { cwd: pkg.path } });
|
|
1146
1236
|
if (result.exitCode !== 0) return {
|
|
1147
1237
|
type: "failed",
|
package/dist/plugins/cargo.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { D as
|
|
1
|
+
import { D as CargoPluginOptions, E as CargoPackage, O as cargo, T as CargoGraph } from "../types-Kj7Nxbjz.js";
|
|
2
2
|
export { CargoGraph, CargoPackage, CargoPluginOptions, cargo };
|
package/dist/plugins/cargo.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as execFailure, r as fetchFailure } from "../error-CAsrGb6e.js";
|
|
2
|
-
import { t as _accessExpressionAsString } from "../_accessExpressionAsString-
|
|
3
|
-
import { t as _assertGuard } from "../_assertGuard-
|
|
4
|
-
import { n as WorkspacePackage } from "../graph-
|
|
2
|
+
import { t as _accessExpressionAsString } from "../_accessExpressionAsString-DW_6Xqcp.js";
|
|
3
|
+
import { t as _assertGuard } from "../_assertGuard-CFFC1Up9.js";
|
|
4
|
+
import { n as WorkspacePackage } from "../graph-DaJ28Y4f.js";
|
|
5
5
|
import { readFile, writeFile } from "node:fs/promises";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { x } from "tinyexec";
|
package/dist/plugins/git.d.ts
CHANGED
package/dist/plugins/github.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { j as WorkspacePackage, s as TegamiPlugin, t as Awaitable, x as TegamiContext, y as PublishPlan } from "../types-Kj7Nxbjz.js";
|
|
2
2
|
import { GitPluginOptions } from "./git.js";
|
|
3
|
-
import { t as VersionRequestOptions } from "../version-request-
|
|
3
|
+
import { t as VersionRequestOptions } from "../version-request-C5vtakPE.js";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/github.d.ts
|
|
6
6
|
interface GithubRelease {
|
package/dist/plugins/github.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as changelogFilename } from "../generate-
|
|
1
|
+
import { a as formatPackageVersion } from "../semver-DrtaCCZK.js";
|
|
2
|
+
import { t as changelogFilename } from "../generate-Cgl2G5ea.js";
|
|
3
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-
|
|
4
|
+
import { a as createDraft, l as readChangelogEntries } from "../publish-BEYIILK5.js";
|
|
5
5
|
import { git } from "./git.js";
|
|
6
|
-
import {
|
|
6
|
+
import { n as onVersionRequest, t as formatPreview } from "../version-request-C89RO85i.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";
|
|
10
10
|
import semver from "semver";
|
|
11
|
-
import { resolveCommand } from "package-manager-detector";
|
|
12
11
|
import { note, outro } from "@clack/prompts";
|
|
13
12
|
//#region src/plugins/github/api.ts
|
|
14
13
|
function parseGitHubRepo(repo) {
|
|
@@ -172,46 +171,10 @@ function registerPrCli(cli) {
|
|
|
172
171
|
}
|
|
173
172
|
async function buildPrPreview(context, draft, options = {}) {
|
|
174
173
|
const pullRequest = await resolvePullRequest(context, options);
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
const pendingPackages = [];
|
|
180
|
-
const lines = [
|
|
181
|
-
"### Tegami",
|
|
182
|
-
"",
|
|
183
|
-
`This repository uses [Tegami](https://tegami.fuma-nama.dev) to manage releases. When your changes affect published packages, add a changelog file under \`.tegami/\` before merging.`,
|
|
184
|
-
"",
|
|
185
|
-
`[**Create a changelog →**](${createLink}) · [Changelog format](https://tegami.fuma-nama.dev/changelog)`,
|
|
186
|
-
""
|
|
187
|
-
];
|
|
188
|
-
for (const pkg of context.graph.getPackages()) {
|
|
189
|
-
const plan = draft.getPackageDraft(pkg.id);
|
|
190
|
-
if (!plan) continue;
|
|
191
|
-
const bumped = plan.bumpVersion(pkg);
|
|
192
|
-
if (!bumped || !pkg.version || bumped === pkg.version) continue;
|
|
193
|
-
pendingPackages.push({
|
|
194
|
-
name: pkg.name,
|
|
195
|
-
type: plan.type ?? "—",
|
|
196
|
-
from: pkg.version,
|
|
197
|
-
to: bumped,
|
|
198
|
-
distTag: plan.npm?.distTag
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
const requestChangelogs = draft.getChangelogs().filter((entry) => changelogFiles.has(entry.filename));
|
|
202
|
-
if (pendingPackages.length > 0) {
|
|
203
|
-
lines.push("#### Release preview", "", "| Package | Bump | Version |", "| --- | --- | --- |");
|
|
204
|
-
for (const { name, type, from, to, distTag } of pendingPackages) lines.push(`| \`${name}\` | ${type} | \`${from}\` → \`${to}\`${formatNpmDistTag(distTag)} |`);
|
|
205
|
-
lines.push("");
|
|
206
|
-
}
|
|
207
|
-
if (requestChangelogs.length > 0) {
|
|
208
|
-
lines.push("#### Changelogs in this PR", "", "| Changelog | Title |", "| --- | --- |");
|
|
209
|
-
for (const entry of requestChangelogs) for (const section of entry.sections) lines.push(`| \`${entry.filename}\` | ${section.title} |`);
|
|
210
|
-
lines.push("");
|
|
211
|
-
} else if (pendingPackages.length === 0) lines.push("#### No changelogs yet", "", "This PR has no pending changelog files. If your changes require a release, add a changelog before merging.", "");
|
|
212
|
-
else if (changelogFiles.size === 0) lines.push("This PR does not add changelog files. Pending changelogs from other branches are included in the preview above.", "");
|
|
213
|
-
lines.push(`Run \`${tegamiCommand}\` locally to create a changelog interactively.`, "", `<sub>Managed by [Tegami](https://tegami.fuma-nama.dev).</sub>`, "");
|
|
214
|
-
return lines.join("\n");
|
|
174
|
+
return formatPreview(context, draft, await listPullRequestChangelogFiles(context, pullRequest.baseSha, pullRequest.headSha), {
|
|
175
|
+
"create-a-changelog-href": createChangelogUrl(context, pullRequest.headRepo, pullRequest.headRef, changelogFilename()),
|
|
176
|
+
pr: "PR"
|
|
177
|
+
});
|
|
215
178
|
}
|
|
216
179
|
async function postPrComment(context, body) {
|
|
217
180
|
const { repo, token } = context.github ?? {};
|
|
@@ -236,7 +199,6 @@ async function resolvePullRequest(context, options) {
|
|
|
236
199
|
const { repo, token } = context.github ?? {};
|
|
237
200
|
if (!repo) throw new Error("GitHub plugin context is required.");
|
|
238
201
|
if (options.number !== void 0) {
|
|
239
|
-
parsePositiveInt(String(options.number), "--number");
|
|
240
202
|
const data = await getPullRequest(repo, options.number, token);
|
|
241
203
|
return {
|
|
242
204
|
headRepo: data.headRepository ? `${data.headRepository.owner.login}/${data.headRepository.name}` : repo,
|
package/dist/plugins/gitlab.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { j as WorkspacePackage, s as TegamiPlugin, t as Awaitable, x as TegamiContext, y as PublishPlan } from "../types-Kj7Nxbjz.js";
|
|
2
2
|
import { GitPluginOptions } from "./git.js";
|
|
3
|
-
import { t as VersionRequestOptions } from "../version-request-
|
|
3
|
+
import { t as VersionRequestOptions } from "../version-request-C5vtakPE.js";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/gitlab.d.ts
|
|
6
6
|
interface GitlabRelease {
|
package/dist/plugins/gitlab.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as changelogFilename } from "../generate-
|
|
1
|
+
import { a as formatPackageVersion } from "../semver-DrtaCCZK.js";
|
|
2
|
+
import { t as changelogFilename } from "../generate-Cgl2G5ea.js";
|
|
3
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-
|
|
4
|
+
import { a as createDraft, l as readChangelogEntries } from "../publish-BEYIILK5.js";
|
|
5
5
|
import { git } from "./git.js";
|
|
6
|
-
import {
|
|
6
|
+
import { n as onVersionRequest, t as formatPreview } from "../version-request-C89RO85i.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";
|
|
10
|
-
import { resolveCommand } from "package-manager-detector";
|
|
11
10
|
import { note, outro } from "@clack/prompts";
|
|
12
11
|
//#region src/plugins/gitlab/api.ts
|
|
13
12
|
function parseGitLabRepo(repo) {
|
|
@@ -184,46 +183,10 @@ function registerMrCli(cli) {
|
|
|
184
183
|
}
|
|
185
184
|
async function buildMrPreview(context, draft, options = {}) {
|
|
186
185
|
const mergeRequest = await resolveMergeRequest(context, options);
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
const pendingPackages = [];
|
|
192
|
-
const lines = [
|
|
193
|
-
"### Tegami",
|
|
194
|
-
"",
|
|
195
|
-
`This repository uses [Tegami](https://tegami.fuma-nama.dev) to manage releases. When your changes affect published packages, add a changelog file under \`.tegami/\` before merging.`,
|
|
196
|
-
"",
|
|
197
|
-
`[**Create a changelog →**](${createLink}) · [Changelog format](https://tegami.fuma-nama.dev/changelog)`,
|
|
198
|
-
""
|
|
199
|
-
];
|
|
200
|
-
for (const pkg of context.graph.getPackages()) {
|
|
201
|
-
const plan = draft.getPackageDraft(pkg.id);
|
|
202
|
-
if (!plan) continue;
|
|
203
|
-
const bumped = plan.bumpVersion(pkg);
|
|
204
|
-
if (!bumped || !pkg.version || bumped === pkg.version) continue;
|
|
205
|
-
pendingPackages.push({
|
|
206
|
-
name: pkg.name,
|
|
207
|
-
type: plan.type ?? "—",
|
|
208
|
-
from: pkg.version,
|
|
209
|
-
to: bumped,
|
|
210
|
-
distTag: plan.npm?.distTag
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
const requestChangelogs = draft.getChangelogs().filter((entry) => changelogFiles.has(entry.filename));
|
|
214
|
-
if (pendingPackages.length > 0) {
|
|
215
|
-
lines.push("#### Release preview", "", "| Package | Bump | Version |", "| --- | --- | --- |");
|
|
216
|
-
for (const { name, type, from, to, distTag } of pendingPackages) lines.push(`| \`${name}\` | ${type} | \`${from}\` → \`${to}\`${formatNpmDistTag(distTag)} |`);
|
|
217
|
-
lines.push("");
|
|
218
|
-
}
|
|
219
|
-
if (requestChangelogs.length > 0) {
|
|
220
|
-
lines.push("#### Changelogs in this MR", "", "| Changelog | Title |", "| --- | --- |");
|
|
221
|
-
for (const entry of requestChangelogs) for (const section of entry.sections) lines.push(`| \`${entry.filename}\` | ${section.title} |`);
|
|
222
|
-
lines.push("");
|
|
223
|
-
} else if (pendingPackages.length === 0) lines.push("#### No changelogs yet", "", "This MR has no pending changelog files. If your changes require a release, add a changelog before merging.", "");
|
|
224
|
-
else if (changelogFiles.size === 0) lines.push("This MR does not add changelog files. Pending changelogs from other branches are included in the preview above.", "");
|
|
225
|
-
lines.push(`Run \`${tegamiCommand}\` locally to create a changelog interactively.`, "", `<sub>Managed by [Tegami](https://tegami.fuma-nama.dev).</sub>`, "");
|
|
226
|
-
return lines.join("\n");
|
|
186
|
+
return formatPreview(context, draft, await listMergeRequestChangelogFiles(context, mergeRequest.baseSha, mergeRequest.headSha), {
|
|
187
|
+
"create-a-changelog-href": createChangelogUrl(context, mergeRequest.headRepo, mergeRequest.headRef, changelogFilename()),
|
|
188
|
+
pr: "MR"
|
|
189
|
+
});
|
|
227
190
|
}
|
|
228
191
|
async function postMrComment(context, body, options = {}) {
|
|
229
192
|
const { repo, apiUrl, token } = context.gitlab;
|
package/dist/plugins/go.d.ts
CHANGED
package/dist/plugins/go.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as isNodeError, n as execFailure, r as fetchFailure } from "../error-CAsrGb6e.js";
|
|
2
|
-
import { n as _validateReport, t as _createStandardSchema } from "../_createStandardSchema-
|
|
3
|
-
import { n as WorkspacePackage } from "../graph-
|
|
2
|
+
import { n as _validateReport, t as _createStandardSchema } from "../_createStandardSchema-CrRqJgaE.js";
|
|
3
|
+
import { n as WorkspacePackage } from "../graph-DaJ28Y4f.js";
|
|
4
4
|
import { relative, resolve } from "node:path";
|
|
5
5
|
import { x } from "tinyexec";
|
|
6
6
|
import * as semver$1 from "semver";
|
package/dist/providers/npm.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { C as NpmGraph, S as DependencySpec, l as NpmPluginOptions, u as npm, w as NpmPackage } from "../types-Kj7Nxbjz.js";
|
|
2
2
|
export { type DependencySpec, type NpmGraph, NpmPackage, NpmPluginOptions, npm };
|
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-uJA8deYA.js";
|
|
2
2
|
export { NpmPackage, npm };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as maxBump } from "./semver-DrtaCCZK.js";
|
|
2
2
|
import { i as handlePluginError, l as somePromise } from "./error-CAsrGb6e.js";
|
|
3
|
-
import { t as _accessExpressionAsString } from "./_accessExpressionAsString-
|
|
4
|
-
import { n as _validateReport, t as _createStandardSchema } from "./_createStandardSchema-
|
|
5
|
-
import { n as validateChangelogFrontmatter, t as
|
|
3
|
+
import { t as _accessExpressionAsString } from "./_accessExpressionAsString-DW_6Xqcp.js";
|
|
4
|
+
import { n as _validateReport, t as _createStandardSchema } from "./_createStandardSchema-CrRqJgaE.js";
|
|
5
|
+
import { n as renderChangelog, r as validateChangelogFrontmatter, t as getPackageBumps } from "./shared-pTOZU5UZ.js";
|
|
6
6
|
import { simpleGenerator } from "./generators/simple.js";
|
|
7
|
-
import { t as _assertGuard } from "./_assertGuard-
|
|
7
|
+
import { t as _assertGuard } from "./_assertGuard-CFFC1Up9.js";
|
|
8
8
|
import fs, { mkdir, readFile, readdir, rm, writeFile } from "node:fs/promises";
|
|
9
9
|
import path, { basename, dirname, join } from "node:path";
|
|
10
10
|
import * as semver$1 from "semver";
|
|
@@ -450,13 +450,7 @@ var Draft = class {
|
|
|
450
450
|
}
|
|
451
451
|
addChangelog(entry) {
|
|
452
452
|
this.changelogs.set(entry.id, entry);
|
|
453
|
-
const
|
|
454
|
-
const groupPackages = /* @__PURE__ */ new Map();
|
|
455
|
-
for (const [name, config] of entry.packages) {
|
|
456
|
-
if (!config.type) continue;
|
|
457
|
-
for (const pkg of graph.getByName(name)) groupPackages.set(pkg, config.type);
|
|
458
|
-
}
|
|
459
|
-
for (const [pkg, bumpType] of groupPackages) attachChangelog(this.bumpPackage(pkg, { type: bumpType }), entry);
|
|
453
|
+
for (const [pkg, bumpType] of getPackageBumps(this.context.graph, entry)) attachChangelog(this.bumpPackage(pkg, { type: bumpType }), entry);
|
|
460
454
|
}
|
|
461
455
|
deleteChangelog(id) {
|
|
462
456
|
return this.changelogs.delete(id);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { inc, parse } from "semver";
|
|
1
|
+
import { diff, inc, parse } from "semver";
|
|
2
2
|
//#region src/utils/semver.ts
|
|
3
3
|
function formatNpmDistTag(distTag) {
|
|
4
4
|
return distTag && distTag !== "latest" ? ` (${distTag})` : "";
|
|
@@ -11,8 +11,11 @@ function formatPackageVersion(name, version, distTag) {
|
|
|
11
11
|
}
|
|
12
12
|
const WEIGHTS = {
|
|
13
13
|
major: 3,
|
|
14
|
+
premajor: 3,
|
|
14
15
|
minor: 2,
|
|
15
|
-
|
|
16
|
+
preminor: 2,
|
|
17
|
+
patch: 1,
|
|
18
|
+
prepatch: 1
|
|
16
19
|
};
|
|
17
20
|
const DEPTH = {
|
|
18
21
|
major: 1,
|
|
@@ -24,6 +27,15 @@ const PRE = {
|
|
|
24
27
|
minor: "preminor",
|
|
25
28
|
patch: "prepatch"
|
|
26
29
|
};
|
|
30
|
+
function diffWeight(from, to) {
|
|
31
|
+
const d = diff(from, to);
|
|
32
|
+
if (!d) return 0;
|
|
33
|
+
switch (d) {
|
|
34
|
+
case "release":
|
|
35
|
+
case "prerelease": return 4;
|
|
36
|
+
default: return WEIGHTS[d];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
27
39
|
function maxBump(a, b) {
|
|
28
40
|
if (WEIGHTS[a] > WEIGHTS[b]) return a;
|
|
29
41
|
return b;
|
|
@@ -45,4 +57,4 @@ function bumpVersion(version, type, prerelease) {
|
|
|
45
57
|
return next;
|
|
46
58
|
}
|
|
47
59
|
//#endregion
|
|
48
|
-
export {
|
|
60
|
+
export { formatPackageVersion as a, formatNpmDistTag as i, bumpVersion as n, maxBump as o, diffWeight as r, bumpDepth as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as _accessExpressionAsString } from "./_accessExpressionAsString-
|
|
2
|
-
import { n as _validateReport, t as _createStandardSchema } from "./_createStandardSchema-
|
|
1
|
+
import { t as _accessExpressionAsString } from "./_accessExpressionAsString-DW_6Xqcp.js";
|
|
2
|
+
import { n as _validateReport, t as _createStandardSchema } from "./_createStandardSchema-CrRqJgaE.js";
|
|
3
3
|
import { stringify } from "yaml";
|
|
4
4
|
//#region src/changelog/shared.ts
|
|
5
5
|
const validateChangelogFrontmatter = (() => {
|
|
@@ -111,5 +111,13 @@ function renderChangelog(frontmatter, body) {
|
|
|
111
111
|
""
|
|
112
112
|
].join("\n");
|
|
113
113
|
}
|
|
114
|
+
function getPackageBumps(graph, entry) {
|
|
115
|
+
const packageBumps = /* @__PURE__ */ new Map();
|
|
116
|
+
for (const [name, config] of entry.packages) {
|
|
117
|
+
if (!config.type) continue;
|
|
118
|
+
for (const pkg of graph.getByName(name)) packageBumps.set(pkg, config.type);
|
|
119
|
+
}
|
|
120
|
+
return packageBumps;
|
|
121
|
+
}
|
|
114
122
|
//#endregion
|
|
115
|
-
export {
|
|
123
|
+
export { renderChangelog as n, validateChangelogFrontmatter as r, getPackageBumps as t };
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { Agent, AgentName } from "package-manager-detector";
|
|
2
|
-
|
|
3
1
|
//#region src/utils/semver.d.ts
|
|
4
2
|
type BumpType = "major" | "minor" | "patch";
|
|
5
3
|
//#endregion
|
|
@@ -183,7 +181,7 @@ interface PackageDraft {
|
|
|
183
181
|
/** npm dist-tag used when publishing. */distTag?: string;
|
|
184
182
|
};
|
|
185
183
|
/** get the bumped version of a package, return `undefined` if the package doesn't have a `version` field */
|
|
186
|
-
bumpVersion: (pkg: WorkspacePackage) => string | undefined;
|
|
184
|
+
bumpVersion: (pkg: WorkspacePackage$1) => string | undefined;
|
|
187
185
|
}
|
|
188
186
|
/** a draft describes all operations to perform before the actual publishing, such as version bumps. */
|
|
189
187
|
declare class Draft {
|
|
@@ -197,15 +195,15 @@ declare class Draft {
|
|
|
197
195
|
constructor(context: TegamiContext);
|
|
198
196
|
getPackageDrafts(): Map<string, PackageDraft>;
|
|
199
197
|
getPackageDraft(id: string): PackageDraft | undefined;
|
|
200
|
-
bumpPackage(pkg: WorkspacePackage, {
|
|
198
|
+
bumpPackage(pkg: WorkspacePackage$1, {
|
|
201
199
|
type,
|
|
202
200
|
reason
|
|
203
201
|
}: {
|
|
204
202
|
type: BumpType;
|
|
205
203
|
reason?: string;
|
|
206
204
|
}): PackageDraft;
|
|
207
|
-
dispatchPackage(pkg: WorkspacePackage, dispatch: (draft: PackageDraft) => void, onUpdate?: (draft: PackageDraft) => void): PackageDraft;
|
|
208
|
-
getOrInitPackage(pkg: WorkspacePackage): PackageDraft;
|
|
205
|
+
dispatchPackage(pkg: WorkspacePackage$1, dispatch: (draft: PackageDraft) => void, onUpdate?: (draft: PackageDraft) => void): PackageDraft;
|
|
206
|
+
getOrInitPackage(pkg: WorkspacePackage$1): PackageDraft;
|
|
209
207
|
hasPending(): boolean;
|
|
210
208
|
/** get all changelogs, note that this includes replay-only changelogs, as long as they are in the `.tegami` folder. */
|
|
211
209
|
getChangelogs(): ChangelogEntry[];
|
|
@@ -229,13 +227,13 @@ interface DraftPolicy {
|
|
|
229
227
|
id: string;
|
|
230
228
|
onUpdate?: (this: Draft, opts: {
|
|
231
229
|
packageDraft: PackageDraft;
|
|
232
|
-
pkg: WorkspacePackage;
|
|
230
|
+
pkg: WorkspacePackage$1;
|
|
233
231
|
}) => void;
|
|
234
232
|
}
|
|
235
233
|
//#endregion
|
|
236
234
|
//#region src/graph.d.ts
|
|
237
235
|
/** Package discovered in the workspace. */
|
|
238
|
-
declare abstract class WorkspacePackage {
|
|
236
|
+
declare abstract class WorkspacePackage$1 {
|
|
239
237
|
abstract readonly name: string;
|
|
240
238
|
/** absolute path */
|
|
241
239
|
abstract readonly path: string;
|
|
@@ -258,7 +256,7 @@ declare abstract class WorkspacePackage {
|
|
|
258
256
|
interface PackageGroup {
|
|
259
257
|
name: string;
|
|
260
258
|
options: GroupOptions;
|
|
261
|
-
packages: WorkspacePackage[];
|
|
259
|
+
packages: WorkspacePackage$1[];
|
|
262
260
|
}
|
|
263
261
|
/**
|
|
264
262
|
* Unified graph for discovered workspace packages.
|
|
@@ -269,14 +267,14 @@ interface PackageGroup {
|
|
|
269
267
|
declare class PackageGraph {
|
|
270
268
|
private readonly packages;
|
|
271
269
|
private readonly groups;
|
|
272
|
-
constructor(packages?: WorkspacePackage[]);
|
|
273
|
-
getPackages(): WorkspacePackage[];
|
|
270
|
+
constructor(packages?: WorkspacePackage$1[]);
|
|
271
|
+
getPackages(): WorkspacePackage$1[];
|
|
274
272
|
/** Get a package by exact id. */
|
|
275
|
-
get(id: string): WorkspacePackage | undefined;
|
|
273
|
+
get(id: string): WorkspacePackage$1 | undefined;
|
|
276
274
|
/** Get packages by id, `group:name`, or every package matching a name. */
|
|
277
|
-
getByName(nameOrId: string): WorkspacePackage[];
|
|
275
|
+
getByName(nameOrId: string): WorkspacePackage$1[];
|
|
278
276
|
/** scan package into graph, if the package id already exists, replace the existing one in graph */
|
|
279
|
-
add(pkg: WorkspacePackage): void;
|
|
277
|
+
add(pkg: WorkspacePackage$1): void;
|
|
280
278
|
delete(id: string): void;
|
|
281
279
|
getPackageGroup(pkgId: string): PackageGroup | undefined;
|
|
282
280
|
getGroups(): PackageGroup[];
|
|
@@ -287,6 +285,10 @@ declare class PackageGraph {
|
|
|
287
285
|
unregisterGroup(name: string): void;
|
|
288
286
|
}
|
|
289
287
|
//#endregion
|
|
288
|
+
//#region ../../node_modules/.pnpm/package-manager-detector@1.7.0/node_modules/package-manager-detector/dist/shared/package-manager-detector.CqsrLAro.d.mts
|
|
289
|
+
type Agent = 'npm' | 'yarn' | 'yarn@berry' | 'pnpm' | 'pnpm@6' | 'bun' | 'deno' | 'nub' | 'aube';
|
|
290
|
+
type AgentName = 'npm' | 'yarn' | 'pnpm' | 'bun' | 'deno' | 'nub' | 'aube';
|
|
291
|
+
//#endregion
|
|
290
292
|
//#region src/plugins/gitlab/api.d.ts
|
|
291
293
|
interface GitLabToken {
|
|
292
294
|
value: string;
|
|
@@ -371,7 +373,7 @@ interface ResolvedDependency {
|
|
|
371
373
|
range?: string;
|
|
372
374
|
setRange?: (v: string) => void;
|
|
373
375
|
}
|
|
374
|
-
declare class CargoPackage extends WorkspacePackage {
|
|
376
|
+
declare class CargoPackage extends WorkspacePackage$1 {
|
|
375
377
|
readonly path: string;
|
|
376
378
|
/** a crate must have `package` field defined, otherwise it is merely a virutal workspace file, and Tegami should not include it. */
|
|
377
379
|
readonly file: CargoToml<RequireFields<CargoManifest, "package">>;
|
|
@@ -415,7 +417,7 @@ interface CargoGraph {
|
|
|
415
417
|
}
|
|
416
418
|
//#endregion
|
|
417
419
|
//#region src/providers/npm/graph.d.ts
|
|
418
|
-
declare class NpmPackage extends WorkspacePackage {
|
|
420
|
+
declare class NpmPackage extends WorkspacePackage$1 {
|
|
419
421
|
readonly path: string;
|
|
420
422
|
readonly manifest: PackageManifest;
|
|
421
423
|
readonly manager = "npm";
|
|
@@ -634,6 +636,7 @@ interface GenerateChangelogOptions extends GenerateFromCommitsOptions {
|
|
|
634
636
|
*/
|
|
635
637
|
write?: boolean;
|
|
636
638
|
}
|
|
639
|
+
declare const WorkspacePackage: typeof WorkspacePackage$1;
|
|
637
640
|
interface Tegami {
|
|
638
641
|
/** Create pending changelog files from git commit history. */
|
|
639
642
|
generateChangelog(options?: GenerateChangelogOptions): Promise<CommitChangelog[]>;
|
|
@@ -747,7 +750,7 @@ declare function npm({
|
|
|
747
750
|
/** Generates changelog content for a package release. */
|
|
748
751
|
interface LogGenerator {
|
|
749
752
|
generate(this: TegamiContext, opts: {
|
|
750
|
-
pkg: WorkspacePackage;
|
|
753
|
+
pkg: WorkspacePackage$1;
|
|
751
754
|
packageDraft: PackageDraft;
|
|
752
755
|
draft: Draft;
|
|
753
756
|
}): string | Promise<string>;
|
|
@@ -762,7 +765,7 @@ interface TegamiOptions<Groups extends string = string> {
|
|
|
762
765
|
/** Changelog generator used when applying a draft. */
|
|
763
766
|
generator?: LogGenerator;
|
|
764
767
|
/** Per-package options keyed by package name or a function. */
|
|
765
|
-
packages?: Record<string, PackageOptions<NoInfer<Groups>>> | ((pkg: WorkspacePackage) => PackageOptions<NoInfer<Groups>> | undefined);
|
|
768
|
+
packages?: Record<string, PackageOptions<NoInfer<Groups>>> | ((pkg: WorkspacePackage$1) => PackageOptions<NoInfer<Groups>> | undefined);
|
|
766
769
|
plugins?: TegamiPluginOption[];
|
|
767
770
|
groups?: Record<Groups, GroupOptions>;
|
|
768
771
|
/** Package names, ids, or regex patterns to exclude from the dependency graph. */
|
|
@@ -841,7 +844,7 @@ interface TegamiPlugin {
|
|
|
841
844
|
* If multiple plugins return preflight data for the same package, only the first plugin will be considered.
|
|
842
845
|
*/
|
|
843
846
|
publishPreflight?(this: TegamiContext, opts: {
|
|
844
|
-
pkg: WorkspacePackage;
|
|
847
|
+
pkg: WorkspacePackage$1;
|
|
845
848
|
plan: PublishPlan;
|
|
846
849
|
}): Awaitable<PublishPreflight | void | undefined>;
|
|
847
850
|
/** Called when all preflights finished */
|
|
@@ -850,7 +853,7 @@ interface TegamiPlugin {
|
|
|
850
853
|
}): Awaitable<void>;
|
|
851
854
|
/** Publish package, return a result object indicating if the package is published, skipped, or failed. Return `undefined` if the package is not handled by this plugin. */
|
|
852
855
|
publish?(this: TegamiContext, opts: {
|
|
853
|
-
pkg: WorkspacePackage;
|
|
856
|
+
pkg: WorkspacePackage$1;
|
|
854
857
|
plan: PublishPlan;
|
|
855
858
|
}): Promise<PackagePublishResult | undefined | void>;
|
|
856
859
|
/**
|
|
@@ -867,11 +870,11 @@ interface TegamiPlugin {
|
|
|
867
870
|
}): Awaitable<void>;
|
|
868
871
|
/** Called before a package will be published, return `false` to prevent from publishing. */
|
|
869
872
|
willPublish?(this: TegamiContext, opts: {
|
|
870
|
-
pkg: WorkspacePackage;
|
|
873
|
+
pkg: WorkspacePackage$1;
|
|
871
874
|
}): Awaitable<false | void | undefined>;
|
|
872
875
|
/** Called after a package is published successfully, or failed. */
|
|
873
876
|
afterPublish?(this: TegamiContext, opts: {
|
|
874
|
-
pkg: WorkspacePackage;
|
|
877
|
+
pkg: WorkspacePackage$1;
|
|
875
878
|
plan: PublishPlan;
|
|
876
879
|
}): Awaitable<void>;
|
|
877
880
|
/** Called after all publishing finishes. */
|
|
@@ -906,4 +909,4 @@ interface PublishPreflight {
|
|
|
906
909
|
optionalWait?: string[];
|
|
907
910
|
}
|
|
908
911
|
//#endregion
|
|
909
|
-
export {
|
|
912
|
+
export { type PackageGroup as A, type NpmGraph as C, type CargoPluginOptions as D, CargoPackage as E, BumpType as F, Draft as M, DraftPolicy as N, cargo as O, PackageDraft as P, DependencySpec as S, CargoGraph as T, PackagePublishResult as _, type PublishPreflight as a, type CommitChangelog as b, type TegamiPluginOption as c, type GenerateChangelogOptions as d, Tegami as f, PackagePublishPlan as g, PublishLock as h, PackageOptions as i, WorkspacePackage$1 as j, PackageGraph as k, NpmPluginOptions as l, tegami as m, GroupOptions as n, TegamiOptions as o, WorkspacePackage as p, LogGenerator as r, TegamiPlugin as s, Awaitable as t, npm as u, PublishOptions as v, NpmPackage as w, TegamiContext as x, PublishPlan as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { M as Draft, h as PublishLock, t as Awaitable, x as TegamiContext, y as PublishPlan } from "./types-Kj7Nxbjz.js";
|
|
2
2
|
|
|
3
3
|
//#region src/utils/version-request.d.ts
|
|
4
4
|
interface VersionRequestOptions {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as formatNpmDistTag, r as diffWeight } from "./semver-DrtaCCZK.js";
|
|
2
2
|
import { n as execFailure, s as isCI } from "./error-CAsrGb6e.js";
|
|
3
|
-
import { t as _accessExpressionAsString } from "./_accessExpressionAsString-
|
|
4
|
-
import { n as _validateReport, t as _createStandardSchema } from "./_createStandardSchema-
|
|
5
|
-
import {
|
|
3
|
+
import { t as _accessExpressionAsString } from "./_accessExpressionAsString-DW_6Xqcp.js";
|
|
4
|
+
import { n as _validateReport, t as _createStandardSchema } from "./_createStandardSchema-CrRqJgaE.js";
|
|
5
|
+
import { t as getPackageBumps } from "./shared-pTOZU5UZ.js";
|
|
6
|
+
import { o as PublishLock, r as runPreflights, s as parsePublishLock, t as initPublishPlan } from "./publish-BEYIILK5.js";
|
|
6
7
|
import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
|
7
8
|
import { join, relative } from "node:path";
|
|
8
9
|
import { x } from "tinyexec";
|
|
@@ -164,10 +165,15 @@ function onVersionRequest(provider) {
|
|
|
164
165
|
getPreviousVersion: (id) => snapshots.get(id)
|
|
165
166
|
};
|
|
166
167
|
const custom = await config.create?.call(this, ctx);
|
|
167
|
-
const
|
|
168
|
+
const resolved = {
|
|
169
|
+
title: custom?.title ?? (publishGroup ? `Release ${packages.map((pkg) => `${pkg.name} (${pkg.manager})`).join(", ")}` : "Version Packages"),
|
|
170
|
+
body: custom?.body ?? renderRequestBody(this, ctx),
|
|
171
|
+
head: branch,
|
|
172
|
+
base: config.base
|
|
173
|
+
};
|
|
168
174
|
if (publishGroup) {
|
|
169
175
|
parent ??= await resolveHead(this.cwd);
|
|
170
|
-
baseLock ??=
|
|
176
|
+
baseLock ??= parsePublishLock(await readFile(this.lockPath, "utf8"));
|
|
171
177
|
const newGroups = {};
|
|
172
178
|
for (const req of requests) {
|
|
173
179
|
if (!req.publishGroup) continue;
|
|
@@ -180,21 +186,11 @@ function onVersionRequest(provider) {
|
|
|
180
186
|
parent,
|
|
181
187
|
store: { groups: newGroups }
|
|
182
188
|
});
|
|
183
|
-
tasks.push(provider.upsert(this,
|
|
184
|
-
title,
|
|
185
|
-
body: custom?.body ?? renderRequestBody(this, ctx),
|
|
186
|
-
head: branch,
|
|
187
|
-
base: config.base
|
|
188
|
-
}, !inSync));
|
|
189
|
+
tasks.push(provider.upsert(this, resolved, !inSync));
|
|
189
190
|
continue;
|
|
190
191
|
}
|
|
191
192
|
await pushBranch(this.cwd, branch);
|
|
192
|
-
await provider.upsert(this,
|
|
193
|
-
title,
|
|
194
|
-
body: custom?.body ?? renderRequestBody(this, ctx),
|
|
195
|
-
head: branch,
|
|
196
|
-
base: config.base
|
|
197
|
-
}, true);
|
|
193
|
+
await provider.upsert(this, resolved, true);
|
|
198
194
|
}
|
|
199
195
|
await Promise.all(tasks);
|
|
200
196
|
},
|
|
@@ -261,7 +257,7 @@ function onVersionRequest(provider) {
|
|
|
261
257
|
};
|
|
262
258
|
}
|
|
263
259
|
function renderRequestBody(ctx, { draft, getPreviousVersion, plan }) {
|
|
264
|
-
const
|
|
260
|
+
const bumpedPackages = [];
|
|
265
261
|
const changelogLines = [];
|
|
266
262
|
const publishLines = [];
|
|
267
263
|
const changesets = /* @__PURE__ */ new Map();
|
|
@@ -274,19 +270,31 @@ function renderRequestBody(ctx, { draft, getPreviousVersion, plan }) {
|
|
|
274
270
|
else changesets.set(changelog, [pkg]);
|
|
275
271
|
}
|
|
276
272
|
const from = getPreviousVersion(id);
|
|
277
|
-
if (!from || from === pkg.version) continue;
|
|
278
|
-
|
|
273
|
+
if (!from || !pkg.version || from === pkg.version) continue;
|
|
274
|
+
bumpedPackages.push({
|
|
275
|
+
name: pkg.name,
|
|
276
|
+
from,
|
|
277
|
+
to: pkg.version,
|
|
278
|
+
diff: diffWeight(from, pkg.version)
|
|
279
|
+
});
|
|
279
280
|
}
|
|
281
|
+
const packageLines = bumpedPackages.sort((a, b) => b.diff - a.diff).map(({ name, from, to }) => `| \`${name}\` | \`${from}\` | \`${to}\` |`);
|
|
280
282
|
for (const [entry, linkedPackages] of changesets) {
|
|
281
|
-
|
|
282
|
-
changelogLines.push("<details>", `<summary>Show Bumped Packages (${linkedPackages.length})</summary>`, "",
|
|
283
|
+
const bumps = getPackageBumps(ctx.graph, entry);
|
|
284
|
+
changelogLines.push(`### ${entry.subject ?? `\`${entry.filename}\``}`, "", "<details>", `<summary>Show Bumped Packages (${linkedPackages.length})</summary>`, "", "| Package | Bump |", "| --- | --- |");
|
|
285
|
+
for (const pkg of linkedPackages) changelogLines.push(`| \`${pkg.id}\` | ${bumps.get(pkg) ?? ""} |`);
|
|
286
|
+
changelogLines.push("", "</details>", "");
|
|
283
287
|
for (const section of entry.sections) {
|
|
284
288
|
changelogLines.push(`#### ${section.title}`, "");
|
|
285
289
|
if (section.content) changelogLines.push(section.content);
|
|
286
290
|
}
|
|
287
291
|
}
|
|
288
|
-
if (plan) {
|
|
289
|
-
|
|
292
|
+
if (plan) for (const [id, { preflight, npm }] of plan.packages) {
|
|
293
|
+
if (!preflight.shouldPublish) continue;
|
|
294
|
+
const pkg = ctx.graph.get(id);
|
|
295
|
+
let pm = "";
|
|
296
|
+
if (npm?.distTag) pm += ` (dist-tag: ${npm.distTag})`;
|
|
297
|
+
publishLines.push(`| \`${pkg.name}\` | \`${pkg.version}\`${pm} | \`${pkg.manager}\` |`);
|
|
290
298
|
}
|
|
291
299
|
const sections = [
|
|
292
300
|
"## Summary",
|
|
@@ -296,7 +304,7 @@ function renderRequestBody(ctx, { draft, getPreviousVersion, plan }) {
|
|
|
296
304
|
];
|
|
297
305
|
if (packageLines.length > 0) sections.push("| Package | From | To |", "| --- | --- | --- |", ...packageLines);
|
|
298
306
|
if (changelogLines.length > 0) sections.push("", "## Changelogs", ...changelogLines);
|
|
299
|
-
if (publishLines.length > 0) sections.push("", "## Publish", "", "The following packages will be published if merged:", ...publishLines);
|
|
307
|
+
if (publishLines.length > 0) sections.push("", "## Publish", "", "The following packages will be published if merged:", "", "| Package | Version | Registry |", "| --- | --- | --- |", ...publishLines);
|
|
300
308
|
sections.push("");
|
|
301
309
|
return sections.join("\n");
|
|
302
310
|
}
|
|
@@ -423,5 +431,43 @@ function publishGroupId(members) {
|
|
|
423
431
|
if (slugs.length === 0) slugs.push("group");
|
|
424
432
|
return slugs.join("-");
|
|
425
433
|
}
|
|
434
|
+
function formatPreview({ graph, npm }, draft, newChangelogNames, labels) {
|
|
435
|
+
const pendingPackages = [];
|
|
436
|
+
const lines = [
|
|
437
|
+
"### Tegami",
|
|
438
|
+
"",
|
|
439
|
+
`This repository uses [Tegami](https://tegami.fuma-nama.dev) to manage releases. When your changes affect published packages, add a changelog file under \`.tegami/\` before merging.`,
|
|
440
|
+
"",
|
|
441
|
+
`[**Create a changelog →**](${labels["create-a-changelog-href"]}) · [Changelog format](https://tegami.fuma-nama.dev/changelog)`,
|
|
442
|
+
""
|
|
443
|
+
];
|
|
444
|
+
for (const pkg of graph.getPackages()) {
|
|
445
|
+
const plan = draft.getPackageDraft(pkg.id);
|
|
446
|
+
if (!plan) continue;
|
|
447
|
+
const bumped = plan.bumpVersion(pkg);
|
|
448
|
+
if (!bumped || !pkg.version || bumped === pkg.version) continue;
|
|
449
|
+
pendingPackages.push({
|
|
450
|
+
name: pkg.name,
|
|
451
|
+
type: plan.type ?? "—",
|
|
452
|
+
from: pkg.version,
|
|
453
|
+
to: bumped,
|
|
454
|
+
distTag: plan.npm?.distTag
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
if (pendingPackages.length > 0) {
|
|
458
|
+
lines.push("#### Release preview", "", "| Package | Bump | Version |", "| --- | --- | --- |");
|
|
459
|
+
for (const { name, type, from, to, distTag } of pendingPackages.sort((a, b) => diffWeight(b.from, b.to) - diffWeight(a.from, a.to))) lines.push(`| \`${name}\` | ${type} | \`${from}\` → \`${to}\`${formatNpmDistTag(distTag)} |`);
|
|
460
|
+
lines.push("");
|
|
461
|
+
}
|
|
462
|
+
const newChangelogs = draft.getChangelogs().filter((entry) => newChangelogNames.has(entry.filename));
|
|
463
|
+
if (newChangelogs.length > 0) {
|
|
464
|
+
lines.push(`#### Changelogs in this ${labels.pr}`, "", "| Changelog | Title |", "| --- | --- |");
|
|
465
|
+
for (const entry of newChangelogs) for (const section of entry.sections) lines.push(`| \`${entry.filename}\` | ${section.title} |`);
|
|
466
|
+
lines.push("");
|
|
467
|
+
} else if (pendingPackages.length === 0) lines.push("#### No changelogs yet", "", `This ${labels.pr} has no pending changelog files. If your changes require a release, add a changelog before merging.`, "");
|
|
468
|
+
else if (newChangelogNames.size === 0) lines.push(`This ${labels.pr} does not add changelog files. Pending changelogs from other branches are included in the preview above.`, "");
|
|
469
|
+
lines.push(`Run \`${npm?.client ?? "npm"} run tegami\` locally to create a changelog interactively.`, "", `<sub>Managed by [Tegami](https://tegami.fuma-nama.dev).</sub>`, "");
|
|
470
|
+
return lines.join("\n");
|
|
471
|
+
}
|
|
426
472
|
//#endregion
|
|
427
|
-
export { onVersionRequest as t };
|
|
473
|
+
export { onVersionRequest as n, formatPreview as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tegami",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "A tool to manage changelogs, versioning, and publishing in monorepo",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Fuma Nama",
|
|
@@ -29,17 +29,17 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@clack/prompts": "^1.
|
|
32
|
+
"@clack/prompts": "^1.7.0",
|
|
33
33
|
"@rainbowatcher/toml-edit-js": "^0.6.5",
|
|
34
|
-
"package-manager-detector": "^1.6.0",
|
|
35
34
|
"semver": "^7.8.5",
|
|
36
35
|
"tinyexec": "^1.2.4",
|
|
37
36
|
"tinyglobby": "^0.2.17",
|
|
38
37
|
"yaml": "^2.9.0"
|
|
39
38
|
},
|
|
40
39
|
"devDependencies": {
|
|
41
|
-
"@types/node": "^26.0
|
|
40
|
+
"@types/node": "^26.1.0",
|
|
42
41
|
"@types/semver": "^7.7.1",
|
|
42
|
+
"package-manager-detector": "^1.7.0",
|
|
43
43
|
"tsdown": "^0.22.3",
|
|
44
44
|
"typescript": "6.0.3",
|
|
45
45
|
"typia": "^12.1.1",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"inlinedDependencies": {
|
|
49
49
|
"@typia/interface": "12.1.1",
|
|
50
|
+
"package-manager-detector": "1.7.0",
|
|
50
51
|
"typia": "12.1.1"
|
|
51
52
|
},
|
|
52
53
|
"scripts": {
|