tegami 1.2.3 → 1.2.5
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-DW_6Xqcp.js → _accessExpressionAsString-DAz6bHI_.js} +1 -1
- package/dist/{_assertGuard-CFFC1Up9.js → _assertGuard-cQ6dIdMj.js} +2 -2
- package/dist/{_createStandardSchema-CrRqJgaE.js → _createStandardSchema-DFfVlh8x.js} +2 -2
- package/dist/cli/index.d.ts +1 -2
- package/dist/cli/index.js +34 -35
- package/dist/{generate-Cgl2G5ea.js → generate-Cip5o2xy.js} +1 -1
- package/dist/generators/simple.d.ts +1 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +13 -9
- package/dist/{npm-uJA8deYA.js → npm-BHUzBLSi.js} +11 -13
- package/dist/plugins/cargo.d.ts +1 -1
- package/dist/plugins/cargo.js +36 -33
- package/dist/plugins/git.d.ts +1 -2
- package/dist/plugins/git.js +2 -4
- package/dist/plugins/github.d.ts +10 -9
- package/dist/plugins/github.js +109 -199
- package/dist/plugins/gitlab.d.ts +9 -8
- package/dist/plugins/gitlab.js +114 -204
- package/dist/plugins/go.d.ts +2 -6
- package/dist/plugins/go.js +9 -9
- package/dist/providers/npm.d.ts +1 -1
- package/dist/providers/npm.js +1 -1
- package/dist/{publish-BEYIILK5.js → publish-CQifflae.js} +9 -7
- package/dist/{shared-pTOZU5UZ.js → shared-BraxbVVG.js} +2 -2
- package/dist/{types-Kj7Nxbjz.d.ts → types-Cn0Au3Kk.d.ts} +74 -59
- package/dist/utils/index.d.ts +0 -1
- package/dist/{version-request-C89RO85i.js → version-request-CLEmlVnL.js} +136 -46
- package/dist/{version-request-C5vtakPE.d.ts → version-request-DHxFYvna.d.ts} +1 -3
- package/package.json +3 -3
package/dist/{_accessExpressionAsString-DW_6Xqcp.js → _accessExpressionAsString-DAz6bHI_.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/typia@12.1.1_@types+node@26.1.
|
|
1
|
+
//#region ../../node_modules/.pnpm/typia@12.1.1_@types+node@26.1.1_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.
|
|
1
|
+
//#region ../../node_modules/.pnpm/typia@12.1.1_@types+node@26.1.1_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.1.
|
|
84
|
+
//#region ../../node_modules/.pnpm/typia@12.1.1_@types+node@26.1.1_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.
|
|
1
|
+
//#region ../../node_modules/.pnpm/typia@12.1.1_@types+node@26.1.1_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.1.
|
|
21
|
+
//#region ../../node_modules/.pnpm/typia@12.1.1_@types+node@26.1.1_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
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { M as Draft, f as Tegami, t as Awaitable,
|
|
2
|
-
|
|
1
|
+
import { M as Draft, f as Tegami, t as Awaitable, v as PublishPlan } from "../types-Cn0Au3Kk.js";
|
|
3
2
|
//#region src/cli/index.d.ts
|
|
4
3
|
interface TegamiCLIOptions {
|
|
5
4
|
/** create a custom draft, it must not be applied */
|
package/dist/cli/index.js
CHANGED
|
@@ -1,14 +1,24 @@
|
|
|
1
|
-
import { n as generateFromCommits, t as changelogFilename } from "../generate-
|
|
1
|
+
import { n as generateFromCommits, t as changelogFilename } from "../generate-Cip5o2xy.js";
|
|
2
2
|
import { i as handlePluginError, s as isCI, t as CancelledError } from "../error-CAsrGb6e.js";
|
|
3
|
-
import { n as renderChangelog } from "../shared-
|
|
3
|
+
import { n as renderChangelog } from "../shared-BraxbVVG.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";
|
|
7
7
|
import { autocompleteMultiselect, confirm, intro, isCancel, multiline, note, outro, select, spinner } from "@clack/prompts";
|
|
8
8
|
import { parseArgs } from "node:util";
|
|
9
9
|
//#region src/utils/git-changes.ts
|
|
10
|
-
async function getChangedPackages(
|
|
11
|
-
|
|
10
|
+
async function getChangedPackages(packages, cwd) {
|
|
11
|
+
const files = await getChangedFilePaths(cwd);
|
|
12
|
+
const sortedPackages = packages.toSorted((a, b) => b.path.length - a.path.length);
|
|
13
|
+
const matched = /* @__PURE__ */ new Set();
|
|
14
|
+
for (const file of files) {
|
|
15
|
+
const fullPath = join(cwd, file);
|
|
16
|
+
for (const pkg of sortedPackages) if (!relative(pkg.path, fullPath).startsWith("..")) {
|
|
17
|
+
matched.add(pkg);
|
|
18
|
+
break;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return matched;
|
|
12
22
|
}
|
|
13
23
|
async function getChangedFilePaths(cwd) {
|
|
14
24
|
const files = /* @__PURE__ */ new Set();
|
|
@@ -26,18 +36,6 @@ async function getChangedFilePaths(cwd) {
|
|
|
26
36
|
}));
|
|
27
37
|
return Array.from(files);
|
|
28
38
|
}
|
|
29
|
-
function resolveChangedPackages(graph, files, cwd) {
|
|
30
|
-
const packages = [...graph.getPackages()].sort((a, b) => b.path.length - a.path.length);
|
|
31
|
-
const matched = /* @__PURE__ */ new Map();
|
|
32
|
-
for (const file of files) {
|
|
33
|
-
const fullPath = join(cwd, file);
|
|
34
|
-
for (const pkg of packages) if (!relative(pkg.path, fullPath).startsWith("..")) {
|
|
35
|
-
matched.set(pkg.id, pkg);
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return [...matched.values()];
|
|
40
|
-
}
|
|
41
39
|
//#endregion
|
|
42
40
|
//#region src/cli/changelog.ts
|
|
43
41
|
async function runChangelogTui(tegami) {
|
|
@@ -109,13 +107,13 @@ async function persistChangelogs(context, entries, emptyMessage = "No changelogs
|
|
|
109
107
|
}
|
|
110
108
|
async function promptPackageSelection(graph, cwd) {
|
|
111
109
|
const useShortname = /* @__PURE__ */ new Map();
|
|
112
|
-
|
|
110
|
+
const versionablePackages = graph.getPackages().filter((pkg) => pkg.version !== void 0);
|
|
111
|
+
for (const pkg of versionablePackages) if (useShortname.has(pkg.name)) useShortname.set(pkg.name, false);
|
|
113
112
|
else useShortname.set(pkg.name, true);
|
|
114
113
|
const getPackageLabel = (pkg) => {
|
|
115
114
|
return useShortname.get(pkg.name) ? pkg.name : pkg.id;
|
|
116
115
|
};
|
|
117
|
-
const changedPackages =
|
|
118
|
-
const initialValues = /* @__PURE__ */ new Set();
|
|
116
|
+
const changedPackages = await getChangedPackages(versionablePackages, cwd);
|
|
119
117
|
const selectOptions = [];
|
|
120
118
|
const groups = [];
|
|
121
119
|
for (const group of graph.getGroups()) {
|
|
@@ -128,20 +126,15 @@ async function promptPackageSelection(graph, cwd) {
|
|
|
128
126
|
value: `group:${group.name}`,
|
|
129
127
|
hint: group.packages.map(getPackageLabel).join(", ")
|
|
130
128
|
});
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
selectOptions.push({
|
|
136
|
-
label: getPackageLabel(pkg) + (changed ? "*" : ""),
|
|
137
|
-
value: pkg.id
|
|
138
|
-
});
|
|
139
|
-
}
|
|
129
|
+
for (const pkg of versionablePackages.sort((a, b) => (changedPackages.has(a) ? 0 : 1) - (changedPackages.has(b) ? 0 : 1))) selectOptions.push({
|
|
130
|
+
label: getPackageLabel(pkg) + (changedPackages.has(pkg) ? "*" : ""),
|
|
131
|
+
value: pkg.id
|
|
132
|
+
});
|
|
140
133
|
const selected = await autocompleteMultiselect({
|
|
141
134
|
message: "Select packages (leave empty to auto-generate from commits)",
|
|
142
135
|
required: false,
|
|
143
136
|
options: selectOptions,
|
|
144
|
-
initialValues: Array.from(
|
|
137
|
+
initialValues: Array.from(changedPackages, (pkg) => pkg.id)
|
|
145
138
|
});
|
|
146
139
|
if (isCancel(selected)) throw new CancelledError();
|
|
147
140
|
return selected;
|
|
@@ -480,11 +473,14 @@ function registerCoreCommands(cli, tegami, options) {
|
|
|
480
473
|
});
|
|
481
474
|
});
|
|
482
475
|
cli.command("ci", { description: "version and publish packages" }).action(async () => {
|
|
483
|
-
if (await versionPackages(tegami, {
|
|
476
|
+
if (await versionPackages(tegami, {
|
|
477
|
+
cli: options,
|
|
478
|
+
noChecks: true
|
|
479
|
+
})) return;
|
|
484
480
|
await publishPackages(tegami, { cli: options });
|
|
485
481
|
});
|
|
486
482
|
cli.command("check-publish", { description: "exit with code 1 if no publishing needed, otherwise 0" }).action(async () => {
|
|
487
|
-
const status = await tegami.
|
|
483
|
+
const { status } = await tegami.getPublishStatus();
|
|
488
484
|
process.exit(status === "pending" ? 0 : 1);
|
|
489
485
|
});
|
|
490
486
|
cli.command("publish", { description: "publish packages from the publish lock" }).option("dry-run", {
|
|
@@ -523,10 +519,13 @@ async function versionPackages(tegami, options) {
|
|
|
523
519
|
outro("No versions changed.");
|
|
524
520
|
return false;
|
|
525
521
|
}
|
|
526
|
-
if (!options.noChecks
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
522
|
+
if (!options.noChecks) {
|
|
523
|
+
const { status, reason } = await tegami.getPublishStatus();
|
|
524
|
+
if (status === "pending") {
|
|
525
|
+
note(`Publish lock at ${context.lockPath} is still pending. Publish it before applying a new draft.`, "Failed to apply");
|
|
526
|
+
outro(reason ?? "Cannot apply.");
|
|
527
|
+
return false;
|
|
528
|
+
}
|
|
530
529
|
}
|
|
531
530
|
const lines = [];
|
|
532
531
|
for (const pkg of context.graph.getPackages()) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { o as maxBump, t as bumpDepth } from "./semver-DrtaCCZK.js";
|
|
2
2
|
import { n as execFailure } from "./error-CAsrGb6e.js";
|
|
3
|
-
import { n as renderChangelog } from "./shared-
|
|
3
|
+
import { n as renderChangelog } from "./shared-BraxbVVG.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 PackageGroup, F as BumpType, M as Draft, N as DraftPolicy, P as PackageDraft, _ as
|
|
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 };
|
|
1
|
+
import { A as PackageGroup, F as ChangelogEntry, I as ReplayCondition, L as BumpType, M as Draft, N as DraftPolicy, P as PackageDraft, _ as PublishOptions, a as PublishPreflight, b as GenerateFromCommitsOptions, c as TegamiPluginOption, d as GenerateChangelogOptions, f as Tegami, g as PackagePublishResult, h as PackagePublishPlan, i as PackageOptions, j as WorkspacePackage, k as PackageGraph, m as PublishLock, n as GroupOptions, o as TegamiOptions, p as tegami, r as LogGenerator, s as TegamiPlugin, v as PublishPlan, x as TegamiContext, y as CommitChangelog } from "./types-Cn0Au3Kk.js";
|
|
2
|
+
export { type BumpType, type ChangelogEntry, type CommitChangelog, type Draft, type DraftPolicy, GenerateChangelogOptions, type GenerateFromCommitsOptions, type GroupOptions, type LogGenerator, type PackageDraft, PackageGraph, type PackageGroup, type PackageOptions, type PackagePublishPlan, type PackagePublishResult, type PublishLock, type PublishOptions, type PublishPlan, type PublishPreflight, type ReplayCondition, 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-Cip5o2xy.js";
|
|
2
2
|
import { i as handlePluginError } from "./error-CAsrGb6e.js";
|
|
3
|
-
import { t as npm } from "./npm-
|
|
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-
|
|
5
|
-
import { n as WorkspacePackage
|
|
3
|
+
import { t as npm } from "./npm-BHUzBLSi.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-CQifflae.js";
|
|
5
|
+
import { n as WorkspacePackage, 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,7 +55,6 @@ function resolvePlugins(plugins = []) {
|
|
|
55
55
|
}
|
|
56
56
|
//#endregion
|
|
57
57
|
//#region src/index.ts
|
|
58
|
-
const WorkspacePackage = WorkspacePackage$1;
|
|
59
58
|
/** Create a Tegami project handle. */
|
|
60
59
|
function tegami(options = {}) {
|
|
61
60
|
let $context;
|
|
@@ -99,19 +98,23 @@ function tegami(options = {}) {
|
|
|
99
98
|
}
|
|
100
99
|
return createDraft(changelogs, context);
|
|
101
100
|
},
|
|
102
|
-
async
|
|
101
|
+
async getPublishStatus(publishOptions = {}) {
|
|
103
102
|
const context = await getContextResolved();
|
|
104
103
|
const plan = await initPublishPlan(context, publishOptions);
|
|
105
|
-
if (!plan) return "
|
|
104
|
+
if (!plan) return { status: "none" };
|
|
106
105
|
await runPreflights(context, plan);
|
|
107
106
|
return publishPlanStatus(plan, context);
|
|
108
107
|
},
|
|
108
|
+
async publishStatus(publishOptions = {}) {
|
|
109
|
+
const { status } = await this.getPublishStatus(publishOptions);
|
|
110
|
+
return status === "none" ? "idle" : status;
|
|
111
|
+
},
|
|
109
112
|
async publish(publishOptions = {}) {
|
|
110
113
|
const context = await getContextResolved();
|
|
111
114
|
const plan = await initPublishPlan(context, publishOptions);
|
|
112
115
|
if (!plan) return "skipped";
|
|
113
116
|
await runPreflights(context, plan);
|
|
114
|
-
if (await publishPlanStatus(plan, context) === "success") return "skipped";
|
|
117
|
+
if ((await publishPlanStatus(plan, context)).status === "success") return "skipped";
|
|
115
118
|
await runPublishPlan(context, plan);
|
|
116
119
|
if (Array.from(plan.packages.values()).every((pkg) => pkg.publishResult.type === "skipped")) return "skipped";
|
|
117
120
|
return plan;
|
|
@@ -124,7 +127,8 @@ function tegami(options = {}) {
|
|
|
124
127
|
reason: "no-plan"
|
|
125
128
|
};
|
|
126
129
|
await runPreflights(context, plan);
|
|
127
|
-
|
|
130
|
+
const { status } = await publishPlanStatus(plan, context);
|
|
131
|
+
if (status !== "success") return {
|
|
128
132
|
state: "skipped",
|
|
129
133
|
reason: "pending"
|
|
130
134
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
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-
|
|
2
|
+
import { t as _accessExpressionAsString } from "./_accessExpressionAsString-DAz6bHI_.js";
|
|
3
|
+
import { n as _validateReport, t as _createStandardSchema } from "./_createStandardSchema-DFfVlh8x.js";
|
|
4
|
+
import { r as runPreflights, s as parsePublishLock, t as initPublishPlan } from "./publish-CQifflae.js";
|
|
5
|
+
import { t as _assertGuard } from "./_assertGuard-cQ6dIdMj.js";
|
|
6
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";
|
|
@@ -247,17 +247,16 @@ async function publishPlaceholder(pkg) {
|
|
|
247
247
|
const access = pkg.manifest.publishConfig?.access;
|
|
248
248
|
const dir = await fs.mkdtemp(join(tmpdir(), "tegami-npm-placeholder-"));
|
|
249
249
|
try {
|
|
250
|
-
await fs.writeFile(join(dir, "package.json"), `${JSON.stringify({
|
|
250
|
+
await Promise.all([fs.writeFile(join(dir, "package.json"), `${JSON.stringify({
|
|
251
251
|
name: pkg.name,
|
|
252
252
|
version: PLACEHOLDER_VERSION,
|
|
253
253
|
description: "Placeholder published by Tegami for npm trusted publishing setup."
|
|
254
|
-
}, null, 2)}\n`)
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
`);
|
|
254
|
+
}, null, 2)}\n`), fs.writeFile(join(dir, "README.md"), `# Placeholder package
|
|
255
|
+
|
|
256
|
+
This empty package was published by [Tegami](https://tegami.fuma-nama.dev) to configure npm trusted publishing.
|
|
257
|
+
|
|
258
|
+
The real package contents will be published via CI with OIDC.
|
|
259
|
+
`)]);
|
|
261
260
|
const args = [
|
|
262
261
|
"publish",
|
|
263
262
|
"--tag",
|
|
@@ -969,7 +968,6 @@ function npm({ client: defaultClient, onBreakPeerDep = "set", updateLockFile = t
|
|
|
969
968
|
} } = {}) {
|
|
970
969
|
return {
|
|
971
970
|
name: "npm",
|
|
972
|
-
enforce: "pre",
|
|
973
971
|
async init() {
|
|
974
972
|
if (defaultClient) this.npm = {
|
|
975
973
|
client: defaultClient,
|
package/dist/plugins/cargo.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { D as CargoPluginOptions, E as CargoPackage, O as cargo, T as CargoGraph } from "../types-
|
|
1
|
+
import { D as CargoPluginOptions, E as CargoPackage, O as cargo, T as CargoGraph } from "../types-Cn0Au3Kk.js";
|
|
2
2
|
export { CargoGraph, CargoPackage, CargoPluginOptions, cargo };
|
package/dist/plugins/cargo.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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-
|
|
2
|
+
import { t as _accessExpressionAsString } from "../_accessExpressionAsString-DAz6bHI_.js";
|
|
3
|
+
import { t as _assertGuard } from "../_assertGuard-cQ6dIdMj.js";
|
|
4
4
|
import { n as WorkspacePackage } from "../graph-DaJ28Y4f.js";
|
|
5
|
-
import
|
|
5
|
+
import fs from "node:fs/promises";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { x } from "tinyexec";
|
|
8
8
|
import * as semver$1 from "semver";
|
|
@@ -510,17 +510,47 @@ var CargoToml = class {
|
|
|
510
510
|
data;
|
|
511
511
|
dependencies;
|
|
512
512
|
workspace;
|
|
513
|
+
originalContent;
|
|
513
514
|
constructor(path, content, data) {
|
|
514
515
|
this.path = path;
|
|
515
516
|
this.content = content;
|
|
516
517
|
this.data = data;
|
|
518
|
+
this.originalContent = content;
|
|
517
519
|
}
|
|
518
520
|
listDependencies(graph) {
|
|
519
|
-
|
|
521
|
+
if (this.dependencies) return this.dependencies;
|
|
522
|
+
const out = this.dependencies = [];
|
|
523
|
+
const scan = (obj, prefix = []) => {
|
|
524
|
+
for (const field of DEP_FIELDS) {
|
|
525
|
+
const table = obj[field];
|
|
526
|
+
if (!table) continue;
|
|
527
|
+
const tablePath = [...prefix, field];
|
|
528
|
+
for (const [key, spec] of Object.entries(table)) {
|
|
529
|
+
const { linked, range, setRange } = resolveLinkedDep(this, graph, tablePath, key, spec) ?? {};
|
|
530
|
+
out.push({
|
|
531
|
+
path: [...tablePath, key],
|
|
532
|
+
spec,
|
|
533
|
+
resolved: linked,
|
|
534
|
+
range,
|
|
535
|
+
setRange: setRange && ((v) => {
|
|
536
|
+
table[key] = setRange(v);
|
|
537
|
+
})
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
scan(this.data);
|
|
543
|
+
if (this.data.target) for (const [key, config] of Object.entries(this.data.target)) scan(config, ["target", key]);
|
|
544
|
+
if (this.data.workspace) scan(this.data.workspace);
|
|
545
|
+
return out;
|
|
520
546
|
}
|
|
521
547
|
patch(path, value) {
|
|
522
548
|
this.content = edit(this.content, path, value);
|
|
523
549
|
}
|
|
550
|
+
async write() {
|
|
551
|
+
if (this.content === this.originalContent) return;
|
|
552
|
+
await fs.writeFile(this.path, this.content);
|
|
553
|
+
}
|
|
524
554
|
};
|
|
525
555
|
var CargoPackage = class extends WorkspacePackage {
|
|
526
556
|
path;
|
|
@@ -561,7 +591,6 @@ var CargoPackage = class extends WorkspacePackage {
|
|
|
561
591
|
function cargo({ updateLockFile = true, bumpDep: getBumpDepType } = {}) {
|
|
562
592
|
return {
|
|
563
593
|
name: "cargo",
|
|
564
|
-
enforce: "pre",
|
|
565
594
|
async init() {
|
|
566
595
|
await initToml();
|
|
567
596
|
},
|
|
@@ -623,7 +652,7 @@ function cargo({ updateLockFile = true, bumpDep: getBumpDepType } = {}) {
|
|
|
623
652
|
else updatedRange = resolved.version;
|
|
624
653
|
setRange(updatedRange);
|
|
625
654
|
}
|
|
626
|
-
await Promise.all(Array.from(graph.files.values(), (file) =>
|
|
655
|
+
await Promise.all(Array.from(graph.files.values(), (file) => file.write()));
|
|
627
656
|
},
|
|
628
657
|
async applyCliDraft() {
|
|
629
658
|
if (!this.cargo || !updateLockFile) return;
|
|
@@ -691,7 +720,7 @@ async function isPackagePublished(name, version) {
|
|
|
691
720
|
async function buildEntry(dir) {
|
|
692
721
|
try {
|
|
693
722
|
const filePath = path.join(dir, "Cargo.toml");
|
|
694
|
-
const content = await readFile(filePath, "utf8");
|
|
723
|
+
const content = await fs.readFile(filePath, "utf8");
|
|
695
724
|
return new CargoToml(filePath, content, assertCargoManifest(parse$1(content)));
|
|
696
725
|
} catch {
|
|
697
726
|
return;
|
|
@@ -736,32 +765,6 @@ async function expandWorkspaceMembers(cwd, members, exclude = []) {
|
|
|
736
765
|
return item.endsWith(path.sep) ? item.slice(0, -1) : item;
|
|
737
766
|
});
|
|
738
767
|
}
|
|
739
|
-
function listDependencies(graph, file) {
|
|
740
|
-
const out = [];
|
|
741
|
-
function scan(obj, prefix = []) {
|
|
742
|
-
for (const field of DEP_FIELDS) {
|
|
743
|
-
const table = obj[field];
|
|
744
|
-
if (!table) continue;
|
|
745
|
-
const tablePath = [...prefix, field];
|
|
746
|
-
for (const [key, spec] of Object.entries(table)) {
|
|
747
|
-
const { linked, range, setRange } = resolveLinkedDep(file, graph, tablePath, key, spec) ?? {};
|
|
748
|
-
out.push({
|
|
749
|
-
path: [...tablePath, key],
|
|
750
|
-
spec,
|
|
751
|
-
resolved: linked,
|
|
752
|
-
range,
|
|
753
|
-
setRange: setRange && ((v) => {
|
|
754
|
-
table[key] = setRange(v);
|
|
755
|
-
})
|
|
756
|
-
});
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
scan(file.data);
|
|
761
|
-
if (file.data.target) for (const [key, config] of Object.entries(file.data.target)) scan(config, ["target", key]);
|
|
762
|
-
if (file.data.workspace) scan(file.data.workspace);
|
|
763
|
-
return out;
|
|
764
|
-
}
|
|
765
768
|
function resolveLinkedDep(file, graph, tablePath, key, spec) {
|
|
766
769
|
if (typeof spec === "string") {
|
|
767
770
|
const linked = graph.packages.get(key);
|
package/dist/plugins/git.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { s as TegamiPlugin } from "../types-
|
|
2
|
-
|
|
1
|
+
import { s as TegamiPlugin } from "../types-Cn0Au3Kk.js";
|
|
3
2
|
//#region src/plugins/git.d.ts
|
|
4
3
|
interface GitPluginOptions {
|
|
5
4
|
/** Set to false to skip creating git tags after all packages publish successfully. */
|
package/dist/plugins/git.js
CHANGED
|
@@ -22,7 +22,6 @@ function git(options = {}) {
|
|
|
22
22
|
}
|
|
23
23
|
return {
|
|
24
24
|
name: "git",
|
|
25
|
-
enforce: "pre",
|
|
26
25
|
async initCli() {
|
|
27
26
|
if (!isCI()) return;
|
|
28
27
|
const gitOptions = { nodeOptions: { cwd: this.cwd } };
|
|
@@ -43,9 +42,8 @@ function git(options = {}) {
|
|
|
43
42
|
const { graph } = this;
|
|
44
43
|
for (const [id, packagePlan] of plan.packages) {
|
|
45
44
|
const pkg = graph.get(id);
|
|
46
|
-
packagePlan.git ??= {};
|
|
47
|
-
if (pkg.group?.options.syncGitTag
|
|
48
|
-
else if (pkg.version) packagePlan.git.tag = `${pkg.name}@${pkg.version}`;
|
|
45
|
+
const git = packagePlan.git ??= {};
|
|
46
|
+
if (pkg.version) git.tag ??= pkg.group?.options.syncGitTag ? `${pkg.group.name}@${pkg.version}` : `${pkg.name}@${pkg.version}`;
|
|
49
47
|
}
|
|
50
48
|
},
|
|
51
49
|
async resolvePlanStatus({ plan }) {
|
package/dist/plugins/github.d.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { j as WorkspacePackage, s as TegamiPlugin, t as Awaitable,
|
|
1
|
+
import { j as WorkspacePackage, s as TegamiPlugin, t as Awaitable, v as PublishPlan, x as TegamiContext } from "../types-Cn0Au3Kk.js";
|
|
2
2
|
import { GitPluginOptions } from "./git.js";
|
|
3
|
-
import { t as VersionRequestOptions } from "../version-request-
|
|
4
|
-
|
|
3
|
+
import { t as VersionRequestOptions } from "../version-request-DHxFYvna.js";
|
|
5
4
|
//#region src/plugins/github.d.ts
|
|
6
5
|
interface GithubRelease {
|
|
7
6
|
/** Release title */
|
|
8
|
-
title
|
|
7
|
+
title: string;
|
|
9
8
|
/** Release notes */
|
|
10
|
-
notes
|
|
9
|
+
notes: string;
|
|
11
10
|
/** Whether to mark release as prerelease */
|
|
12
|
-
prerelease
|
|
11
|
+
prerelease: boolean;
|
|
13
12
|
}
|
|
14
13
|
/** Options for creating GitHub releases after a successful publish. */
|
|
15
14
|
interface GitHubPluginOptions extends GitPluginOptions {
|
|
@@ -28,17 +27,19 @@ interface GitHubPluginOptions extends GitPluginOptions {
|
|
|
28
27
|
*
|
|
29
28
|
* @default false
|
|
30
29
|
*/
|
|
31
|
-
eager?: boolean;
|
|
30
|
+
eager?: boolean;
|
|
31
|
+
/** Override release details for a single package. */
|
|
32
32
|
create?: (this: TegamiContext, opts: {
|
|
33
33
|
tag: string;
|
|
34
34
|
pkg: WorkspacePackage;
|
|
35
35
|
plan: PublishPlan;
|
|
36
|
-
}) => Awaitable<GithubRelease
|
|
36
|
+
}) => Awaitable<Partial<GithubRelease>>;
|
|
37
|
+
/** Override release details when multiple packages share a git tag. */
|
|
37
38
|
createGrouped?: (this: TegamiContext, opts: {
|
|
38
39
|
tag: string;
|
|
39
40
|
packages: WorkspacePackage[];
|
|
40
41
|
plan: PublishPlan;
|
|
41
|
-
}) => Awaitable<GithubRelease
|
|
42
|
+
}) => Awaitable<Partial<GithubRelease>>;
|
|
42
43
|
};
|
|
43
44
|
/**
|
|
44
45
|
* (CLI only) Open a version pull request after versioning.
|