@varlock/bumpy 1.2.1 → 1.2.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.
Files changed (34) hide show
  1. package/README.md +49 -34
  2. package/dist/{add-DF6bawDT.mjs → add-DEqGa5gI.mjs} +8 -8
  3. package/dist/apply-release-plan-Bi9OSWks.mjs +57 -0
  4. package/dist/{bump-file-C3S_bzSf.mjs → bump-file-BTsntOO-.mjs} +6 -9
  5. package/dist/{changelog-github-DZSHX3Tb.mjs → changelog-github-CEaDCtTk.mjs} +30 -14
  6. package/dist/changelog-xKuL0IKx.mjs +109 -0
  7. package/dist/{check-BJL-YDWz.mjs → check-D3eXRyKJ.mjs} +7 -7
  8. package/dist/{ci-C88ecvIP.mjs → ci-BVTwTUUK.mjs} +49 -28
  9. package/dist/{ci-setup-CARJFhcE.mjs → ci-setup-D1NCzbNH.mjs} +3 -3
  10. package/dist/cli.mjs +14 -14
  11. package/dist/{config-D7Umr-fT.mjs → config-CJIj8xG3.mjs} +2 -80
  12. package/dist/{generate-D93b3NAD.mjs → generate-wHN6Ll6p.mjs} +6 -6
  13. package/dist/{git-H9S9z6g-.mjs → git-D0__HP86.mjs} +1 -1
  14. package/dist/index.d.mts +1 -1
  15. package/dist/index.mjs +10 -8
  16. package/dist/{init-DJhMaceS.mjs → init-DND7zRGD.mjs} +3 -3
  17. package/dist/{publish-DGSV607z.mjs → publish-BwidFqbo.mjs} +9 -9
  18. package/dist/{publish-pipeline-DiwZZ5AF.mjs → publish-pipeline-BvLIu7WF.mjs} +4 -4
  19. package/dist/{release-plan-CNOuSI-d.mjs → release-plan-21H89Cx1.mjs} +3 -2
  20. package/dist/{status-S2ztf_8E.mjs → status-CDGxgXWd.mjs} +7 -7
  21. package/dist/types-CSM0c2-m.mjs +80 -0
  22. package/dist/{version-BXrP4TIO.mjs → version-ClkaCNTE.mjs} +9 -9
  23. package/dist/{workspace-BHsAPUmC.mjs → workspace-c9-TqXed.mjs} +2 -2
  24. package/package.json +1 -1
  25. package/dist/apply-release-plan-B1Wwx3HG.mjs +0 -146
  26. /package/dist/{ai-STKnq09z.mjs → ai-C66IfTzs.mjs} +0 -0
  27. /package/dist/{clack-C6bVkGxf.mjs → clack-CJT1JFFa.mjs} +0 -0
  28. /package/dist/{commit-message-BwsowSds.mjs → commit-message-DOIfDxfj.mjs} +0 -0
  29. /package/dist/{dep-graph-DiLeAhl9.mjs → dep-graph-E-9-eQ2J.mjs} +0 -0
  30. /package/dist/{names-C-TuOPbd.mjs → names-CBy7d8K_.mjs} +0 -0
  31. /package/dist/{package-manager-ByJ0wKYh.mjs → package-manager-CClZtIHP.mjs} +0 -0
  32. /package/dist/{picomatch-DMmqYjgq.mjs → picomatch-TGJi--_I.mjs} +0 -0
  33. /package/dist/{semver-BJzWIuRz.mjs → semver-DfQyVLM_.mjs} +0 -0
  34. /package/dist/{shell-CY7OD48z.mjs → shell-u3bYGxNy.mjs} +0 -0
@@ -1,13 +1,13 @@
1
1
  import { n as log, t as colorize } from "./logger-C2dEe5Su.mjs";
2
- import { a as loadConfig } from "./config-D7Umr-fT.mjs";
3
- import { n as detectWorkspaces } from "./package-manager-ByJ0wKYh.mjs";
4
- import { t as discoverPackages } from "./workspace-BHsAPUmC.mjs";
5
- import { t as DependencyGraph } from "./dep-graph-DiLeAhl9.mjs";
6
- import { n as runArgs, s as tryRunArgs } from "./shell-CY7OD48z.mjs";
7
- import { r as readBumpFiles } from "./bump-file-C3S_bzSf.mjs";
8
- import { t as assembleReleasePlan } from "./release-plan-CNOuSI-d.mjs";
9
- import { t as applyReleasePlan } from "./apply-release-plan-B1Wwx3HG.mjs";
10
- import { t as resolveCommitMessage } from "./commit-message-BwsowSds.mjs";
2
+ import { a as loadConfig } from "./config-CJIj8xG3.mjs";
3
+ import { n as detectWorkspaces } from "./package-manager-CClZtIHP.mjs";
4
+ import { t as discoverPackages } from "./workspace-c9-TqXed.mjs";
5
+ import { t as DependencyGraph } from "./dep-graph-E-9-eQ2J.mjs";
6
+ import { n as runArgs, s as tryRunArgs } from "./shell-u3bYGxNy.mjs";
7
+ import { r as readBumpFiles } from "./bump-file-BTsntOO-.mjs";
8
+ import { t as assembleReleasePlan } from "./release-plan-21H89Cx1.mjs";
9
+ import { t as applyReleasePlan } from "./apply-release-plan-Bi9OSWks.mjs";
10
+ import { t as resolveCommitMessage } from "./commit-message-DOIfDxfj.mjs";
11
11
  //#region src/commands/version.ts
