tegami 1.0.0-beta.5 → 1.0.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.
@@ -1,4 +1,4 @@
1
- import { i as isNodeError, n as execFailure } from "../error-We7chQVJ.js";
1
+ import { i as isNodeError, n as execFailure } from "../error-BhMYq9iW.js";
2
2
  import { n as WorkspacePackage } from "../graph-gThXu8Cz.js";
3
3
  import { relative, resolve } from "node:path";
4
4
  import { x } from "tinyexec";
@@ -66,7 +66,7 @@ const packageLockSchema = z.object({
66
66
  version: z.string()
67
67
  });
68
68
  /**
69
- * Experimental plugin for Golang, the release flow of Golang is pretty special, there's some exceptions for it:
69
+ * Plugin for Golang, the release flow of Golang is pretty special, there's some exceptions for it:
70
70
  *
71
71
  * - Version is stored in lock file, normally, it should prefer to store versions in a file like `package.json` & `Cargo.toml`, but for Golang, there is no such file.
72
72
  * - Publishing is handed to Git plugin, because Golang uses Git tag for publishing.
@@ -153,6 +153,7 @@ function go({ updateLockFile = true, bumpDep: getBumpDepType } = {}) {
153
153
  };
154
154
  },
155
155
  resolvePlanStatus({ plan }) {
156
+ if (!active) return;
156
157
  return Array.from(plan.packages, async ([id, { preflight }]) => {
157
158
  if (!preflight.shouldPublish) return;
158
159
  const pkg = this.graph.get(id);
@@ -180,29 +181,42 @@ function go({ updateLockFile = true, bumpDep: getBumpDepType } = {}) {
180
181
  };
181
182
  }
182
183
  function depsPolicy({ graph }, getBumpDepType = () => "patch") {
184
+ const dependentMap = /* @__PURE__ */ new Map();
185
+ for (const pkg of graph.getPackages()) {
186
+ if (!(pkg instanceof GoPackage)) continue;
187
+ for (const [name, version] of pkg.mod.requires) {
188
+ const id = `go:${name}`;
189
+ const refs = dependentMap.get(id);
190
+ if (refs) refs.push({
191
+ dependent: pkg,
192
+ name,
193
+ version
194
+ });
195
+ else dependentMap.set(id, [{
196
+ dependent: pkg,
197
+ name,
198
+ version
199
+ }]);
200
+ }
201
+ }
183
202
  return {
184
203
  id: "go:deps",
185
204
  onUpdate({ pkg, packageDraft: plan }) {
186
205
  if (!(pkg instanceof GoPackage)) return;
206
+ const deps = dependentMap.get(pkg.id);
207
+ if (!deps) return;
187
208
  const group = graph.getPackageGroup(pkg.id);
188
- for (const dependent of graph.getPackages()) {
189
- if (!(dependent instanceof GoPackage)) continue;
190
- for (const [moduleName, requireVersion] of dependent.mod.requires) {
191
- if (pkg.id !== `go:${moduleName}`) continue;
192
- if (group?.options.syncBump && graph.getPackageGroup(dependent.id) === group) continue;
193
- const bumped = plan.bumpVersion(pkg);
194
- if (!bumped || semver$1.satisfies(bumped, stripGoVersion(requireVersion))) continue;
195
- const bumpType = getBumpDepType?.({
196
- name: pkg.name,
197
- dependent,
198
- version: requireVersion
199
- });
200
- if (bumpType === false) continue;
201
- this.bumpPackage(dependent, {
202
- type: bumpType,
203
- reason: `update require "${moduleName}"`
204
- });
205
- }
209
+ const bumped = plan.bumpVersion(pkg);
210
+ if (!bumped) return;
211
+ for (const dep of deps) {
212
+ if (group?.options.syncBump && graph.getPackageGroup(dep.dependent.id) === group) continue;
213
+ if (semver$1.satisfies(bumped, stripGoVersion(dep.version))) continue;
214
+ const bumpType = getBumpDepType?.(dep);
215
+ if (bumpType === false) continue;
216
+ this.bumpPackage(dep.dependent, {
217
+ type: bumpType,
218
+ reason: `update require "${dep.name}"`
219
+ });
206
220
  }
207
221
  }
208
222
  };
@@ -1,2 +1,2 @@
1
- import { C as npm, S as NpmPluginOptions, x as NpmPackage } from "../types-C1rEqeM4.js";
1
+ import { d as npm, l as NpmPackage, u as NpmPluginOptions } from "../types-DHddSAez.js";
2
2
  export { NpmPackage, NpmPluginOptions, npm };
@@ -1,2 +1,2 @@
1
- import { n as npm, t as NpmPackage } from "../npm-CMOyacwf.js";
1
+ import { n as npm, t as NpmPackage } from "../npm-5cG02krT.js";
2
2
  export { NpmPackage, npm };
@@ -0,0 +1,32 @@
1
+ import z from "zod";
2
+ import { dump } from "js-yaml";
3
+ //#region src/changelog/shared.ts
4
+ const bumpTypeSchema = z.enum([
5
+ "major",
6
+ "minor",
7
+ "patch"
8
+ ]);
9
+ const changelogPackageConfigSchema = z.object({
10
+ type: bumpTypeSchema.optional(),
11
+ replay: z.array(z.string().min(1)).optional()
12
+ });
13
+ const changelogFrontmatterSchema = z.object({
14
+ subject: z.string().optional(),
15
+ packages: z.union([z.array(z.string()), z.record(z.string(), z.union([
16
+ bumpTypeSchema,
17
+ z.null(),
18
+ changelogPackageConfigSchema
19
+ ]))]).optional()
20
+ });
21
+ function renderChangelog(frontmatter, body) {
22
+ return [
23
+ "---",
24
+ dump(frontmatter).trim(),
25
+ "---",
26
+ "",
27
+ body.trim(),
28
+ ""
29
+ ].join("\n");
30
+ }
31
+ //#endregion
32
+ export { renderChangelog as n, changelogFrontmatterSchema as t };