Align Tauri dev flow with shared renderer
This commit is contained in:
3
.github/workflows/build-and-upload.yml
vendored
3
.github/workflows/build-and-upload.yml
vendored
@@ -337,9 +337,6 @@ jobs:
|
|||||||
- name: Ensure rollup native binary
|
- name: Ensure rollup native binary
|
||||||
run: npm install @rollup/rollup-linux-x64-gnu --no-save
|
run: npm install @rollup/rollup-linux-x64-gnu --no-save
|
||||||
|
|
||||||
- name: Bundle server assets for Tauri
|
|
||||||
run: npm run bundle:server --workspace @codenomad/tauri-app
|
|
||||||
|
|
||||||
- name: Build Linux bundle (Tauri)
|
- name: Build Linux bundle (Tauri)
|
||||||
run: npm run build --workspace @codenomad/tauri-app
|
run: npm run build --workspace @codenomad/tauri-app
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,14 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "tauri dev",
|
"dev": "tauri dev",
|
||||||
|
"dev:ui": "npm run dev --workspace @codenomad/ui",
|
||||||
|
"dev:prep": "node ./scripts/dev-prep.js",
|
||||||
|
"dev:bootstrap": "npm run dev:prep && npm run dev:ui",
|
||||||
"prebuild": "node ./scripts/prebuild.js",
|
"prebuild": "node ./scripts/prebuild.js",
|
||||||
"bundle:server": "npm --workspace @neuralnomads/codenomad run build && npm run prebuild",
|
"bundle:server": "npm --workspace @neuralnomads/codenomad run build && npm run prebuild",
|
||||||
"build": "tauri build"
|
"build": "tauri build"
|
||||||
},
|
},
|
||||||
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tauri-apps/cli": "^2.9.4"
|
"@tauri-apps/cli": "^2.9.4"
|
||||||
}
|
}
|
||||||
|
|||||||
46
packages/tauri-app/scripts/dev-prep.js
Normal file
46
packages/tauri-app/scripts/dev-prep.js
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
const fs = require("fs")
|
||||||
|
const path = require("path")
|
||||||
|
const { execSync } = require("child_process")
|
||||||
|
|
||||||
|
const root = path.resolve(__dirname, "..")
|
||||||
|
const workspaceRoot = path.resolve(root, "..", "..")
|
||||||
|
const uiRoot = path.resolve(root, "..", "ui")
|
||||||
|
const uiDist = path.resolve(uiRoot, "src", "renderer", "dist")
|
||||||
|
const uiLoadingDest = path.resolve(root, "src-tauri", "resources", "ui-loading")
|
||||||
|
|
||||||
|
function ensureUiBuild() {
|
||||||
|
const loadingHtml = path.join(uiDist, "loading.html")
|
||||||
|
if (fs.existsSync(loadingHtml)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("[dev-prep] UI loader build missing; running workspace build…")
|
||||||
|
execSync("npm --workspace @codenomad/ui run build", {
|
||||||
|
cwd: workspaceRoot,
|
||||||
|
stdio: "inherit",
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!fs.existsSync(loadingHtml)) {
|
||||||
|
throw new Error("[dev-prep] failed to produce loading.html after UI build")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyUiLoadingAssets() {
|
||||||
|
const loadingSource = path.join(uiDist, "loading.html")
|
||||||
|
const assetsSource = path.join(uiDist, "assets")
|
||||||
|
|
||||||
|
fs.rmSync(uiLoadingDest, { recursive: true, force: true })
|
||||||
|
fs.mkdirSync(uiLoadingDest, { recursive: true })
|
||||||
|
|
||||||
|
fs.copyFileSync(loadingSource, path.join(uiLoadingDest, "loading.html"))
|
||||||
|
if (fs.existsSync(assetsSource)) {
|
||||||
|
fs.cpSync(assetsSource, path.join(uiLoadingDest, "assets"), { recursive: true })
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`[dev-prep] copied loader bundle from ${uiDist}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
ensureUiBuild()
|
||||||
|
copyUiLoadingAssets()
|
||||||
@@ -4,10 +4,13 @@
|
|||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"identifier": "ai.opencode.client",
|
"identifier": "ai.opencode.client",
|
||||||
"build": {
|
"build": {
|
||||||
"beforeDevCommand": "npm run prebuild",
|
"beforeDevCommand": "npm run dev:bootstrap",
|
||||||
"beforeBuildCommand": "npm run bundle:server",
|
"beforeBuildCommand": "npm run bundle:server",
|
||||||
"frontendDist": "resources/ui-loading"
|
"frontendDist": "resources/ui-loading"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"app": {
|
"app": {
|
||||||
"withGlobalTauri": true,
|
"withGlobalTauri": true,
|
||||||
"windows": [
|
"windows": [
|
||||||
|
|||||||
Reference in New Issue
Block a user