xonecas.io
70160
Ce

cel-tui / commit f7e716e

fix: publish 0.2.1 with correct workspace dependency versions

bun publish resolves workspace:* from bun.lock, not package.json.
The lockfile had stale 0.1.0 versions since bun install doesn't
update workspace versions unless the lockfile is regenerated.
This caused 0.1.1 and 0.2.0 to ship with dependencies pinned
to 0.1.0.

Fix:
- Regenerate bun.lock (rm + bun install) to sync versions
- Bump all packages to 0.2.1
- Deprecate broken 0.1.1 and 0.2.0 releases on npm
- Add scripts/prepublish-check.ts to catch lockfile drift

xonecas2026-04-05 f7e716e676d7d142190d8dedc94f5780f661e2b2 parent fcd75e5

6 files changed

bun.lock+3−3
@@ -17,7 +17,7 @@
1717 },
1818 "packages/components": {
1919 "name": "@cel-tui/components",
20- "version": "0.1.0",
20+ "version": "0.2.1",
2121 "dependencies": {
2222 "@cel-tui/core": "workspace:*",
2323 "@cel-tui/types": "workspace:*",
@@ -29,7 +29,7 @@
2929 },
3030 "packages/core": {
3131 "name": "@cel-tui/core",
32- "version": "0.1.0",
32+ "version": "0.2.1",
3333 "dependencies": {
3434 "@cel-tui/types": "workspace:*",
3535 "get-east-asian-width": "^1.5.0",
@@ -40,7 +40,7 @@
4040 },
4141 "packages/types": {
4242 "name": "@cel-tui/types",
43- "version": "0.1.0",
43+ "version": "0.2.1",
4444 "peerDependencies": {
4545 "typescript": ">=5.0.0",
4646 },
package.json+2−1
@@ -11,7 +11,8 @@
1111 "format:fix": "prettier --write .",
1212 "typecheck": "tsc --noEmit",
1313 "bench": "bun run benchmarks/run-all.ts",
14- "docs": "typedoc --out docs/html && typedoc --out docs/md --plugin typedoc-plugin-markdown"
14+ "docs": "typedoc --out docs/html && typedoc --out docs/md --plugin typedoc-plugin-markdown",
15+ "prepublish-check": "bun run scripts/prepublish-check.ts"
1516 },
1617 "devDependencies": {
1718 "@biomejs/biome": "^2.4.10",
packages/components/package.json+1−1
@@ -1,6 +1,6 @@
11 {
22 "name": "@cel-tui/components",
3- "version": "0.2.0",
3+ "version": "0.2.1",
44 "description": "Pre-made components for cel-tui — Button, Spacer, Divider, VDivider, Select, Markdown",
55 "type": "module",
66 "module": "src/index.ts",
packages/core/package.json+1−1
@@ -1,6 +1,6 @@
11 {
22 "name": "@cel-tui/core",
3- "version": "0.2.0",
3+ "version": "0.2.1",
44 "description": "Core framework engine for cel-tui — primitives, layout, rendering, input",
55 "type": "module",
66 "module": "src/index.ts",
packages/types/package.json+1−1
@@ -1,6 +1,6 @@
11 {
22 "name": "@cel-tui/types",
3- "version": "0.2.0",
3+ "version": "0.2.1",
44 "description": "Type definitions for cel-tui, a TypeScript TUI framework",
55 "type": "module",
66 "module": "src/index.ts",
scripts/prepublish-check.ts+122−0
@@ -0,0 +1,122 @@
1+#!/usr/bin/env bun
2+/**
3+ * Pre-publish verification script.
4+ *
5+ * Checks that:
6+ * 1. All workspace package.json versions match each other
7+ * 2. bun.lock workspace versions match package.json versions
8+ * 3. No stale lockfile entries that would cause bun publish to resolve wrong versions
9+ *
10+ * Run before publishing: bun run scripts/prepublish-check.ts
11+ */
12+
13+import { readFileSync } from "fs";
14+import { resolve } from "path";
15+
16+const ROOT = resolve(import.meta.dirname, "..");
17+const PACKAGES = ["types", "core", "components"] as const;
18+
19+let failed = false;
20+
21+function fail(msg: string) {
22+ console.error(`❌ ${msg}`);
23+ failed = true;
24+}
25+
26+function pass(msg: string) {
27+ console.log(`✅ ${msg}`);
28+}
29+
30+// 1. Read all package.json versions
31+const packageVersions: Record<string, string> = {};
32+for (const pkg of PACKAGES) {
33+ const pkgJson = JSON.parse(
34+ readFileSync(resolve(ROOT, `packages/${pkg}/package.json`), "utf-8"),
35+ );
36+ packageVersions[pkg] = pkgJson.version;
37+}
38+
39+console.log("\n--- Package versions (package.json) ---");
40+for (const pkg of PACKAGES) {
41+ console.log(` @cel-tui/${pkg}: ${packageVersions[pkg]}`);
42+}
43+
44+// 2. Check all versions match
45+const versions = new Set(Object.values(packageVersions));
46+if (versions.size === 1) {
47+ pass(`All package.json versions match: ${[...versions][0]}`);
48+} else {
49+ fail(`Package versions don't match: ${JSON.stringify(packageVersions)}`);
50+}
51+
52+// 3. Read bun.lock and check workspace versions
53+const lockContent = readFileSync(resolve(ROOT, "bun.lock"), "utf-8");
54+
55+console.log("\n--- Lockfile workspace versions ---");
56+for (const pkg of PACKAGES) {
57+ const pattern = new RegExp(
58+ `"packages/${pkg}":\\s*\\{[^}]*"version":\\s*"([^"]+)"`,
59+ "s",
60+ );
61+ const match = lockContent.match(pattern);
62+ if (!match) {
63+ fail(`Could not find packages/${pkg} version in bun.lock`);
64+ continue;
65+ }
66+ const lockVersion = match[1];
67+ console.log(
68+ ` @cel-tui/${pkg}: ${lockVersion} (lockfile) vs ${packageVersions[pkg]} (package.json)`,
69+ );
70+ if (lockVersion === packageVersions[pkg]) {
71+ pass(`@cel-tui/${pkg} lockfile version matches package.json`);
72+ } else {
73+ fail(
74+ `@cel-tui/${pkg} lockfile version MISMATCH: bun.lock has ${lockVersion}, package.json has ${packageVersions[pkg]}. Run: rm bun.lock && bun install`,
75+ );
76+ }
77+}
78+
79+// 4. Check workspace dependencies point to workspace packages (not pinned old versions)
80+console.log("\n--- Workspace dependency checks ---");
81+const corePkg = JSON.parse(
82+ readFileSync(resolve(ROOT, "packages/core/package.json"), "utf-8"),
83+);
84+const compPkg = JSON.parse(
85+ readFileSync(resolve(ROOT, "packages/components/package.json"), "utf-8"),
86+);
87+
88+const workspaceDeps: [string, string, string][] = [
89+ ["core", "@cel-tui/types", corePkg.dependencies?.["@cel-tui/types"]],
90+ ["components", "@cel-tui/types", compPkg.dependencies?.["@cel-tui/types"]],
91+ ["components", "@cel-tui/core", compPkg.dependencies?.["@cel-tui/core"]],
92+];
93+
94+for (const [pkg, dep, value] of workspaceDeps) {
95+ if (value === "workspace:*") {
96+ pass(
97+ `@cel-tui/${pkg} → ${dep} uses workspace:* (will resolve from lockfile)`,
98+ );
99+ } else if (value) {
100+ // If using explicit versions, check they match the target package version
101+ const targetPkg = dep.replace("@cel-tui/", "") as (typeof PACKAGES)[number];
102+ if (value === packageVersions[targetPkg]) {
103+ pass(
104+ `@cel-tui/${pkg} → ${dep} pinned to ${value} (matches current version)`,
105+ );
106+ } else {
107+ fail(
108+ `@cel-tui/${pkg} → ${dep} pinned to ${value} but current version is ${packageVersions[targetPkg]}`,
109+ );
110+ }
111+ }
112+}
113+
114+console.log("");
115+if (failed) {
116+ console.error(
117+ "🚫 Pre-publish checks FAILED. Fix the issues above before publishing.",
118+ );
119+ process.exit(1);
120+} else {
121+ console.log("🎉 All pre-publish checks passed. Safe to publish.");
122+}