tegami 1.0.0-beta.1 → 1.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.js +3 -3
- package/dist/{error-DNy8R5ue.js → error-D3dwQnwR.js} +22 -2
- package/dist/{generate-BqkwhjRy.js → generate-CaCDNfVk.js} +1 -1
- package/dist/generators/simple.d.ts +1 -1
- package/dist/{index-CH40idD8.d.ts → index-CQXmwyLn.d.ts} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +12 -25
- package/dist/{npm-DqGyAsdo.js → npm-B_43doHi.js} +11 -2
- package/dist/plugins/git.d.ts +1 -1
- package/dist/plugins/git.js +13 -16
- package/dist/plugins/github.d.ts +1 -1
- package/dist/plugins/github.js +10 -25
- package/dist/plugins/go.d.ts +1 -1
- package/dist/plugins/go.js +11 -3
- package/dist/providers/cargo.d.ts +1 -1
- package/dist/providers/cargo.js +17 -6
- package/dist/providers/npm.d.ts +1 -1
- package/dist/providers/npm.js +1 -1
- package/dist/{types-BbDtPn8I.d.ts → types-DKeF_CDv.d.ts} +12 -4
- package/package.json +1 -1
package/dist/cli/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { p as PublishPlan, t as Awaitable, w as Draft } from "../types-
|
|
2
|
-
import { n as Tegami } from "../index-
|
|
1
|
+
import { p as PublishPlan, t as Awaitable, w as Draft } from "../types-DKeF_CDv.js";
|
|
2
|
+
import { n as Tegami } from "../index-CQXmwyLn.js";
|
|
3
3
|
import { Command } from "commander";
|
|
4
4
|
|
|
5
5
|
//#region src/cli/index.d.ts
|
package/dist/cli/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as formatNpmDistTag } from "../semver-EKJ8yK5U.js";
|
|
2
|
-
import { i as renderChangelog, n as generateFromCommits, t as changelogFilename } from "../generate-
|
|
3
|
-
import { a as isCI, n as execFailure, r as handlePluginError, t as CancelledError } from "../error-
|
|
2
|
+
import { i as renderChangelog, n as generateFromCommits, t as changelogFilename } from "../generate-CaCDNfVk.js";
|
|
3
|
+
import { a as isCI, n as execFailure, r as handlePluginError, t as CancelledError } from "../error-D3dwQnwR.js";
|
|
4
4
|
import { c as updateIssueComment, i as findIssueCommentByPrefix, o as getPullRequest, t as createIssueComment } from "../api-D-jf_8xY.js";
|
|
5
5
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
6
6
|
import path, { basename, join, relative } from "node:path";
|
|
@@ -543,7 +543,7 @@ async function publishPackages(tegami, options) {
|
|
|
543
543
|
const lines = [];
|
|
544
544
|
let hasFailed = false;
|
|
545
545
|
for (const [id, packagePlan] of plan.packages) {
|
|
546
|
-
if (!packagePlan.
|
|
546
|
+
if (!packagePlan.preflight.shouldPublish) continue;
|
|
547
547
|
const result = packagePlan.publishResult;
|
|
548
548
|
const pkg = context.graph.get(id);
|
|
549
549
|
if (result.type === "failed") hasFailed = true;
|
|
@@ -1,5 +1,25 @@
|
|
|
1
|
-
//#region src/utils/
|
|
1
|
+
//#region src/utils/common.ts
|
|
2
2
|
const isCI = () => Boolean(process.env.CI);
|
|
3
|
+
async function somePromise(promises, fn) {
|
|
4
|
+
return new Promise((res, reject) => {
|
|
5
|
+
const n = promises.length;
|
|
6
|
+
if (n === 0) res(false);
|
|
7
|
+
let i = 0;
|
|
8
|
+
for (const promise of promises) {
|
|
9
|
+
if (promise instanceof Promise) {
|
|
10
|
+
promise.then((v) => {
|
|
11
|
+
if (fn(v)) return res(true);
|
|
12
|
+
i++;
|
|
13
|
+
if (i === n) res(false);
|
|
14
|
+
}).catch(reject);
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
if (fn(promise)) return res(true);
|
|
18
|
+
i++;
|
|
19
|
+
if (i === n) res(false);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
3
23
|
//#endregion
|
|
4
24
|
//#region src/utils/error.ts
|
|
5
25
|
var CancelledError = class extends Error {
|
|
@@ -42,4 +62,4 @@ async function handlePluginError(plugin, hookName, callback) {
|
|
|
42
62
|
}
|
|
43
63
|
}
|
|
44
64
|
//#endregion
|
|
45
|
-
export { isCI as a, isNodeError as i, execFailure as n, handlePluginError as r, CancelledError as t };
|
|
65
|
+
export { isCI as a, isNodeError as i, execFailure as n, somePromise as o, handlePluginError as r, CancelledError as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as maxBump, t as bumpDepth } from "./semver-EKJ8yK5U.js";
|
|
2
|
-
import { n as execFailure } from "./error-
|
|
2
|
+
import { n as execFailure } from "./error-D3dwQnwR.js";
|
|
3
3
|
import { x } from "tinyexec";
|
|
4
4
|
import z from "zod";
|
|
5
5
|
import { dump } from "js-yaml";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as ChangelogPackageConfig, O as BumpType, b as TegamiContext, f as PublishOptions, o as TegamiOptions, p as PublishPlan, w as Draft, x as PackageGraph } from "./types-
|
|
1
|
+
import { D as ChangelogPackageConfig, O as BumpType, b as TegamiContext, f as PublishOptions, o as TegamiOptions, p as PublishPlan, w as Draft, x as PackageGraph } from "./types-DKeF_CDv.js";
|
|
2
2
|
|
|
3
3
|
//#region src/changelog/generate.d.ts
|
|
4
4
|
interface GenerateFromCommitsOptions {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { C as WorkspacePackage, E as PackageDraft, S as PackageGroup, T as DraftPolicy, a as PublishPreflight, c as TegamiPluginOption, d as PackagePublishResult, f as PublishOptions, i as PackageOptions, l as PublishLock, n as GroupOptions, o as TegamiOptions, p as PublishPlan, r as LogGenerator, s as TegamiPlugin, u as PackagePublishPlan, w as Draft, x as PackageGraph } from "./types-
|
|
2
|
-
import { i as CommitChangelog, n as Tegami, r as tegami, t as GenerateChangelogOptions } from "./index-
|
|
1
|
+
import { C as WorkspacePackage, E as PackageDraft, S as PackageGroup, T as DraftPolicy, a as PublishPreflight, c as TegamiPluginOption, d as PackagePublishResult, f as PublishOptions, i as PackageOptions, l as PublishLock, n as GroupOptions, o as TegamiOptions, p as PublishPlan, r as LogGenerator, s as TegamiPlugin, u as PackagePublishPlan, w as Draft, x as PackageGraph } from "./types-DKeF_CDv.js";
|
|
2
|
+
import { i as CommitChangelog, n as Tegami, r as tegami, t as GenerateChangelogOptions } from "./index-CQXmwyLn.js";
|
|
3
3
|
export { type CommitChangelog, type Draft, type DraftPolicy, GenerateChangelogOptions, type GroupOptions, type LogGenerator, type PackageDraft, type PackageGraph, type PackageGroup, type PackageOptions, type PackagePublishPlan, type PackagePublishResult, type PublishLock, type PublishOptions, type PublishPlan, type PublishPreflight, Tegami, type TegamiOptions, type TegamiPlugin, type TegamiPluginOption, type WorkspacePackage, tegami };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { a as maxBump } from "./semver-EKJ8yK5U.js";
|
|
2
|
-
import { n as generateFromCommits, r as changelogFrontmatterSchema } from "./generate-
|
|
3
|
-
import { r as handlePluginError } from "./error-
|
|
2
|
+
import { n as generateFromCommits, r as changelogFrontmatterSchema } from "./generate-CaCDNfVk.js";
|
|
3
|
+
import { o as somePromise, r as handlePluginError } from "./error-D3dwQnwR.js";
|
|
4
4
|
import { t as PackageGraph } from "./graph-gThXu8Cz.js";
|
|
5
5
|
import { cargo } from "./providers/cargo.js";
|
|
6
|
-
import { n as npm } from "./npm-
|
|
6
|
+
import { n as npm } from "./npm-B_43doHi.js";
|
|
7
7
|
import { simpleGenerator } from "./generators/simple.js";
|
|
8
8
|
import fs, { mkdir, readFile, readdir, rm, writeFile } from "node:fs/promises";
|
|
9
9
|
import path, { basename, dirname, join } from "node:path";
|
|
@@ -543,7 +543,7 @@ function resolvePublishTargets(plan) {
|
|
|
543
543
|
const ordered = [];
|
|
544
544
|
function scan(id, stack = /* @__PURE__ */ new Set()) {
|
|
545
545
|
const preflight = plan.packages.get(id)?.preflight;
|
|
546
|
-
if (!preflight || !preflight.
|
|
546
|
+
if (!preflight || !preflight.shouldPublish) return;
|
|
547
547
|
if (stack.has(id)) throw new Error(`circular reference of deps: ${[...stack, id].join(" -> ")}`);
|
|
548
548
|
if (ordered.includes(id)) return;
|
|
549
549
|
if (preflight.wait) {
|
|
@@ -596,25 +596,19 @@ async function runPublishPlan(context, plan) {
|
|
|
596
596
|
async function runPreflights(context, plan) {
|
|
597
597
|
const promises = [];
|
|
598
598
|
const runPreflight = async (pkg) => {
|
|
599
|
-
const out = { publish: true };
|
|
600
599
|
for (const plugin of context.plugins) {
|
|
601
600
|
const res = await handlePluginError(plugin, "publishPreflight", () => plugin.publishPreflight?.call(context, {
|
|
602
601
|
pkg,
|
|
603
602
|
plan
|
|
604
603
|
}));
|
|
605
|
-
if (res
|
|
606
|
-
out.publish = res.publish;
|
|
607
|
-
if (res.wait) {
|
|
608
|
-
out.wait ??= [];
|
|
609
|
-
out.wait.push(...res.wait);
|
|
610
|
-
}
|
|
604
|
+
if (res) return res;
|
|
611
605
|
}
|
|
612
|
-
return
|
|
606
|
+
return { shouldPublish: false };
|
|
613
607
|
};
|
|
614
608
|
for (const [id, packagePlan] of plan.packages) {
|
|
615
609
|
const pkg = context.graph.get(id);
|
|
616
610
|
if (!packagePlan.updated) {
|
|
617
|
-
packagePlan.preflight = {
|
|
611
|
+
packagePlan.preflight = { shouldPublish: false };
|
|
618
612
|
continue;
|
|
619
613
|
}
|
|
620
614
|
promises.push(runPreflight(pkg).then((preflight) => {
|
|
@@ -624,19 +618,12 @@ async function runPreflights(context, plan) {
|
|
|
624
618
|
await Promise.all(promises);
|
|
625
619
|
}
|
|
626
620
|
async function publishPlanStatus(plan, context) {
|
|
627
|
-
for (const
|
|
628
|
-
|
|
629
|
-
if (
|
|
630
|
-
|
|
631
|
-
try {
|
|
632
|
-
await Promise.all(context.plugins.map(async (plugin) => {
|
|
633
|
-
if (await handlePluginError(plugin, "resolvePlanStatus", () => plugin.resolvePlanStatus?.call(context, { plan })) === "pending") throw "pending";
|
|
634
|
-
}));
|
|
635
|
-
return "success";
|
|
636
|
-
} catch (e) {
|
|
637
|
-
if (e === "pending") return "pending";
|
|
638
|
-
throw e;
|
|
621
|
+
for (const plugin of context.plugins) {
|
|
622
|
+
const status = await handlePluginError(plugin, "resolvePlanStatus", () => plugin.resolvePlanStatus?.call(context, { plan }));
|
|
623
|
+
if (Array.isArray(status) && await somePromise(status, (v) => v === "pending")) return "pending";
|
|
624
|
+
if (status === "pending") return "pending";
|
|
639
625
|
}
|
|
626
|
+
return "success";
|
|
640
627
|
}
|
|
641
628
|
//#endregion
|
|
642
629
|
//#region src/index.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as isNodeError, n as execFailure } from "./error-
|
|
1
|
+
import { i as isNodeError, n as execFailure } from "./error-D3dwQnwR.js";
|
|
2
2
|
import { n as WorkspacePackage } from "./graph-gThXu8Cz.js";
|
|
3
3
|
import { readFile, writeFile } from "node:fs/promises";
|
|
4
4
|
import path from "node:path";
|
|
@@ -139,7 +139,15 @@ function npm({ client: defaultClient, onBreakPeerDep = "set", updateLockFile = t
|
|
|
139
139
|
},
|
|
140
140
|
async publishPreflight({ pkg }) {
|
|
141
141
|
if (!(pkg instanceof NpmPackage)) return;
|
|
142
|
-
return {
|
|
142
|
+
return { shouldPublish: pkg.version !== void 0 && pkg.manifest.private !== true };
|
|
143
|
+
},
|
|
144
|
+
resolvePlanStatus({ plan }) {
|
|
145
|
+
return Array.from(plan.packages, async ([id, { preflight }]) => {
|
|
146
|
+
if (!preflight.shouldPublish) return;
|
|
147
|
+
const pkg = this.graph.get(id);
|
|
148
|
+
if (!(pkg instanceof NpmPackage) || !pkg.version) return;
|
|
149
|
+
if (!await isPackagePublished(pkg.name, pkg.version, pkg.manifest.publishConfig?.registry)) return "pending";
|
|
150
|
+
});
|
|
143
151
|
},
|
|
144
152
|
initPublishLock({ lock, draft }) {
|
|
145
153
|
for (const [id, pkg] of draft.getPackageDrafts()) {
|
|
@@ -264,6 +272,7 @@ function depsPolicy(context, getBumpDepType) {
|
|
|
264
272
|
};
|
|
265
273
|
}
|
|
266
274
|
async function publish(client, pkg, distTag) {
|
|
275
|
+
if (!pkg.version || await isPackagePublished(pkg.name, pkg.version, pkg.manifest.publishConfig?.registry)) return { type: "skipped" };
|
|
267
276
|
if (client === "bun") {
|
|
268
277
|
for (const script of [
|
|
269
278
|
"prepublishOnly",
|
package/dist/plugins/git.d.ts
CHANGED
package/dist/plugins/git.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as isCI, n as execFailure } from "../error-
|
|
1
|
+
import { a as isCI, n as execFailure } from "../error-D3dwQnwR.js";
|
|
2
2
|
import { x } from "tinyexec";
|
|
3
3
|
//#region src/plugins/git.ts
|
|
4
4
|
/**
|
|
@@ -9,11 +9,12 @@ import { x } from "tinyexec";
|
|
|
9
9
|
*/
|
|
10
10
|
function git(options = {}) {
|
|
11
11
|
const { createTags = true, pushTags = isCI() } = options;
|
|
12
|
-
function getPendingTags(plan
|
|
12
|
+
function getPendingTags(plan) {
|
|
13
13
|
const pendingTags = /* @__PURE__ */ new Set();
|
|
14
14
|
if ((plan.options.dryRun ?? false) || !createTags) return pendingTags;
|
|
15
15
|
for (const pkg of plan.packages.values()) {
|
|
16
|
-
if (
|
|
16
|
+
if (!pkg.preflight.shouldPublish) continue;
|
|
17
|
+
if (pkg.publishResult && pkg.publishResult.type === "failed") continue;
|
|
17
18
|
const tag = pkg.git?.tag;
|
|
18
19
|
if (tag) pendingTags.add(tag);
|
|
19
20
|
}
|
|
@@ -49,26 +50,22 @@ function git(options = {}) {
|
|
|
49
50
|
}
|
|
50
51
|
},
|
|
51
52
|
async resolvePlanStatus({ plan }) {
|
|
52
|
-
const pendingTags = getPendingTags(plan
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
if (!await gitTagExists(this.cwd, tag)) throw "pending";
|
|
57
|
-
}));
|
|
58
|
-
} catch (e) {
|
|
59
|
-
if (e === "pending") return "pending";
|
|
60
|
-
throw e;
|
|
61
|
-
}
|
|
53
|
+
const pendingTags = getPendingTags(plan);
|
|
54
|
+
return Array.from(pendingTags, async (tag) => {
|
|
55
|
+
if (!await gitTagExists(this.cwd, tag)) return "pending";
|
|
56
|
+
});
|
|
62
57
|
},
|
|
63
58
|
async afterPublishAll({ plan }) {
|
|
64
59
|
const { cwd } = this;
|
|
65
60
|
const createdTags = [];
|
|
66
|
-
const pendingTags = getPendingTags(plan
|
|
61
|
+
const pendingTags = getPendingTags(plan);
|
|
67
62
|
if (pendingTags.size === 0) return;
|
|
68
63
|
await Promise.all(Array.from(pendingTags, async (tag) => {
|
|
69
|
-
if (await gitTagExists(cwd, tag)) return;
|
|
70
64
|
const gitOut = await x("git", ["tag", tag], { nodeOptions: { cwd } });
|
|
71
|
-
if (gitOut.exitCode !== 0)
|
|
65
|
+
if (gitOut.exitCode !== 0) {
|
|
66
|
+
if (/already exists/i.test(`${gitOut.stdout}\n${gitOut.stderr}`)) return;
|
|
67
|
+
throw execFailure(`Failed to create Git tag "${tag}" for release`, gitOut);
|
|
68
|
+
}
|
|
72
69
|
createdTags.push(tag);
|
|
73
70
|
}));
|
|
74
71
|
if (pushTags && createdTags.length > 0) {
|
package/dist/plugins/github.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as WorkspacePackage, b as TegamiContext, p as PublishPlan, s as TegamiPlugin, t as Awaitable, w as Draft } from "../types-
|
|
1
|
+
import { C as WorkspacePackage, b as TegamiContext, p as PublishPlan, s as TegamiPlugin, t as Awaitable, w as Draft } from "../types-DKeF_CDv.js";
|
|
2
2
|
import { GitPluginOptions } from "./git.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugins/github.d.ts
|
package/dist/plugins/github.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as formatPackageVersion, r as formatNpmDistTag } from "../semver-EKJ8yK5U.js";
|
|
2
|
-
import { a as isCI, n as execFailure } from "../error-
|
|
2
|
+
import { a as isCI, n as execFailure } from "../error-D3dwQnwR.js";
|
|
3
3
|
import { a as findOpenPullRequest, l as updatePullRequest, n as createPullRequest, r as createRelease, s as releaseExistsByTag } from "../api-D-jf_8xY.js";
|
|
4
4
|
import { git } from "./git.js";
|
|
5
5
|
import { join, relative } from "node:path";
|
|
@@ -67,42 +67,27 @@ function github(options = {}) {
|
|
|
67
67
|
const { repo, token } = this.github;
|
|
68
68
|
if (!repo || !token || releaseOptions === false) return;
|
|
69
69
|
const requiredTags = /* @__PURE__ */ new Set();
|
|
70
|
-
for (const pkg of plan.packages.values()) if (pkg.preflight.
|
|
71
|
-
|
|
72
|
-
await
|
|
73
|
-
|
|
74
|
-
}));
|
|
75
|
-
} catch (e) {
|
|
76
|
-
if (e === "pending") return "pending";
|
|
77
|
-
throw e;
|
|
78
|
-
}
|
|
70
|
+
for (const pkg of plan.packages.values()) if (pkg.preflight.shouldPublish && pkg.git?.tag) requiredTags.add(pkg.git.tag);
|
|
71
|
+
return Array.from(requiredTags, async (tag) => {
|
|
72
|
+
if (!await releaseExistsByTag(repo, tag, token)) return "pending";
|
|
73
|
+
});
|
|
79
74
|
},
|
|
80
75
|
async afterPublishAll({ plan }) {
|
|
81
76
|
const { repo, token } = this.github;
|
|
82
77
|
if (!repo || !token || releaseOptions === false) return;
|
|
83
78
|
const { eager = false, create, createGrouped } = releaseOptions === true ? {} : releaseOptions;
|
|
84
79
|
const groups = /* @__PURE__ */ new Map();
|
|
85
|
-
for (const [id,
|
|
80
|
+
for (const [id, { preflight, publishResult, git }] of plan.packages) {
|
|
81
|
+
if (!eager && publishResult.type === "failed") return;
|
|
82
|
+
const tag = git?.tag;
|
|
83
|
+
if (!tag || !preflight.shouldPublish) continue;
|
|
86
84
|
const pkg = this.graph.get(id);
|
|
87
|
-
if (!eager && packagePlan.publishResult.type === "failed") return;
|
|
88
|
-
const tag = packagePlan.git?.tag;
|
|
89
|
-
if (!tag) continue;
|
|
90
85
|
const group = groups.get(tag);
|
|
91
86
|
if (group) group.push(pkg);
|
|
92
87
|
else groups.set(tag, [pkg]);
|
|
93
88
|
}
|
|
94
89
|
await Promise.all(Array.from(groups, async ([tag, packages]) => {
|
|
95
|
-
|
|
96
|
-
let hasPublished = false;
|
|
97
|
-
for (const member of packages) switch (plan.packages.get(member.id).publishResult.type) {
|
|
98
|
-
case "published":
|
|
99
|
-
hasPublished = true;
|
|
100
|
-
break;
|
|
101
|
-
case "failed":
|
|
102
|
-
hasFailed = true;
|
|
103
|
-
break;
|
|
104
|
-
}
|
|
105
|
-
if (hasFailed || !hasPublished) return;
|
|
90
|
+
for (const member of packages) if (plan.packages.get(member.id).publishResult.type === "failed") return;
|
|
106
91
|
if (await releaseExistsByTag(repo, tag, token)) return;
|
|
107
92
|
let release;
|
|
108
93
|
if (packages.length > 1) {
|
package/dist/plugins/go.d.ts
CHANGED
package/dist/plugins/go.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as isNodeError, n as execFailure } from "../error-
|
|
1
|
+
import { i as isNodeError, n as execFailure } from "../error-D3dwQnwR.js";
|
|
2
2
|
import { n as WorkspacePackage } from "../graph-gThXu8Cz.js";
|
|
3
3
|
import { relative, resolve } from "node:path";
|
|
4
4
|
import { x } from "tinyexec";
|
|
@@ -147,13 +147,21 @@ function go({ updateLockFile = true, bumpDep: getBumpDepType } = {}) {
|
|
|
147
147
|
wait.push(linked.id);
|
|
148
148
|
}
|
|
149
149
|
return {
|
|
150
|
-
|
|
150
|
+
shouldPublish: true,
|
|
151
151
|
wait
|
|
152
152
|
};
|
|
153
153
|
},
|
|
154
|
+
resolvePlanStatus({ plan }) {
|
|
155
|
+
return Array.from(plan.packages, async ([id, { preflight }]) => {
|
|
156
|
+
if (!preflight.shouldPublish) return;
|
|
157
|
+
const pkg = this.graph.get(id);
|
|
158
|
+
if (!(pkg instanceof GoPackage)) return;
|
|
159
|
+
if (!await isModulePublished(pkg.name, pkg.version)) return "pending";
|
|
160
|
+
});
|
|
161
|
+
},
|
|
154
162
|
async publish({ pkg }) {
|
|
155
163
|
if (!(pkg instanceof GoPackage)) return;
|
|
156
|
-
return { type: "published" };
|
|
164
|
+
return { type: await isModulePublished(pkg.name, pkg.version) ? "skipped" : "published" };
|
|
157
165
|
},
|
|
158
166
|
cli: { async draftApplied() {
|
|
159
167
|
if (!active || !updateLockFile) return;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { g as cargo, h as CargoPluginOptions, m as CargoPackage } from "../types-
|
|
1
|
+
import { g as cargo, h as CargoPluginOptions, m as CargoPackage } from "../types-DKeF_CDv.js";
|
|
2
2
|
export { CargoPackage, CargoPluginOptions, cargo };
|
package/dist/providers/cargo.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as isNodeError, n as execFailure } from "../error-
|
|
1
|
+
import { i as isNodeError, n as execFailure } from "../error-D3dwQnwR.js";
|
|
2
2
|
import { n as WorkspacePackage } from "../graph-gThXu8Cz.js";
|
|
3
3
|
import { readFile, writeFile } from "node:fs/promises";
|
|
4
4
|
import { join, normalize } from "node:path";
|
|
@@ -76,17 +76,28 @@ function cargo({ updateLockFile = true, bumpDep: getBumpDepType } = {}) {
|
|
|
76
76
|
wait.push(id);
|
|
77
77
|
}
|
|
78
78
|
return {
|
|
79
|
-
|
|
79
|
+
shouldPublish: pkg.version !== void 0 && pkg.packageInfo.publish !== false,
|
|
80
80
|
wait
|
|
81
81
|
};
|
|
82
82
|
},
|
|
83
|
+
resolvePlanStatus({ plan }) {
|
|
84
|
+
return Array.from(plan.packages, async ([id, { preflight }]) => {
|
|
85
|
+
if (!preflight.shouldPublish) return;
|
|
86
|
+
const pkg = this.graph.get(id);
|
|
87
|
+
if (!(pkg instanceof CargoPackage) || !pkg.version) return;
|
|
88
|
+
if (!await isPackagePublished(pkg.name, pkg.version)) return "pending";
|
|
89
|
+
});
|
|
90
|
+
},
|
|
83
91
|
async publish({ pkg }) {
|
|
84
92
|
if (!(pkg instanceof CargoPackage)) return;
|
|
85
93
|
const result = await x("cargo", ["publish"], { nodeOptions: { cwd: pkg.path } });
|
|
86
|
-
if (result.exitCode !== 0)
|
|
87
|
-
type: "
|
|
88
|
-
|
|
89
|
-
|
|
94
|
+
if (result.exitCode !== 0) {
|
|
95
|
+
if (/already exists|already published/i.test(`${result.stdout}\n${result.stderr}`)) return { type: "skipped" };
|
|
96
|
+
return {
|
|
97
|
+
type: "failed",
|
|
98
|
+
error: execFailure(`Failed to publish ${pkg.name}@${pkg.version}.`, result).message
|
|
99
|
+
};
|
|
100
|
+
}
|
|
90
101
|
return { type: "published" };
|
|
91
102
|
},
|
|
92
103
|
async applyDraft(draft) {
|
package/dist/providers/npm.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as NpmPackage, v as NpmPluginOptions, y as npm } from "../types-
|
|
1
|
+
import { _ as NpmPackage, v as NpmPluginOptions, y as npm } from "../types-DKeF_CDv.js";
|
|
2
2
|
export { NpmPackage, NpmPluginOptions, npm };
|
package/dist/providers/npm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as npm, t as NpmPackage } from "../npm-
|
|
1
|
+
import { n as npm, t as NpmPackage } from "../npm-B_43doHi.js";
|
|
2
2
|
export { NpmPackage, npm };
|
|
@@ -420,7 +420,11 @@ interface TegamiPlugin {
|
|
|
420
420
|
lock: PublishLock;
|
|
421
421
|
plan: PublishPlan;
|
|
422
422
|
}): Awaitable<void>;
|
|
423
|
-
/**
|
|
423
|
+
/**
|
|
424
|
+
* Collect data before publishing a package.
|
|
425
|
+
*
|
|
426
|
+
* If multiple plugins return preflight data for the same package, only the first plugin will be considered.
|
|
427
|
+
*/
|
|
424
428
|
publishPreflight?(this: TegamiContext, opts: {
|
|
425
429
|
pkg: WorkspacePackage;
|
|
426
430
|
plan: PublishPlan;
|
|
@@ -437,7 +441,7 @@ interface TegamiPlugin {
|
|
|
437
441
|
*/
|
|
438
442
|
resolvePlanStatus?(this: TegamiContext, opts: {
|
|
439
443
|
plan: PublishPlan;
|
|
440
|
-
}): Awaitable<"success" | "pending" | undefined | void>;
|
|
444
|
+
}): Awaitable<"success" | "pending" | undefined | void | Awaitable<"success" | "pending" | undefined>[]>;
|
|
441
445
|
/** Called before a package will be published, return `false` to prevent from publishing. */
|
|
442
446
|
willPublish?(this: TegamiContext, opts: {
|
|
443
447
|
pkg: WorkspacePackage;
|
|
@@ -460,8 +464,12 @@ interface TegamiPlugin {
|
|
|
460
464
|
}
|
|
461
465
|
type Awaitable<T> = T | Promise<T>;
|
|
462
466
|
interface PublishPreflight {
|
|
463
|
-
/**
|
|
464
|
-
|
|
467
|
+
/**
|
|
468
|
+
* Whether the package should be published, the state **must not** be changed across different runs.
|
|
469
|
+
*
|
|
470
|
+
* To note if the package is already published, hook `resolvePlanStatus` on plugins, or skip at publish-time.
|
|
471
|
+
*/
|
|
472
|
+
shouldPublish: boolean;
|
|
465
473
|
/**
|
|
466
474
|
* Package ids that must be published before this one, this will automatically disallow circular dependency.
|
|
467
475
|
*
|