@varlock/bumpy 0.0.1 → 0.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.
Files changed (38) hide show
  1. package/dist/add-BjyVIUlr.mjs +175 -0
  2. package/dist/{ai-B8ZL2x8z.mjs → ai-CQhUyHAG.mjs} +2 -2
  3. package/dist/{apply-release-plan-DtU3rVyL.mjs → apply-release-plan-D6TSrcwX.mjs} +11 -6
  4. package/dist/changelog-github-Du62krXi.mjs +193 -0
  5. package/dist/{changeset-ClCYsChu.mjs → changeset-UCZdSRDv.mjs} +36 -3
  6. package/dist/{check-CkRubvuk.mjs → check-jIwike9F.mjs} +5 -11
  7. package/dist/ci-D6LQbR38.mjs +585 -0
  8. package/dist/ci-setup-C6FlOfW5.mjs +211 -0
  9. package/dist/clack-CDRCHrC-.mjs +1216 -0
  10. package/dist/cli.mjs +20 -16
  11. package/dist/{config-CJ2orhTL.mjs → config-BkwIEaQg.mjs} +2 -2
  12. package/dist/{fs-DbNNEyzq.mjs → fs-0AtnPUUe.mjs} +1 -1
  13. package/dist/{generate-oOFD9ABC.mjs → generate-Btrsn1qi.mjs} +28 -9
  14. package/dist/git-CGHVXXKw.mjs +78 -0
  15. package/dist/index.d.mts +10 -2
  16. package/dist/index.mjs +8 -8
  17. package/dist/{init-Blw2GfC_.mjs → init-B0q3wEQW.mjs} +2 -2
  18. package/dist/logger-C2dEe5Su.mjs +135 -0
  19. package/dist/{migrate-DvOrXSw0.mjs → migrate-CfQNwD0T.mjs} +18 -11
  20. package/dist/{names-C-u50ofE.mjs → names-Ck8cun7B.mjs} +2 -1
  21. package/dist/package-manager-DcI5TdDE.mjs +80 -0
  22. package/dist/{publish-DZ3m7qkX.mjs → publish-D_7RqEYL.mjs} +74 -20
  23. package/dist/{publish-pipeline-1M5GmbdP.mjs → publish-pipeline-ChnqW8nR.mjs} +40 -54
  24. package/dist/{release-plan-CFnutSHD.mjs → release-plan-BEzwApuK.mjs} +2 -2
  25. package/dist/{semver-DWO6NFKN.mjs → semver-BTzYh8vc.mjs} +1 -1
  26. package/dist/shell-Dj7JRD_q.mjs +92 -0
  27. package/dist/{status-DRpq_Mha.mjs → status--Q8yAxQ4.mjs} +7 -7
  28. package/dist/{version-CJwf8XIA.mjs → version-cAUkfYPx.mjs} +60 -21
  29. package/dist/workspace-CxEKakDm.mjs +107 -0
  30. package/package.json +4 -2
  31. package/dist/add-u5V9V3L7.mjs +0 -131
  32. package/dist/changelog-github-n-3zV1p9.mjs +0 -59
  33. package/dist/ci-8KWWhjXl.mjs +0 -224
  34. package/dist/logger-ZqggsyGZ.mjs +0 -176
  35. package/dist/prompt-BP8toAOI.mjs +0 -46
  36. package/dist/shell-DPlltpzb.mjs +0 -44
  37. package/dist/workspace-mVjawG8g.mjs +0 -183
  38. /package/dist/{dep-graph-DiLeAhl9.mjs → dep-graph-E-9-eQ2J.mjs} +0 -0
@@ -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,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 };