tegami 1.0.0-beta.0 → 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.js +10 -6
- package/dist/{generate-OZFKzXnu.js → generate-BqkwhjRy.js} +1 -1
- package/dist/generators/simple.d.ts +1 -1
- package/dist/generators/simple.js +1 -1
- package/dist/{graph-OnX9ncdQ.js → graph-gThXu8Cz.js} +2 -1
- package/dist/{index-B4ehnvrS.d.ts → index-CH40idD8.d.ts} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +16 -12
- package/dist/{npm-Q0qvAkIu.js → npm-DqGyAsdo.js} +16 -16
- package/dist/plugins/git.d.ts +1 -1
- package/dist/plugins/git.js +4 -5
- package/dist/plugins/github.d.ts +1 -1
- package/dist/plugins/github.js +18 -11
- package/dist/plugins/go.d.ts +1 -1
- package/dist/plugins/go.js +10 -8
- package/dist/providers/cargo.d.ts +1 -1
- package/dist/providers/cargo.js +11 -10
- package/dist/providers/npm.d.ts +1 -1
- package/dist/providers/npm.js +1 -1
- package/dist/{semver-jcIUAvbl.js → semver-EKJ8yK5U.js} +4 -1
- package/dist/{types-DnCUr2dB.d.ts → types-BbDtPn8I.d.ts} +7 -6
- 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-BbDtPn8I.js";
|
|
2
|
+
import { n as Tegami } from "../index-CH40idD8.js";
|
|
3
3
|
import { Command } from "commander";
|
|
4
4
|
|
|
5
5
|
//#region src/cli/index.d.ts
|
package/dist/cli/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as formatNpmDistTag } from "../semver-
|
|
2
|
-
import { i as renderChangelog, n as generateFromCommits, t as changelogFilename } from "../generate-
|
|
1
|
+
import { r as formatNpmDistTag } from "../semver-EKJ8yK5U.js";
|
|
2
|
+
import { i as renderChangelog, n as generateFromCommits, t as changelogFilename } from "../generate-BqkwhjRy.js";
|
|
3
3
|
import { a as isCI, n as execFailure, r as handlePluginError, t as CancelledError } from "../error-DNy8R5ue.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";
|
|
@@ -287,12 +287,14 @@ async function buildPrPreview(context, draft, options = {}) {
|
|
|
287
287
|
const pendingPackages = [];
|
|
288
288
|
for (const pkg of context.graph.getPackages()) {
|
|
289
289
|
const plan = draft.getPackageDraft(pkg.id);
|
|
290
|
-
if (!plan
|
|
290
|
+
if (!plan) continue;
|
|
291
|
+
const bumped = plan.bumpVersion(pkg);
|
|
292
|
+
if (!bumped || !pkg.version || bumped === pkg.version) continue;
|
|
291
293
|
pendingPackages.push({
|
|
292
294
|
name: pkg.name,
|
|
293
295
|
type: plan.type ?? "—",
|
|
294
296
|
from: pkg.version,
|
|
295
|
-
to:
|
|
297
|
+
to: bumped,
|
|
296
298
|
distTag: plan.npm?.distTag
|
|
297
299
|
});
|
|
298
300
|
}
|
|
@@ -504,8 +506,10 @@ async function versionPackages(tegami, options) {
|
|
|
504
506
|
const lines = [];
|
|
505
507
|
for (const pkg of context.graph.getPackages()) {
|
|
506
508
|
const plan = draft.getPackageDraft(pkg.id);
|
|
507
|
-
if (!plan
|
|
508
|
-
|
|
509
|
+
if (!plan) continue;
|
|
510
|
+
const bumped = plan.bumpVersion(pkg);
|
|
511
|
+
if (!pkg.version || !bumped || bumped === pkg.version) continue;
|
|
512
|
+
lines.push(`${pkg.id}: ${pkg.version} → ${bumped} (${plan.changelogs?.length ?? 0} changelogs)`);
|
|
509
513
|
if (plan.bumpReasons) for (const reason of plan.bumpReasons) lines.push(` - ${reason}`);
|
|
510
514
|
}
|
|
511
515
|
note(lines.join("\n"), "Release plan");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as bumpVersion } from "./semver-
|
|
1
|
+
import { n as bumpVersion } from "./semver-EKJ8yK5U.js";
|
|
2
2
|
//#region src/graph.ts
|
|
3
3
|
/** Package discovered in the workspace. */
|
|
4
4
|
var WorkspacePackage = class {
|
|
@@ -16,6 +16,7 @@ var WorkspacePackage = class {
|
|
|
16
16
|
/** create the initial draft. */
|
|
17
17
|
initDraft() {
|
|
18
18
|
return { bumpVersion(pkg) {
|
|
19
|
+
if (!pkg.version) return;
|
|
19
20
|
return bumpVersion(pkg.version, this.type, this.prerelease);
|
|
20
21
|
} };
|
|
21
22
|
}
|
|
@@ -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-BbDtPn8I.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-BbDtPn8I.js";
|
|
2
|
+
import { i as CommitChangelog, n as Tegami, r as tegami, t as GenerateChangelogOptions } from "./index-CH40idD8.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,13 +1,13 @@
|
|
|
1
|
-
import { a as maxBump } from "./semver-
|
|
2
|
-
import { n as generateFromCommits, r as changelogFrontmatterSchema } from "./generate-
|
|
1
|
+
import { a as maxBump } from "./semver-EKJ8yK5U.js";
|
|
2
|
+
import { n as generateFromCommits, r as changelogFrontmatterSchema } from "./generate-BqkwhjRy.js";
|
|
3
3
|
import { r as handlePluginError } from "./error-DNy8R5ue.js";
|
|
4
|
-
import { t as PackageGraph } from "./graph-
|
|
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-DqGyAsdo.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";
|
|
10
|
-
import * as semver from "semver";
|
|
10
|
+
import * as semver$1 from "semver";
|
|
11
11
|
import z from "zod";
|
|
12
12
|
import { dump, load, visit } from "js-yaml";
|
|
13
13
|
import { fromMarkdown } from "mdast-util-from-markdown";
|
|
@@ -335,6 +335,7 @@ var Draft = class {
|
|
|
335
335
|
}
|
|
336
336
|
return false;
|
|
337
337
|
}
|
|
338
|
+
/** get all changelogs, note that this includes replay-only changelogs, as long as they are in the `.tegami` folder. */
|
|
338
339
|
getChangelogs() {
|
|
339
340
|
return Array.from(this.changelogs.values());
|
|
340
341
|
}
|
|
@@ -381,20 +382,23 @@ var Draft = class {
|
|
|
381
382
|
/** write persistent data to publish lock */
|
|
382
383
|
async writeLockFile(snapshots) {
|
|
383
384
|
const lock = new PublishLock();
|
|
384
|
-
|
|
385
|
-
v: "0.0.0",
|
|
386
|
-
filename: entry.filename,
|
|
387
|
-
content: entry.getRawContent()
|
|
388
|
-
});
|
|
385
|
+
const changelogs = /* @__PURE__ */ new Set();
|
|
389
386
|
for (const pkg of this.context.graph.getPackages()) {
|
|
390
387
|
const draft = this.getPackageDraft(pkg.id);
|
|
391
388
|
const snapshot = snapshots.get(pkg.id);
|
|
389
|
+
if (!snapshot) continue;
|
|
390
|
+
for (const entry of draft?.changelogs ?? []) changelogs.add(entry);
|
|
392
391
|
lock.write("core:packages", {
|
|
393
392
|
id: pkg.id,
|
|
394
|
-
updated: draft !== void 0 &&
|
|
393
|
+
updated: draft !== void 0 && snapshot.version !== pkg.version,
|
|
395
394
|
changelogIds: draft?.changelogs?.map((entry) => entry.id)
|
|
396
395
|
});
|
|
397
396
|
}
|
|
397
|
+
for (const entry of changelogs) lock.write("core:changelogs", {
|
|
398
|
+
v: "0.0.0",
|
|
399
|
+
filename: entry.filename,
|
|
400
|
+
content: entry.getRawContent()
|
|
401
|
+
});
|
|
398
402
|
for (const plugin of this.context.plugins) await handlePluginError(plugin, "initPublishLock", () => plugin.initPublishLock?.call(this.context, {
|
|
399
403
|
lock,
|
|
400
404
|
draft: this
|
|
@@ -424,7 +428,7 @@ var Draft = class {
|
|
|
424
428
|
const isMatch = (condition) => {
|
|
425
429
|
if (condition.type === "on-exit-prerelease") return graph.getByName(condition.name).some((pkg) => {
|
|
426
430
|
const previous = snapshots.get(pkg.id);
|
|
427
|
-
return previous && semver.inc(previous.version, "release") === pkg.version;
|
|
431
|
+
return previous?.version && semver$1.inc(previous.version, "release") === pkg.version;
|
|
428
432
|
});
|
|
429
433
|
return graph.getByName(condition.name).some((pkg) => pkg.version === condition.version);
|
|
430
434
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { i as isNodeError, n as execFailure } from "./error-DNy8R5ue.js";
|
|
2
|
-
import { n as WorkspacePackage } from "./graph-
|
|
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";
|
|
5
5
|
import { x } from "tinyexec";
|
|
6
|
-
import * as semver from "semver";
|
|
6
|
+
import * as semver$1 from "semver";
|
|
7
7
|
import z from "zod";
|
|
8
8
|
import { load } from "js-yaml";
|
|
9
9
|
import { glob } from "tinyglobby";
|
|
@@ -48,7 +48,7 @@ var NpmPackage = class extends WorkspacePackage {
|
|
|
48
48
|
return this.manifest.name;
|
|
49
49
|
}
|
|
50
50
|
get version() {
|
|
51
|
-
return this.manifest.version
|
|
51
|
+
return this.manifest.version;
|
|
52
52
|
}
|
|
53
53
|
async write() {
|
|
54
54
|
await writeFile(path.join(this.path, "package.json"), `${JSON.stringify(this.manifest, null, 2)}\n`);
|
|
@@ -139,7 +139,7 @@ function npm({ client: defaultClient, onBreakPeerDep = "set", updateLockFile = t
|
|
|
139
139
|
},
|
|
140
140
|
async publishPreflight({ pkg }) {
|
|
141
141
|
if (!(pkg instanceof NpmPackage)) return;
|
|
142
|
-
return { publish: pkg.manifest.private !== true && !await isPackagePublished(pkg) };
|
|
142
|
+
return { publish: pkg.version !== void 0 && pkg.manifest.private !== true && !await isPackagePublished(pkg.name, pkg.version, pkg.manifest.publishConfig?.registry) };
|
|
143
143
|
},
|
|
144
144
|
initPublishLock({ lock, draft }) {
|
|
145
145
|
for (const [id, pkg] of draft.getPackageDrafts()) {
|
|
@@ -174,8 +174,8 @@ function npm({ client: defaultClient, onBreakPeerDep = "set", updateLockFile = t
|
|
|
174
174
|
const writes = [];
|
|
175
175
|
for (const pkg of graph.getPackages()) {
|
|
176
176
|
if (!(pkg instanceof NpmPackage)) continue;
|
|
177
|
-
const
|
|
178
|
-
if (
|
|
177
|
+
const bumped = draft.getPackageDraft(pkg.id)?.bumpVersion(pkg);
|
|
178
|
+
if (bumped) pkg.manifest.version = bumped;
|
|
179
179
|
}
|
|
180
180
|
for (const pkg of graph.getPackages()) {
|
|
181
181
|
if (!(pkg instanceof NpmPackage)) continue;
|
|
@@ -185,8 +185,8 @@ function npm({ client: defaultClient, onBreakPeerDep = "set", updateLockFile = t
|
|
|
185
185
|
for (const [k, v] of Object.entries(dependencies)) {
|
|
186
186
|
const spec = parseDependencySpec(this, pkg, k, v);
|
|
187
187
|
if (!spec?.linked || spec.protocol === "workspace" || spec.protocol === "file") continue;
|
|
188
|
-
if (!semver.validRange(spec.range)) continue;
|
|
189
|
-
if (semver.satisfies(spec.linked.version, spec.range)) continue;
|
|
188
|
+
if (!semver$1.validRange(spec.range)) continue;
|
|
189
|
+
if (!spec.linked.version || semver$1.satisfies(spec.linked.version, spec.range)) continue;
|
|
190
190
|
let updatedRange;
|
|
191
191
|
const isPeer = field === "peerDependencies";
|
|
192
192
|
if (isPeer && onBreakPeerDep === "ignore") continue;
|
|
@@ -224,11 +224,11 @@ function depsPolicy(context, getBumpDepType) {
|
|
|
224
224
|
case "":
|
|
225
225
|
case "*": return true;
|
|
226
226
|
case "^":
|
|
227
|
-
case "~": return !semver.satisfies(target, `${spec.range}${spec.linked.version}`);
|
|
227
|
+
case "~": return !semver$1.satisfies(target, `${spec.range}${spec.linked.version}`);
|
|
228
228
|
}
|
|
229
229
|
if (spec.linked && spec.protocol === "file") return true;
|
|
230
|
-
if (spec.protocol === "file" || !semver.validRange(spec.range)) return false;
|
|
231
|
-
return !semver.satisfies(target, spec.range);
|
|
230
|
+
if (spec.protocol === "file" || !semver$1.validRange(spec.range)) return false;
|
|
231
|
+
return !semver$1.satisfies(target, spec.range);
|
|
232
232
|
}
|
|
233
233
|
return {
|
|
234
234
|
id: "npm:deps",
|
|
@@ -244,7 +244,8 @@ function depsPolicy(context, getBumpDepType) {
|
|
|
244
244
|
const spec = parseDependencySpec(context, dependent, k, v);
|
|
245
245
|
if (!spec || spec.linked !== pkg) continue;
|
|
246
246
|
if (group?.options.syncBump && graph.getPackageGroup(dependent.id) === group) continue;
|
|
247
|
-
|
|
247
|
+
const bumped = plan.bumpVersion(pkg);
|
|
248
|
+
if (!bumped || !needsUpdate(spec, bumped)) continue;
|
|
248
249
|
const bumpType = getBumpDepType({
|
|
249
250
|
kind: field,
|
|
250
251
|
dependent,
|
|
@@ -312,12 +313,11 @@ async function publish(client, pkg, distTag) {
|
|
|
312
313
|
};
|
|
313
314
|
return { type: "published" };
|
|
314
315
|
}
|
|
315
|
-
async function isPackagePublished(
|
|
316
|
-
const registry = pkg.manifest.publishConfig?.registry ?? "https://registry.npmjs.org";
|
|
316
|
+
async function isPackagePublished(name, version, registry = "https://registry.npmjs.org") {
|
|
317
317
|
const base = registry.replace(/\/$/, "");
|
|
318
|
-
const response = await fetch(`${base}/${
|
|
318
|
+
const response = await fetch(`${base}/${name}/${version}`, { headers: { Accept: "application/json" } });
|
|
319
319
|
if (response.status === 404) return false;
|
|
320
|
-
if (!response.ok) throw new Error(`Unable to validate ${
|
|
320
|
+
if (!response.ok) throw new Error(`Unable to validate ${name}@${version} against the npm registry${registry ? ` "${registry}"` : ""}.`);
|
|
321
321
|
return true;
|
|
322
322
|
}
|
|
323
323
|
async function discoverNpmPackages(cwd, add) {
|
package/dist/plugins/git.d.ts
CHANGED
package/dist/plugins/git.js
CHANGED
|
@@ -42,11 +42,10 @@ function git(options = {}) {
|
|
|
42
42
|
const { graph } = this;
|
|
43
43
|
for (const [id, packagePlan] of plan.packages) {
|
|
44
44
|
const pkg = graph.get(id);
|
|
45
|
-
const group =
|
|
46
|
-
|
|
47
|
-
if (group?.options.syncGitTag) tag = `${group.name}@${pkg.version}`;
|
|
48
|
-
else tag = `${pkg.name}@${pkg.version}`;
|
|
49
|
-
packagePlan.git = { tag };
|
|
45
|
+
const group = graph.getPackageGroup(pkg.id);
|
|
46
|
+
packagePlan.git ??= {};
|
|
47
|
+
if (group?.options.syncGitTag && pkg.version) packagePlan.git.tag = `${group.name}@${pkg.version}`;
|
|
48
|
+
else if (pkg.version) packagePlan.git.tag = `${pkg.name}@${pkg.version}`;
|
|
50
49
|
}
|
|
51
50
|
},
|
|
52
51
|
async resolvePlanStatus({ plan }) {
|
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-BbDtPn8I.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,10 +1,10 @@
|
|
|
1
|
-
import { i as formatPackageVersion, r as formatNpmDistTag } from "../semver-
|
|
1
|
+
import { i as formatPackageVersion, r as formatNpmDistTag } from "../semver-EKJ8yK5U.js";
|
|
2
2
|
import { a as isCI, n as execFailure } from "../error-DNy8R5ue.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";
|
|
6
6
|
import { x } from "tinyexec";
|
|
7
|
-
import
|
|
7
|
+
import semver from "semver";
|
|
8
8
|
//#region src/plugins/github.ts
|
|
9
9
|
/** Create GitHub releases for successfully published packages after the whole plan succeeds. */
|
|
10
10
|
function github(options = {}) {
|
|
@@ -21,16 +21,23 @@ function github(options = {}) {
|
|
|
21
21
|
}
|
|
22
22
|
function defaultVersionPRBody(draft, context) {
|
|
23
23
|
const packageLines = [];
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
const changesets = /* @__PURE__ */ new Map();
|
|
25
|
+
for (const [id, packageDraft] of draft.getPackageDrafts()) {
|
|
26
|
+
const pkg = context.graph.get(id);
|
|
27
|
+
if (!pkg) continue;
|
|
28
|
+
for (const entry of packageDraft.changelogs ?? []) {
|
|
29
|
+
const list = changesets.get(entry);
|
|
30
|
+
if (list) list.push(pkg);
|
|
31
|
+
else changesets.set(entry, [pkg]);
|
|
32
|
+
}
|
|
33
|
+
const originalVersion = cliOriginalPackageVersions.get(pkg.id);
|
|
34
|
+
if (!originalVersion || originalVersion === pkg.version) continue;
|
|
29
35
|
packageLines.push(`| \`${pkg.name}\` | \`${originalVersion}\` | \`${pkg.version}\`${formatNpmDistTag(packageDraft.npm?.distTag)} |`);
|
|
30
36
|
}
|
|
31
37
|
const changelogLines = [];
|
|
32
|
-
for (const entry of
|
|
38
|
+
for (const [entry, linkedPackages] of changesets) {
|
|
33
39
|
changelogLines.push(`### ${entry.subject ?? `\`${entry.filename}\``}`, "");
|
|
40
|
+
changelogLines.push("<details>", `<summary>Show Bumped Packages (${linkedPackages.length})</summary>`, "", ...linkedPackages.map((pkg) => `- \`${pkg.id}\``), "", "</details>", "");
|
|
34
41
|
for (const section of entry.sections) {
|
|
35
42
|
changelogLines.push(`#### ${section.title}`, "");
|
|
36
43
|
if (section.content) changelogLines.push(section.content);
|
|
@@ -60,7 +67,7 @@ function github(options = {}) {
|
|
|
60
67
|
const { repo, token } = this.github;
|
|
61
68
|
if (!repo || !token || releaseOptions === false) return;
|
|
62
69
|
const requiredTags = /* @__PURE__ */ new Set();
|
|
63
|
-
for (const pkg of plan.packages.values()) if (pkg.preflight.publish && pkg.git) requiredTags.add(pkg.git.tag);
|
|
70
|
+
for (const pkg of plan.packages.values()) if (pkg.preflight.publish && pkg.git?.tag) requiredTags.add(pkg.git.tag);
|
|
64
71
|
try {
|
|
65
72
|
await Promise.all(Array.from(requiredTags, async (tag) => {
|
|
66
73
|
if (!await releaseExistsByTag(repo, tag, token)) throw "pending";
|
|
@@ -107,7 +114,7 @@ function github(options = {}) {
|
|
|
107
114
|
release = {
|
|
108
115
|
title: overrides.title ?? tag,
|
|
109
116
|
notes: overrides.notes ?? await defaultGroupedNotes(getRenderer(this), plan, packages),
|
|
110
|
-
prerelease: overrides.prerelease ?? packages.some((pkg) => prerelease(pkg.version)
|
|
117
|
+
prerelease: overrides.prerelease ?? packages.some((pkg) => pkg.version && semver.prerelease(pkg.version))
|
|
111
118
|
};
|
|
112
119
|
} else {
|
|
113
120
|
const pkg = packages[0];
|
|
@@ -120,7 +127,7 @@ function github(options = {}) {
|
|
|
120
127
|
release = {
|
|
121
128
|
title: overrides.title ?? formatPackageVersion(pkg.name, pkg.version, packagePlan?.npm?.distTag),
|
|
122
129
|
notes: overrides.notes ?? await defaultNotes(getRenderer(this), pkg, packagePlan),
|
|
123
|
-
prerelease: overrides.prerelease ?? prerelease(pkg.version) !== null
|
|
130
|
+
prerelease: overrides.prerelease ?? (pkg.version !== void 0 && semver.prerelease(pkg.version) !== null)
|
|
124
131
|
};
|
|
125
132
|
}
|
|
126
133
|
await createRelease(repo, {
|
package/dist/plugins/go.d.ts
CHANGED
package/dist/plugins/go.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { i as isNodeError, n as execFailure } from "../error-DNy8R5ue.js";
|
|
2
|
-
import { n as WorkspacePackage } from "../graph-
|
|
2
|
+
import { n as WorkspacePackage } from "../graph-gThXu8Cz.js";
|
|
3
3
|
import { relative, resolve } from "node:path";
|
|
4
4
|
import { x } from "tinyexec";
|
|
5
|
-
import * as semver from "semver";
|
|
5
|
+
import * as semver$1 from "semver";
|
|
6
6
|
import z from "zod";
|
|
7
7
|
//#region src/plugins/go.ts
|
|
8
8
|
const goWorkJsonSchema = z.object({ Use: z.array(z.object({
|
|
@@ -91,15 +91,15 @@ function go({ updateLockFile = true, bumpDep: getBumpDepType } = {}) {
|
|
|
91
91
|
const writes = [];
|
|
92
92
|
for (const pkg of graph.getPackages()) {
|
|
93
93
|
if (!(pkg instanceof GoPackage)) continue;
|
|
94
|
-
const
|
|
95
|
-
if (
|
|
94
|
+
const bumped = draft.getPackageDraft(pkg.id)?.bumpVersion(pkg);
|
|
95
|
+
if (bumped) pkg.setVersion(bumped);
|
|
96
96
|
}
|
|
97
97
|
for (const pkg of graph.getPackages()) {
|
|
98
98
|
if (!(pkg instanceof GoPackage)) continue;
|
|
99
99
|
for (const [moduleName, requireVersion] of pkg.mod.requires) {
|
|
100
100
|
const linked = graph.get(`go:${moduleName}`);
|
|
101
101
|
if (!linked || !(linked instanceof GoPackage)) continue;
|
|
102
|
-
if (semver.satisfies(linked.version, stripGoVersion(requireVersion))) continue;
|
|
102
|
+
if (semver$1.satisfies(linked.version, stripGoVersion(requireVersion))) continue;
|
|
103
103
|
pkg.setRequire(moduleName, linked.version);
|
|
104
104
|
}
|
|
105
105
|
writes.push(pkg.write());
|
|
@@ -129,7 +129,8 @@ function go({ updateLockFile = true, bumpDep: getBumpDepType } = {}) {
|
|
|
129
129
|
for (const [id, packagePlan] of plan.packages) {
|
|
130
130
|
const pkg = this.graph.get(id);
|
|
131
131
|
if (!(pkg instanceof GoPackage)) continue;
|
|
132
|
-
packagePlan.git
|
|
132
|
+
packagePlan.git ??= {};
|
|
133
|
+
packagePlan.git.tag = formatGoTag(this.cwd, pkg.path, pkg.version);
|
|
133
134
|
}
|
|
134
135
|
},
|
|
135
136
|
async publishPreflight({ pkg }) {
|
|
@@ -180,7 +181,8 @@ function depsPolicy({ graph }, getBumpDepType = () => "patch") {
|
|
|
180
181
|
for (const [moduleName, requireVersion] of dependent.mod.requires) {
|
|
181
182
|
if (pkg.id !== `go:${moduleName}`) continue;
|
|
182
183
|
if (group?.options.syncBump && graph.getPackageGroup(dependent.id) === group) continue;
|
|
183
|
-
|
|
184
|
+
const bumped = plan.bumpVersion(pkg);
|
|
185
|
+
if (!bumped || semver$1.satisfies(bumped, stripGoVersion(requireVersion))) continue;
|
|
184
186
|
const bumpType = getBumpDepType?.({
|
|
185
187
|
name: pkg.name,
|
|
186
188
|
dependent,
|
|
@@ -267,7 +269,7 @@ async function readLatestVersion(cwd, modulePath) {
|
|
|
267
269
|
}
|
|
268
270
|
function parseTagVersion(tag) {
|
|
269
271
|
const version = stripGoVersion(tag.slice(tag.lastIndexOf("/") + 1));
|
|
270
|
-
if (semver.valid(version)) return version;
|
|
272
|
+
if (semver$1.valid(version)) return version;
|
|
271
273
|
}
|
|
272
274
|
function formatGoTag(cwd, modulePath, version) {
|
|
273
275
|
const relativeDir = relative(cwd, modulePath).replaceAll("\\", "/");
|
|
@@ -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-BbDtPn8I.js";
|
|
2
2
|
export { CargoPackage, CargoPluginOptions, cargo };
|
package/dist/providers/cargo.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { i as isNodeError, n as execFailure } from "../error-DNy8R5ue.js";
|
|
2
|
-
import { n as WorkspacePackage } from "../graph-
|
|
2
|
+
import { n as WorkspacePackage } from "../graph-gThXu8Cz.js";
|
|
3
3
|
import { readFile, writeFile } from "node:fs/promises";
|
|
4
4
|
import { join, normalize } from "node:path";
|
|
5
5
|
import { x } from "tinyexec";
|
|
6
|
-
import * as semver from "semver";
|
|
6
|
+
import * as semver$1 from "semver";
|
|
7
7
|
import initToml, { edit, parse as parse$1 } from "@rainbowatcher/toml-edit-js";
|
|
8
8
|
import { glob } from "tinyglobby";
|
|
9
9
|
//#region src/providers/cargo.ts
|
|
@@ -29,7 +29,7 @@ var CargoPackage = class extends WorkspacePackage {
|
|
|
29
29
|
return this.packageInfo.name;
|
|
30
30
|
}
|
|
31
31
|
get version() {
|
|
32
|
-
return stringValue(this.packageInfo.version) ?? this.workspaceVersion
|
|
32
|
+
return stringValue(this.packageInfo.version) ?? this.workspaceVersion;
|
|
33
33
|
}
|
|
34
34
|
setVersion(version) {
|
|
35
35
|
this.packageInfo.version = version;
|
|
@@ -76,7 +76,7 @@ function cargo({ updateLockFile = true, bumpDep: getBumpDepType } = {}) {
|
|
|
76
76
|
wait.push(id);
|
|
77
77
|
}
|
|
78
78
|
return {
|
|
79
|
-
publish: pkg.packageInfo.publish !== false && !await isPackagePublished(pkg.name, pkg.version),
|
|
79
|
+
publish: pkg.version !== void 0 && pkg.packageInfo.publish !== false && !await isPackagePublished(pkg.name, pkg.version),
|
|
80
80
|
wait
|
|
81
81
|
};
|
|
82
82
|
},
|
|
@@ -95,18 +95,18 @@ function cargo({ updateLockFile = true, bumpDep: getBumpDepType } = {}) {
|
|
|
95
95
|
const writes = [];
|
|
96
96
|
for (const pkg of graph.getPackages()) {
|
|
97
97
|
if (!(pkg instanceof CargoPackage)) continue;
|
|
98
|
-
const
|
|
99
|
-
if (
|
|
98
|
+
const bumped = draft.getPackageDraft(pkg.id)?.bumpVersion(pkg);
|
|
99
|
+
if (bumped) pkg.setVersion(bumped);
|
|
100
100
|
}
|
|
101
101
|
for (const pkg of graph.getPackages()) {
|
|
102
102
|
if (!(pkg instanceof CargoPackage)) continue;
|
|
103
103
|
for (const { table, path: tablePath } of dependencyTables(pkg.manifest, "")) for (const [rawName, rawSpec] of Object.entries(table)) {
|
|
104
104
|
const spec = parseSpec(rawSpec);
|
|
105
|
-
if (!spec || !semver.validRange(spec.version)) continue;
|
|
105
|
+
if (!spec || !semver$1.validRange(spec.version)) continue;
|
|
106
106
|
const packageName = spec.package ?? rawName;
|
|
107
107
|
const linked = graph.get(`cargo:${packageName}`);
|
|
108
108
|
if (!linked || !(linked instanceof CargoPackage)) continue;
|
|
109
|
-
if (semver.satisfies(linked.version, spec.version)) continue;
|
|
109
|
+
if (!linked.version || semver$1.satisfies(linked.version, spec.version)) continue;
|
|
110
110
|
let updatedRange;
|
|
111
111
|
if (spec.version.startsWith("^")) updatedRange = `^${linked.version}`;
|
|
112
112
|
else if (spec.version.startsWith("~")) updatedRange = `~${linked.version}`;
|
|
@@ -141,10 +141,11 @@ function depsPolicy({ graph }, getBumpDepType = ({ kind }) => {
|
|
|
141
141
|
if (!(dependent instanceof CargoPackage)) continue;
|
|
142
142
|
for (const { table, kind } of dependencyTables(dependent.manifest, "")) for (const [rawName, rawSpec] of Object.entries(table)) {
|
|
143
143
|
const spec = parseSpec(rawSpec);
|
|
144
|
-
if (!spec || !semver.validRange(spec.version)) continue;
|
|
144
|
+
if (!spec || !semver$1.validRange(spec.version)) continue;
|
|
145
145
|
if (pkg.id !== `cargo:${spec.package ?? rawName}`) continue;
|
|
146
146
|
if (group?.options.syncBump && graph.getPackageGroup(dependent.id) === group) continue;
|
|
147
|
-
|
|
147
|
+
const bumped = plan.bumpVersion(pkg);
|
|
148
|
+
if (!bumped || semver$1.satisfies(bumped, spec.version)) continue;
|
|
148
149
|
const bumpType = getBumpDepType({
|
|
149
150
|
kind,
|
|
150
151
|
dependent,
|
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-BbDtPn8I.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-DqGyAsdo.js";
|
|
2
2
|
export { NpmPackage, npm };
|
|
@@ -4,7 +4,10 @@ function formatNpmDistTag(distTag) {
|
|
|
4
4
|
return distTag && distTag !== "latest" ? ` (${distTag})` : "";
|
|
5
5
|
}
|
|
6
6
|
function formatPackageVersion(name, version, distTag) {
|
|
7
|
-
|
|
7
|
+
let out = name;
|
|
8
|
+
if (version) out += `@${version}`;
|
|
9
|
+
out += formatNpmDistTag(distTag);
|
|
10
|
+
return out;
|
|
8
11
|
}
|
|
9
12
|
const WEIGHTS = {
|
|
10
13
|
major: 3,
|
|
@@ -42,8 +42,8 @@ interface PackageDraft {
|
|
|
42
42
|
npm?: {
|
|
43
43
|
/** npm dist-tag used when publishing. */distTag?: string;
|
|
44
44
|
};
|
|
45
|
-
/** get the bumped version of a package */
|
|
46
|
-
bumpVersion: (pkg: WorkspacePackage) => string;
|
|
45
|
+
/** get the bumped version of a package, return `undefined` if the package doesn't have a `version` field */
|
|
46
|
+
bumpVersion: (pkg: WorkspacePackage) => string | undefined;
|
|
47
47
|
}
|
|
48
48
|
/** a draft describes all operations to perform before the actual publishing, such as version bumps. */
|
|
49
49
|
declare class Draft {
|
|
@@ -67,6 +67,7 @@ declare class Draft {
|
|
|
67
67
|
dispatchPackage(pkg: WorkspacePackage, dispatch: (draft: PackageDraft) => void, onUpdate?: (draft: PackageDraft) => void): PackageDraft;
|
|
68
68
|
getOrInitPackage(pkg: WorkspacePackage): PackageDraft;
|
|
69
69
|
hasPending(): boolean;
|
|
70
|
+
/** get all changelogs, note that this includes replay-only changelogs, as long as they are in the `.tegami` folder. */
|
|
70
71
|
getChangelogs(): ChangelogEntry[];
|
|
71
72
|
getChangelog(id: string): ChangelogEntry | undefined;
|
|
72
73
|
addChangelog(entry: ChangelogEntry): void;
|
|
@@ -99,7 +100,7 @@ declare abstract class WorkspacePackage {
|
|
|
99
100
|
/** absolute path */
|
|
100
101
|
abstract readonly path: string;
|
|
101
102
|
abstract readonly manager: string;
|
|
102
|
-
abstract readonly version: string;
|
|
103
|
+
abstract readonly version: string | undefined;
|
|
103
104
|
get id(): string;
|
|
104
105
|
private opts;
|
|
105
106
|
/** note: this will only be available after package graph is resolved */
|
|
@@ -189,7 +190,7 @@ declare class NpmPackage extends WorkspacePackage {
|
|
|
189
190
|
readonly manager = "npm";
|
|
190
191
|
constructor(path: string, manifest: PackageManifest);
|
|
191
192
|
get name(): string;
|
|
192
|
-
get version(): string;
|
|
193
|
+
get version(): string | undefined;
|
|
193
194
|
write(): Promise<void>;
|
|
194
195
|
initDraft(): PackageDraft;
|
|
195
196
|
configureDraft(draft: PackageDraft, group?: PackageGroup): void;
|
|
@@ -258,7 +259,7 @@ declare class CargoPackage extends WorkspacePackage {
|
|
|
258
259
|
readonly manager = "cargo";
|
|
259
260
|
constructor(path: string, manifest: TomlTable, content: string, workspaceManifest?: TomlTable | undefined);
|
|
260
261
|
get name(): string;
|
|
261
|
-
get version(): string;
|
|
262
|
+
get version(): string | undefined;
|
|
262
263
|
setVersion(version: string): void;
|
|
263
264
|
write(): Promise<void>;
|
|
264
265
|
patch(path: string, value: unknown): void;
|
|
@@ -301,7 +302,7 @@ interface PackagePublishPlan {
|
|
|
301
302
|
updated: boolean;
|
|
302
303
|
/** generated by Git plugin */
|
|
303
304
|
git?: {
|
|
304
|
-
/** the associated Git tag of package */tag
|
|
305
|
+
/** the associated Git tag of package */tag?: string;
|
|
305
306
|
};
|
|
306
307
|
/** generated by npm plugin */
|
|
307
308
|
npm?: {
|