Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion scripts/desktop-tauri-build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ async function main() {
// Tauri CLI reads CI and rejects numeric "1" (common in CI providers).
process.env.CI = 'true';

const r = spawnSync('pnpm', ['exec', 'tauri', 'build', ...forward], {
const tauriConfig = join(desktopDir, 'tauri.conf.json');
const tauriBin = join(ROOT, 'node_modules', '.bin', 'tauri');
const r = spawnSync(tauriBin, ['build', '--config', tauriConfig, ...forward], {
cwd: desktopDir,
env: process.env,
stdio: 'inherit',
Expand Down
28 changes: 27 additions & 1 deletion scripts/dev.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,29 @@ function runCommand(command, cwd = ROOT_DIR) {
});
}

/**
* Spawn a command with explicit args array (no shell interpolation, safe for paths with spaces)
*/
function spawnCommand(cmd, args, cwd = ROOT_DIR) {
return new Promise((resolve, reject) => {
const child = spawn(cmd, args, {
cwd,
stdio: 'inherit',
shell: true,
});

child.on('close', (code) => {
if (code === 0) {
resolve();
} else {
reject(new Error(`Command failed with code ${code}`));
}
});

child.on('error', reject);
});
}

/**
* Main entry
*/
Expand Down Expand Up @@ -191,7 +214,10 @@ async function main() {
process.exit(1);
}
}
await runCommand('pnpm exec tauri dev', path.join(ROOT_DIR, 'src/apps/desktop'));
const desktopDir = path.join(ROOT_DIR, 'src/apps/desktop');
const tauriConfig = path.join(desktopDir, 'tauri.conf.json');
const tauriBin = path.join(ROOT_DIR, 'node_modules', '.bin', 'tauri');
await spawnCommand(tauriBin, ['dev', '--config', tauriConfig], desktopDir);
} else {
await runCommand('pnpm exec vite', path.join(ROOT_DIR, 'src/web-ui'));
}
Expand Down
2 changes: 1 addition & 1 deletion src/apps/desktop/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"productName": "BitFun",
"identifier": "com.bitfun.desktop",
"build": {
"beforeDevCommand": "pnpm run type-check:web && pnpm run dev:web",
"beforeDevCommand": "pnpm run dev:web",
"devUrl": "http://localhost:1422",
"beforeBuildCommand": "pnpm run build:web && pnpm run prepare:mobile-web",
"frontendDist": "../../../dist"
Expand Down
Loading