fix(ci): replace bash prebuild with cross-platform Node.js script
The prebuild script used bash syntax (mkdir, for, [ -f ]) which fails on Windows. Replace with a Node.js script that checks platform() and skips non-Linux, keeping the plugin copy logic only where it's needed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
19ab7429cd
commit
d426b9e7b8
2 files changed
+28
-1
No files matched your search
@@ -6,7 +6,7 @@
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "tsc && vite build",
|
||||
"prebuild": "mkdir -p src-tauri/linux-fcitx5-plugin && for f in libopenless.so openless.conf; do [ -f ../scripts/linux-fcitx5-plugin/build_release/$f ] && cp ../scripts/linux-fcitx5-plugin/build_release/$f src-tauri/linux-fcitx5-plugin/; done; true",
|
||||
"prebuild": "node scripts/copy-plugin.mjs",
|
||||
"preview": "vite preview",
|
||||
"tauri": "tauri",
|
||||
"check:hotkey-injection": "node scripts/check-hotkey-injection.mjs"
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import { copyFileSync, mkdirSync } from 'fs';
|
||||
import { join, dirname } from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { platform } from 'os';
|
||||
|
||||
// Only relevant on Linux — skip silently on other platforms
|
||||
if (platform() !== 'linux') {
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const srcDir = join(__dirname, '..', 'scripts', 'linux-fcitx5-plugin', 'build_release');
|
||||
const destDir = join(__dirname, 'src-tauri', 'linux-fcitx5-plugin');
|
||||
|
||||
const files = ['libopenless.so', 'openless.conf'];
|
||||
|
||||
for (const f of files) {
|
||||
const src = join(srcDir, f);
|
||||
const dest = join(destDir, f);
|
||||
try {
|
||||
mkdirSync(destDir, { recursive: true });
|
||||
copyFileSync(src, dest);
|
||||
console.log(`[copy:linux-plugin] copied ${f}`);
|
||||
} catch {
|
||||
console.log(`[copy:linux-plugin] ${f} not found — skipping`);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user