-
Notifications
You must be signed in to change notification settings - Fork 14
chore: remove Tauri compatibility leftovers #93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f53ff75
chore(desktop): remove Tauri migration leftovers
Astro-Han ab3f677
chore(app): rename Tauri drag regions
Astro-Han 1b849f8
chore(server): drop Tauri CORS origins
Astro-Han ab0573c
test: address Tauri cleanup review feedback
Astro-Han 68afc72
chore(app): remove redundant drag attribute
Astro-Han File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import { describe, expect, test } from "bun:test" | ||
|
|
||
| async function readSource(path: string, description: string) { | ||
| const url = new URL(path, import.meta.url) | ||
|
|
||
| try { | ||
| return await Bun.file(url).text() | ||
| } catch (err) { | ||
| throw new Error(`Expected ${description} at ${url.pathname}. Update this test if the monorepo layout changes.`, { | ||
| cause: err, | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| const titlebarSource = await readSource("./titlebar.tsx", "titlebar component source") | ||
| // Monorepo layout: packages/app/src/components -> packages/ui/src/styles. | ||
| const baseCssSource = await readSource("../../../ui/src/styles/base.css", "shared UI base CSS") | ||
|
|
||
| describe("titlebar Tauri compatibility cleanup", () => { | ||
| test("titlebar no longer references Tauri globals or Tauri DOM attributes", () => { | ||
| expect(titlebarSource).not.toContain("__TAURI__") | ||
| expect(titlebarSource).not.toContain("tauriApi") | ||
| expect(titlebarSource).not.toContain("data-tauri") | ||
| expect(titlebarSource).not.toContain("Tauri") | ||
| }) | ||
|
|
||
| test("titlebar uses shell-neutral drag regions", () => { | ||
| expect(titlebarSource).toContain("data-shell-drag-region") | ||
| expect(baseCssSource).toContain("[data-shell-drag-region]") | ||
| expect(baseCssSource).toContain("app-region: drag") | ||
| expect(baseCssSource).toContain("app-region: no-drag") | ||
| expect(baseCssSource).not.toContain("data-tauri-drag-region") | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,36 @@ | ||
| # OpenCode Desktop | ||
| # PawWork Desktop | ||
|
|
||
| Native OpenCode desktop app, built with Tauri v2. | ||
| Native PawWork desktop app, built with Electron. | ||
|
|
||
| ## Development | ||
|
|
||
| From the repo root: | ||
|
|
||
| ```bash | ||
| bun install | ||
| bun run --cwd packages/desktop tauri dev | ||
| bun run --cwd packages/desktop-electron dev | ||
| ``` | ||
|
|
||
| This starts the Vite dev server on http://localhost:1420 and opens the native window. | ||
| This starts the Electron shell and renderer development server. | ||
|
|
||
| If you only want the web dev server (no native shell): | ||
| ## Build | ||
|
|
||
| To build the Electron main process, preload script, and renderer: | ||
|
|
||
| ```bash | ||
| bun run --cwd packages/desktop dev | ||
| bun run --cwd packages/desktop-electron build | ||
| ``` | ||
|
|
||
| ## Build | ||
|
|
||
| To create a production `dist/` and build the native app bundle: | ||
| To create a local desktop package: | ||
|
|
||
| ```bash | ||
| bun run --cwd packages/desktop tauri build | ||
| bun run --cwd packages/desktop-electron package | ||
| ``` | ||
|
|
||
| ## Prerequisites | ||
| For platform-specific packages: | ||
|
|
||
| Running the desktop app requires additional Tauri dependencies (Rust toolchain, platform-specific libraries). See the [Tauri prerequisites](https://v2.tauri.app/start/prerequisites/) for setup instructions. | ||
| ```bash | ||
| bun run --cwd packages/desktop-electron package:mac | ||
| bun run --cwd packages/desktop-electron package:win | ||
| bun run --cwd packages/desktop-electron package:linux | ||
| ``` |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import { describe, expect, test } from "bun:test" | ||
| import { existsSync, readFileSync } from "node:fs" | ||
| import { join } from "node:path" | ||
| import { fileURLToPath } from "node:url" | ||
|
|
||
| const packageRoot = fileURLToPath(new URL("../../", import.meta.url)) | ||
|
|
||
| describe("Tauri cleanup", () => { | ||
| test("does not keep the old Tauri data migration module", () => { | ||
| expect(existsSync(join(packageRoot, "src/main/migrate.ts"))).toBe(false) | ||
| }) | ||
|
|
||
| test("desktop README documents Electron commands, not Tauri commands", () => { | ||
| const readme = readFileSync(join(packageRoot, "README.md"), "utf8") | ||
|
|
||
| expect(readme).toContain("bun run --cwd packages/desktop-electron dev") | ||
| expect(readme).toContain("bun run --cwd packages/desktop-electron package") | ||
| expect(readme).not.toMatch(/tauri/i) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import { describe, expect } from "bun:test" | ||
| import { Effect, Layer } from "effect" | ||
| import { Server } from "../../src/server/server" | ||
| import { Log } from "../../src/util/log" | ||
| import { testEffect } from "../lib/effect" | ||
|
|
||
| Log.init({ print: false }) | ||
|
|
||
| const it = testEffect(Layer.empty) | ||
|
|
||
| describe("CORS middleware", () => { | ||
| it.live("allows localhost browser origins", () => | ||
| Effect.gen(function* () { | ||
| const app = Server.Default().app | ||
| const response = yield* Effect.promise(() => | ||
| Promise.resolve( | ||
| app.request("/global/health", { | ||
| headers: { | ||
| Origin: "http://localhost:5173", | ||
| }, | ||
| }), | ||
| ), | ||
| ) | ||
|
|
||
| expect(response.status).toBe(200) | ||
| expect(response.headers.get("access-control-allow-origin")).toBe("http://localhost:5173") | ||
| }), | ||
| ) | ||
|
|
||
| it.live("does not allow legacy Tauri origins", () => | ||
| Effect.gen(function* () { | ||
| const app = Server.Default().app | ||
| const origins = ["tauri://localhost", "http://tauri.localhost", "https://tauri.localhost"] | ||
|
|
||
| for (const origin of origins) { | ||
| const response = yield* Effect.promise(() => | ||
| Promise.resolve( | ||
| app.request("/global/health", { | ||
| headers: { | ||
| Origin: origin, | ||
| }, | ||
| }), | ||
| ), | ||
| ) | ||
|
|
||
| expect(response.status).toBe(200) | ||
| expect(response.headers.get("access-control-allow-origin")).toBeNull() | ||
| } | ||
| }), | ||
| ) | ||
| }) | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.