12
12
  async function versionCommand(rootDir, opts = {}) {
13
13
  const config = await loadConfig(rootDir);
@@ -1,6 +1,6 @@
1
1
  import { a as readJson, n as exists } from "./fs-DnDogVn-.mjs";
2
- import { i as isPackageManaged, o as loadPackageConfig } from "./config-D7Umr-fT.mjs";
3
- import { n as detectWorkspaces } from "./package-manager-ByJ0wKYh.mjs";
2
+ import { i as isPackageManaged, o as loadPackageConfig } from "./config-CJIj8xG3.mjs";
3
+ import { n as detectWorkspaces } from "./package-manager-CClZtIHP.mjs";
4
4
  import { relative, resolve } from "node:path";
5
5
  import { readdir, stat } from "node:fs/promises";
6
6
  //#region src/core/workspace.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlock/bumpy",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "Modern monorepo versioning and changelog tool",
5
5
  "keywords": [
6
6
  "bump",
@@ -1,146 +0,0 @@
1
- import { n as log } from "./logger-C2dEe5Su.mjs";
2
- import { a as readJson, c as removeFile, f as writeText, i as listFiles, l as updateJsonFields, n as exists, s as readText, u as updateJsonNestedField } from "./fs-DnDogVn-.mjs";
3
- import { r as getBumpyDir } from "./config-D7Umr-fT.mjs";
4
- import { relative, resolve } from "node:path";
5
- import { realpathSync } from "node:fs";
6
- //#region src/core/changelog.ts
7
- /** Default formatter — version heading, date, bullet points */
8
- const defaultFormatter = (ctx) => {
9
- const { release, bumpFiles, date } = ctx;
10
- const lines = [];
11
- lines.push(`## ${release.newVersion}`);
12
- lines.push("");
13
- lines.push(`_${date}_`);
14
- lines.push("");
15
- const relevantBumpFiles = bumpFiles.filter((bf) => release.bumpFiles.includes(bf.id));
16
- if (relevantBumpFiles.length > 0) {
17
- for (const bf of relevantBumpFiles) if (bf.summary) {
18
- const summaryLines = bf.summary.split("\n");
19
- lines.push(`- ${summaryLines[0]}`);
20
- for (let i = 1; i < summaryLines.length; i++) if (summaryLines[i].trim()) lines.push(` ${summaryLines[i]}`);
21
- }
22
- }
23
- if (release.isDependencyBump && relevantBumpFiles.length === 0) lines.push("- Updated dependencies");
24
- if (release.isCascadeBump && !release.isDependencyBump && relevantBumpFiles.length === 0) lines.push("- Version bump via cascade rule");
25
- lines.push("");
26
- return lines.join("\n");
27
- };
28
- const BUILTIN_FORMATTERS = {
29
- default: defaultFormatter,
30
- github: async () => {
31
- const { createGithubFormatter } = await import("./changelog-github-DZSHX3Tb.mjs");
32
- return createGithubFormatter();
33
- }
34
- };
35
- /**
36
- * Load a changelog formatter from config.
37
- * Supports: "default", "./path/to/formatter.ts", or a module name.
38
- */
39
- async function loadFormatter(changelog, rootDir) {
40
- const [name, options] = Array.isArray(changelog) ? changelog : [changelog, {}];
41
- if (name === "github") {
42
- const { createGithubFormatter } = await import("./changelog-github-DZSHX3Tb.mjs");
43
- return createGithubFormatter(options);
44
- }
45
- if (typeof name === "string" && BUILTIN_FORMATTERS[name]) {
46
- const builtin = BUILTIN_FORMATTERS[name];
47
- if (typeof builtin === "function" && builtin.length === 0) return builtin();
48
- return builtin;
49
- }
50
- if (typeof name === "string") try {
51
- let modulePath;
52
- if (name.startsWith(".")) {
53
- modulePath = resolve(rootDir, name);
54
- try {
55
- modulePath = realpathSync(modulePath);
56
- } catch {}
57
- const rel = relative(realpathSync(rootDir), modulePath);
58
- if (rel.startsWith("..") || resolve("/", rel) === resolve("/")) throw new Error(`Changelog formatter path "${name}" resolves outside the project root`);
59
- } else modulePath = name;
60
- const mod = await import(modulePath);
61
- const exported = mod.default || mod.changelogFormatter;
62
- if (typeof exported === "function") {
63
- const result = exported(options);
64
- if (typeof result === "function") return result;
65
- return exported;
66
- }
67
- throw new Error(`Changelog module "${name}" does not export a function`);
68
- } catch (err) {
69
- log.warn(`Failed to load changelog formatter "${name}": ${err instanceof Error ? err.message : err}`);
70
- log.warn("Falling back to default formatter");
71
- return defaultFormatter;
72
- }
73
- return defaultFormatter;
74
- }
75
- /** Generate a changelog entry using the configured formatter */
76
- async function generateChangelogEntry(release, bumpFiles, formatter = defaultFormatter, date = (/* @__PURE__ */ new Date()).toISOString().split("T")[0]) {
77
- return formatter({
78
- release,
79
- bumpFiles,
80
- date
81
- });
82
- }
83
- /** Prepend a new entry to an existing CHANGELOG.md content */
84
- function prependToChangelog(existingContent, newEntry) {
85
- const headerMatch = existingContent.match(/^# /m);
86
- if (headerMatch && headerMatch.index !== void 0) {
87
- const afterTitle = existingContent.indexOf("\n##");
88
- if (afterTitle !== -1) return existingContent.slice(0, afterTitle + 1) + "\n" + newEntry + existingContent.slice(afterTitle + 1);
89
- return existingContent.trimEnd() + "\n\n" + newEntry;
90
- }
91
- return "# Changelog\n\n" + newEntry;
92
- }
93
- //#endregion
94
- //#region src/core/apply-release-plan.ts
95
- /** Apply the release plan: bump versions, update changelogs, delete bump files */
96
- async function applyReleasePlan(releasePlan, packages, rootDir, config) {
97
- const releaseMap = new Map(releasePlan.releases.map((r) => [r.name, r]));
98
- const formatter = config.changelog !== false ? await loadFormatter(config.changelog, rootDir) : null;
99
- for (const release of releasePlan.releases) {
100
- const pkgJsonPath = resolve(packages.get(release.name).dir, "package.json");
101
- const pkgJson = await readJson(pkgJsonPath);
102
- await updateJsonFields(pkgJsonPath, { version: release.newVersion });
103
- for (const depField of [
104
- "dependencies",
105
- "devDependencies",
106
- "peerDependencies",
107
- "optionalDependencies"
108
- ]) {
109
- const deps = pkgJson[depField];
110
- if (!deps) continue;
111
- for (const [depName, range] of Object.entries(deps)) {
112
- const depRelease = releaseMap.get(depName);
113
- if (!depRelease) continue;
114
- await updateJsonNestedField(pkgJsonPath, depField, depName, updateRange(range, depRelease.newVersion));
115
- }
116
- }
117
- }
118
- if (formatter) for (const release of releasePlan.releases) {
119
- const changelogPath = resolve(packages.get(release.name).dir, "CHANGELOG.md");
120
- const entry = await generateChangelogEntry(release, releasePlan.bumpFiles, formatter);
121
- let existingContent = "";
122
- if (await exists(changelogPath)) existingContent = await readText(changelogPath);
123
- await writeText(changelogPath, prependToChangelog(existingContent, entry));
124
- }
125
- const bumpyDir = getBumpyDir(rootDir);
126
- const allBumpFiles = await listFiles(bumpyDir, ".md");
127
- for (const file of allBumpFiles) {
128
- if (file === "README.md") continue;
129
- await removeFile(resolve(bumpyDir, file));
130
- }
131
- }
132
- /** Update a version range to include a new version, preserving the range prefix */
133
- function updateRange(range, newVersion) {
134
- let protocol = "";
135
- let cleanRange = range;
136
- const protoMatch = range.match(/^(workspace:|catalog:)/);
137
- if (protoMatch) {
138
- protocol = protoMatch[1];
139
- cleanRange = range.slice(protocol.length);
140
- }
141
- const prefix = cleanRange.match(/^(\^|~|>=|>|<=|<|=)?/)?.[1] ?? "^";
142
- if (cleanRange === "*" || cleanRange === "" || cleanRange === "^" || cleanRange === "~") return range;
143
- return `${protocol}${prefix}${newVersion}`;
144
- }
145
- //#endregion
146
- export { prependToChangelog as a, loadFormatter as i, defaultFormatter as n, generateChangelogEntry as r, applyReleasePlan as t };
File without changes
File without changes
File without changes
File without changes