Skip to content

Commit 3c03fac

Browse files
committed
fix: relink opentui modules for cli build
1 parent ca60f0e commit 3c03fac

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/cli-release-build.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,54 @@ jobs:
9292
- name: Ensure CLI dependencies
9393
run: bun install --frozen-lockfile --cwd cli
9494

95+
- name: Fix OpenTUI module symlinks
96+
shell: bash
97+
run: |
98+
set -euo pipefail
99+
node <<'NODE'
100+
import fs from 'fs';
101+
import path from 'path';
102+
103+
const rootDir = process.cwd();
104+
const rootOpenTui = path.join(rootDir, 'node_modules', '@opentui');
105+
const cliNodeModules = path.join(rootDir, 'cli', 'node_modules');
106+
const cliOpenTui = path.join(cliNodeModules, '@opentui');
107+
108+
if (!fs.existsSync(rootOpenTui)) {
109+
console.log('Root @opentui packages missing; skipping fix');
110+
process.exit(0);
111+
}
112+
113+
fs.mkdirSync(cliOpenTui, { recursive: true });
114+
115+
const packages = ['core', 'react'];
116+
for (const pkg of packages) {
117+
const target = path.join(rootOpenTui, pkg);
118+
const link = path.join(cliOpenTui, pkg);
119+
120+
if (!fs.existsSync(target)) {
121+
console.log(`Target ${target} missing; skipping ${pkg}`);
122+
continue;
123+
}
124+
125+
if (fs.existsSync(link)) {
126+
try {
127+
const actual = fs.realpathSync(link);
128+
if (actual === target) {
129+
continue;
130+
}
131+
} catch (error) {
132+
// If the link is broken or realpath fails, remove it.
133+
}
134+
fs.rmSync(link, { recursive: true, force: true });
135+
}
136+
137+
const type = process.platform === 'win32' ? 'junction' : 'dir';
138+
fs.symlinkSync(target, link, type);
139+
console.log(`Linked ${link} -> ${target}`);
140+
}
141+
NODE
142+
95143
- name: Configure environment variables
96144
env:
97145
SECRETS_CONTEXT: ${{ toJSON(secrets) }}

0 commit comments

Comments
 (0)