@varlock/bumpy 0.0.1 → 1.0.0
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/.claude-plugin/plugin.json +2 -2
- package/dist/add-CgCjs4d-.mjs +313 -0
- package/dist/{ai-B8ZL2x8z.mjs → ai-sMYUf3lP.mjs} +22 -5
- package/dist/{apply-release-plan-DtU3rVyL.mjs → apply-release-plan-CczGWJTk.mjs} +34 -25
- package/dist/bump-file-CCLXMLA8.mjs +143 -0
- package/dist/changelog-github-Cd8uJHZI.mjs +195 -0
- package/dist/{check-CkRubvuk.mjs → check-BOoxpWqk.mjs} +11 -17
- package/dist/ci-Bhx--Tj6.mjs +629 -0
- package/dist/ci-setup-qz4Y3v7T.mjs +211 -0
- package/dist/clack-CDRCHrC-.mjs +1216 -0
- package/dist/cli.mjs +37 -31
- package/dist/{config-CJ2orhTL.mjs → config-XZWUL3ma.mjs} +28 -23
- package/dist/fs-DYR2XuFE.mjs +81 -0
- package/dist/{generate-oOFD9ABC.mjs → generate-gYKTpvex.mjs} +31 -12
- package/dist/git-CGHVXXKw.mjs +78 -0
- package/dist/index.d.mts +63 -37
- package/dist/index.mjs +9 -9
- package/dist/{init-Blw2GfC_.mjs → init-lA9E5pEc.mjs} +3 -3
- package/dist/logger-C2dEe5Su.mjs +135 -0
- package/dist/{migrate-DvOrXSw0.mjs → migrate-DmOYgmfD.mjs} +23 -16
- package/dist/{names-C-u50ofE.mjs → names-9VubBmL0.mjs} +3 -2
- package/dist/package-manager-VCe10bjc.mjs +80 -0
- package/dist/{publish-DZ3m7qkX.mjs → publish-Cun-zQ1b.mjs} +90 -35
- package/dist/{publish-pipeline-1M5GmbdP.mjs → publish-pipeline-BwBuKCIk.mjs} +56 -65
- package/dist/release-plan-Bi5QNSEo.mjs +264 -0
- package/dist/{semver-DWO6NFKN.mjs → semver-DfQyVLM_.mjs} +14 -4
- package/dist/shell-Dj7JRD_q.mjs +92 -0
- package/dist/{status-DRpq_Mha.mjs → status-CfE63ti5.mjs} +27 -23
- package/dist/version-19vVt9dv.mjs +124 -0
- package/dist/workspace-C5ULTyUN.mjs +107 -0
- package/package.json +16 -2
- package/skills/add-change/SKILL.md +8 -12
- package/dist/add-u5V9V3L7.mjs +0 -131
- package/dist/changelog-github-n-3zV1p9.mjs +0 -59
- package/dist/changeset-ClCYsChu.mjs +0 -75
- package/dist/ci-8KWWhjXl.mjs +0 -224
- package/dist/fs-DbNNEyzq.mjs +0 -51
- package/dist/logger-ZqggsyGZ.mjs +0 -176
- package/dist/prompt-BP8toAOI.mjs +0 -46
- package/dist/release-plan-CFnutSHD.mjs +0 -173
- package/dist/shell-DPlltpzb.mjs +0 -44
- package/dist/version-CJwf8XIA.mjs +0 -81
- package/dist/workspace-mVjawG8g.mjs +0 -183
- /package/dist/{dep-graph-DiLeAhl9.mjs → dep-graph-E-9-eQ2J.mjs} +0 -0
package/dist/shell-DPlltpzb.mjs
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { i as __exportAll } from "./logger-ZqggsyGZ.mjs";
|
|
2
|
-
import { exec, execSync } from "node:child_process";
|
|
3
|
-
//#region src/utils/shell.ts
|
|
4
|
-
var shell_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
-
run: () => run,
|
|
6
|
-
runAsync: () => runAsync,
|
|
7
|
-
tryRun: () => tryRun
|
|
8
|
-
});
|
|
9
|
-
function run(cmd, opts) {
|
|
10
|
-
return execSync(cmd, {
|
|
11
|
-
cwd: opts?.cwd,
|
|
12
|
-
input: opts?.input,
|
|
13
|
-
encoding: "utf-8",
|
|
14
|
-
stdio: [
|
|
15
|
-
opts?.input ? "pipe" : "pipe",
|
|
16
|
-
"pipe",
|
|
17
|
-
"pipe"
|
|
18
|
-
]
|
|
19
|
-
}).trim();
|
|
20
|
-
}
|
|
21
|
-
function runAsync(cmd, opts) {
|
|
22
|
-
return new Promise((resolve, reject) => {
|
|
23
|
-
const child = exec(cmd, {
|
|
24
|
-
cwd: opts?.cwd,
|
|
25
|
-
encoding: "utf-8"
|
|
26
|
-
}, (err, stdout, stderr) => {
|
|
27
|
-
if (err) reject(/* @__PURE__ */ new Error(`Command failed: ${cmd}\n${stderr}`));
|
|
28
|
-
else resolve(stdout.trim());
|
|
29
|
-
});
|
|
30
|
-
if (opts?.input) {
|
|
31
|
-
child.stdin?.write(opts.input);
|
|
32
|
-
child.stdin?.end();
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
function tryRun(cmd, opts) {
|
|
37
|
-
try {
|
|
38
|
-
return run(cmd, opts);
|
|
39
|
-
} catch {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
//#endregion
|
|
44
|
-
export { tryRun as i, runAsync as n, shell_exports as r, run as t };
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { n as log, t as colorize } from "./logger-ZqggsyGZ.mjs";
|
|
2
|
-
import { a as loadConfig } from "./config-CJ2orhTL.mjs";
|
|
3
|
-
import { r as detectWorkspaces, t as discoverPackages } from "./workspace-mVjawG8g.mjs";
|
|
4
|
-
import { t as DependencyGraph } from "./dep-graph-DiLeAhl9.mjs";
|
|
5
|
-
import { r as readChangesets } from "./changeset-ClCYsChu.mjs";
|
|
6
|
-
import { t as assembleReleasePlan } from "./release-plan-CFnutSHD.mjs";
|
|
7
|
-
import { t as applyReleasePlan } from "./apply-release-plan-DtU3rVyL.mjs";
|
|
8
|
-
import { i as tryRun, t as run } from "./shell-DPlltpzb.mjs";
|
|
9
|
-
//#region src/commands/version.ts
|
|
10
|
-
async function versionCommand(rootDir) {
|
|
11
|
-
const config = await loadConfig(rootDir);
|
|
12
|
-
const packages = await discoverPackages(rootDir, config);
|
|
13
|
-
const depGraph = new DependencyGraph(packages);
|
|
14
|
-
const changesets = await readChangesets(rootDir);
|
|
15
|
-
if (changesets.length === 0) {
|
|
16
|
-
log.info("No pending changesets.");
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
const plan = assembleReleasePlan(changesets, packages, depGraph, config);
|
|
20
|
-
if (plan.releases.length === 0) {
|
|
21
|
-
log.warn("Changesets found but no packages would be released.");
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
log.step("Applying version bumps:");
|
|
25
|
-
for (const r of plan.releases) {
|
|
26
|
-
const tag = r.isDependencyBump ? " (dep)" : r.isCascadeBump ? " (cascade)" : "";
|
|
27
|
-
console.log(` ${r.name}: ${r.oldVersion} → ${colorize(r.newVersion, "cyan")}${tag}`);
|
|
28
|
-
}
|
|
29
|
-
await applyReleasePlan(plan, packages, rootDir, config);
|
|
30
|
-
log.success(`Updated ${plan.releases.length} package(s)`);
|
|
31
|
-
log.dim(` Deleted ${changesets.length} changeset file(s)`);
|
|
32
|
-
await updateLockfile(rootDir);
|
|
33
|
-
if (config.commit) try {
|
|
34
|
-
run("git add -A .bumpy/", { cwd: rootDir });
|
|
35
|
-
for (const r of plan.releases) {
|
|
36
|
-
const pkg = packages.get(r.name);
|
|
37
|
-
run(`git add "${pkg.relativeDir}/package.json"`, { cwd: rootDir });
|
|
38
|
-
run(`git add "${pkg.relativeDir}/CHANGELOG.md"`, { cwd: rootDir });
|
|
39
|
-
}
|
|
40
|
-
for (const lockfile of [
|
|
41
|
-
"bun.lock",
|
|
42
|
-
"bun.lockb",
|
|
43
|
-
"pnpm-lock.yaml",
|
|
44
|
-
"yarn.lock",
|
|
45
|
-
"package-lock.json"
|
|
46
|
-
]) tryRun(`git add "${lockfile}"`, { cwd: rootDir });
|
|
47
|
-
run("git commit -F -", {
|
|
48
|
-
cwd: rootDir,
|
|
49
|
-
input: [
|
|
50
|
-
"Version packages",
|
|
51
|
-
"",
|
|
52
|
-
...plan.releases.map((r) => `${r.name}@${r.newVersion}`)
|
|
53
|
-
].join("\n")
|
|
54
|
-
});
|
|
55
|
-
log.success("Created git commit");
|
|
56
|
-
} catch (e) {
|
|
57
|
-
log.warn(`Git commit failed: ${e}`);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
/** Run the package manager's install to update the lockfile */
|
|
61
|
-
async function updateLockfile(rootDir) {
|
|
62
|
-
const { packageManager } = await detectWorkspaces(rootDir);
|
|
63
|
-
const installCmd = getInstallCommand(packageManager);
|
|
64
|
-
log.step(`Updating lockfile (${installCmd})...`);
|
|
65
|
-
try {
|
|
66
|
-
run(installCmd, { cwd: rootDir });
|
|
67
|
-
log.dim(" Lockfile updated");
|
|
68
|
-
} catch (err) {
|
|
69
|
-
log.warn(` Lockfile update failed: ${err instanceof Error ? err.message : err}`);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
function getInstallCommand(pm) {
|
|
73
|
-
switch (pm) {
|
|
74
|
-
case "pnpm": return "pnpm install --lockfile-only";
|
|
75
|
-
case "bun": return "bun install";
|
|
76
|
-
case "yarn": return "yarn install --mode update-lockfile";
|
|
77
|
-
default: return "npm install --package-lock-only";
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
//#endregion
|
|
81
|
-
export { versionCommand };
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { a as readJson, n as exists, o as readText } from "./fs-DbNNEyzq.mjs";
|
|
2
|
-
import { i as isPackageManaged, o as loadPackageConfig } from "./config-CJ2orhTL.mjs";
|
|
3
|
-
import { t as jsYaml } from "./js-yaml-DpZfOoD4.mjs";
|
|
4
|
-
import { relative, resolve } from "node:path";
|
|
5
|
-
import { readdir, stat } from "node:fs/promises";
|
|
6
|
-
//#region src/utils/package-manager.ts
|
|
7
|
-
/** Detect the package manager, extract workspace globs, and load catalogs */
|
|
8
|
-
async function detectWorkspaces(rootDir) {
|
|
9
|
-
const pm = await detectPackageManager(rootDir);
|
|
10
|
-
return {
|
|
11
|
-
packageManager: pm,
|
|
12
|
-
globs: await getWorkspaceGlobs(rootDir, pm),
|
|
13
|
-
catalogs: await loadCatalogs(rootDir, pm)
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
async function detectPackageManager(rootDir) {
|
|
17
|
-
if (await exists(resolve(rootDir, "bun.lock")) || await exists(resolve(rootDir, "bun.lockb"))) return "bun";
|
|
18
|
-
if (await exists(resolve(rootDir, "pnpm-lock.yaml"))) return "pnpm";
|
|
19
|
-
if (await exists(resolve(rootDir, "yarn.lock"))) return "yarn";
|
|
20
|
-
try {
|
|
21
|
-
const pkg = await readJson(resolve(rootDir, "package.json"));
|
|
22
|
-
if (typeof pkg.packageManager === "string") {
|
|
23
|
-
const name = pkg.packageManager.split("@")[0];
|
|
24
|
-
if (name === "pnpm" || name === "yarn" || name === "bun") return name;
|
|
25
|
-
}
|
|
26
|
-
} catch {}
|
|
27
|
-
return "npm";
|
|
28
|
-
}
|
|
29
|
-
async function getWorkspaceGlobs(rootDir, pm) {
|
|
30
|
-
if (pm === "pnpm") {
|
|
31
|
-
const wsFile = resolve(rootDir, "pnpm-workspace.yaml");
|
|
32
|
-
if (await exists(wsFile)) {
|
|
33
|
-
const content = await readText(wsFile);
|
|
34
|
-
const parsed = jsYaml.load(content);
|
|
35
|
-
if (parsed?.packages) return parsed.packages;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
try {
|
|
39
|
-
const workspaces = (await readJson(resolve(rootDir, "package.json"))).workspaces;
|
|
40
|
-
if (Array.isArray(workspaces)) return workspaces;
|
|
41
|
-
if (workspaces && typeof workspaces === "object" && "packages" in workspaces) {
|
|
42
|
-
const pkgs = workspaces.packages;
|
|
43
|
-
if (Array.isArray(pkgs)) return pkgs;
|
|
44
|
-
}
|
|
45
|
-
} catch {}
|
|
46
|
-
return [];
|
|
47
|
-
}
|
|
48
|
-
/** Load catalog definitions from pnpm-workspace.yaml or root package.json */
|
|
49
|
-
async function loadCatalogs(rootDir, pm) {
|
|
50
|
-
const catalogs = /* @__PURE__ */ new Map();
|
|
51
|
-
if (pm === "pnpm") {
|
|
52
|
-
const wsFile = resolve(rootDir, "pnpm-workspace.yaml");
|
|
53
|
-
if (await exists(wsFile)) {
|
|
54
|
-
const content = await readText(wsFile);
|
|
55
|
-
const parsed = jsYaml.load(content);
|
|
56
|
-
if (parsed?.catalog) catalogs.set("", parsed.catalog);
|
|
57
|
-
if (parsed?.catalogs) for (const [name, deps] of Object.entries(parsed.catalogs)) catalogs.set(name, deps);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
try {
|
|
61
|
-
const pkg = await readJson(resolve(rootDir, "package.json"));
|
|
62
|
-
if (pkg.catalog && typeof pkg.catalog === "object") catalogs.set("", pkg.catalog);
|
|
63
|
-
if (pkg.catalogs && typeof pkg.catalogs === "object") for (const [name, deps] of Object.entries(pkg.catalogs)) catalogs.set(name, deps);
|
|
64
|
-
const workspaces = pkg.workspaces;
|
|
65
|
-
if (workspaces && typeof workspaces === "object" && !Array.isArray(workspaces)) {
|
|
66
|
-
const ws = workspaces;
|
|
67
|
-
if (ws.catalog && typeof ws.catalog === "object") catalogs.set("", ws.catalog);
|
|
68
|
-
if (ws.catalogs && typeof ws.catalogs === "object") for (const [name, deps] of Object.entries(ws.catalogs)) catalogs.set(name, deps);
|
|
69
|
-
}
|
|
70
|
-
} catch {}
|
|
71
|
-
return catalogs;
|
|
72
|
-
}
|
|
73
|
-
/** Resolve a specific dependency's catalog: reference */
|
|
74
|
-
function resolveCatalogDep(depName, range, catalogs) {
|
|
75
|
-
if (!range.startsWith("catalog:")) return null;
|
|
76
|
-
const catalogName = range.slice(8).trim() || "";
|
|
77
|
-
const catalog = catalogs.get(catalogName);
|
|
78
|
-
if (!catalog) return null;
|
|
79
|
-
return catalog[depName] ?? null;
|
|
80
|
-
}
|
|
81
|
-
//#endregion
|
|
82
|
-
//#region src/core/workspace.ts
|
|
83
|
-
/** Discover all workspace packages and catalogs in a monorepo */
|
|
84
|
-
async function discoverWorkspace(rootDir, config) {
|
|
85
|
-
const { globs, catalogs } = await detectWorkspaces(rootDir);
|
|
86
|
-
if (globs.length === 0) throw new Error("No workspace globs found. Is this a monorepo?");
|
|
87
|
-
const packages = /* @__PURE__ */ new Map();
|
|
88
|
-
for (const glob of globs) {
|
|
89
|
-
const dirs = await resolveGlob(rootDir, glob);
|
|
90
|
-
for (const dir of dirs) {
|
|
91
|
-
const pkg = await loadWorkspacePackage(dir, rootDir, config);
|
|
92
|
-
if (pkg) {
|
|
93
|
-
if (!isPackageManaged(pkg.name, pkg.private, config, pkg.bumpy)) continue;
|
|
94
|
-
packages.set(pkg.name, pkg);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return {
|
|
99
|
-
packages,
|
|
100
|
-
catalogs
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
/** Convenience wrapper that returns just packages (backwards compat) */
|
|
104
|
-
async function discoverPackages(rootDir, config) {
|
|
105
|
-
const { packages } = await discoverWorkspace(rootDir, config);
|
|
106
|
-
return packages;
|
|
107
|
-
}
|
|
108
|
-
/** Resolve a workspace glob pattern to directories containing package.json */
|
|
109
|
-
async function resolveGlob(rootDir, pattern) {
|
|
110
|
-
return expandGlob(rootDir, pattern.split("/"));
|
|
111
|
-
}
|
|
112
|
-
async function expandGlob(baseDir, parts) {
|
|
113
|
-
if (parts.length === 0) {
|
|
114
|
-
if (await exists(resolve(baseDir, "package.json"))) return [baseDir];
|
|
115
|
-
return [];
|
|
116
|
-
}
|
|
117
|
-
const [current, ...rest] = parts;
|
|
118
|
-
if (current === "*") {
|
|
119
|
-
const entries = await safeReaddir(baseDir);
|
|
120
|
-
const results = [];
|
|
121
|
-
for (const entry of entries) {
|
|
122
|
-
const entryPath = resolve(baseDir, entry);
|
|
123
|
-
if (await isDirectory(entryPath)) results.push(...await expandGlob(entryPath, rest));
|
|
124
|
-
}
|
|
125
|
-
return results;
|
|
126
|
-
} else if (current === "**") {
|
|
127
|
-
const results = [];
|
|
128
|
-
results.push(...await expandGlob(baseDir, rest));
|
|
129
|
-
const entries = await safeReaddir(baseDir);
|
|
130
|
-
for (const entry of entries) {
|
|
131
|
-
if (entry.startsWith(".") || entry === "node_modules") continue;
|
|
132
|
-
const entryPath = resolve(baseDir, entry);
|
|
133
|
-
if (await isDirectory(entryPath)) results.push(...await expandGlob(entryPath, parts));
|
|
134
|
-
}
|
|
135
|
-
return results;
|
|
136
|
-
} else {
|
|
137
|
-
const next = resolve(baseDir, current);
|
|
138
|
-
if (await isDirectory(next)) return expandGlob(next, rest);
|
|
139
|
-
return [];
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
async function safeReaddir(dir) {
|
|
143
|
-
try {
|
|
144
|
-
return await readdir(dir);
|
|
145
|
-
} catch {
|
|
146
|
-
return [];
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
async function isDirectory(path) {
|
|
150
|
-
try {
|
|
151
|
-
return (await stat(path)).isDirectory();
|
|
152
|
-
} catch {
|
|
153
|
-
return false;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
async function loadWorkspacePackage(dir, rootDir, config) {
|
|
157
|
-
const pkgPath = resolve(dir, "package.json");
|
|
158
|
-
if (!await exists(pkgPath)) return null;
|
|
159
|
-
let pkg;
|
|
160
|
-
try {
|
|
161
|
-
pkg = await readJson(pkgPath);
|
|
162
|
-
} catch {
|
|
163
|
-
return null;
|
|
164
|
-
}
|
|
165
|
-
const name = pkg.name;
|
|
166
|
-
if (!name) return null;
|
|
167
|
-
const bumpy = await loadPackageConfig(dir, config, name);
|
|
168
|
-
return {
|
|
169
|
-
name,
|
|
170
|
-
version: pkg.version || "0.0.0",
|
|
171
|
-
dir: resolve(dir),
|
|
172
|
-
relativeDir: relative(rootDir, dir),
|
|
173
|
-
packageJson: pkg,
|
|
174
|
-
private: !!pkg.private,
|
|
175
|
-
dependencies: pkg.dependencies || {},
|
|
176
|
-
devDependencies: pkg.devDependencies || {},
|
|
177
|
-
peerDependencies: pkg.peerDependencies || {},
|
|
178
|
-
optionalDependencies: pkg.optionalDependencies || {},
|
|
179
|
-
bumpy
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
//#endregion
|
|
183
|
-
export { resolveCatalogDep as i, discoverWorkspace as n, detectWorkspaces as r, discoverPackages as t };
|
|
File without changes
|