Skip to content

Commit 37495a2

Browse files
committed
other path2 migrations (#2493)
1 parent 186a0b2 commit 37495a2

File tree

14 files changed

+39
-41
lines changed

14 files changed

+39
-41
lines changed

.github/actions/desktop-e2e-linux/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ runs:
4040
id: e2e-test
4141
run: |
4242
# Run tests and capture output to log file
43-
pnpm -F e2e-blackbox test 2>&1 | tee "${{ env.E2E_LOGS_DIR }}/e2e-test-output.log"
43+
pnpm -F e2e-blackbox e2e 2>&1 | tee "${{ env.E2E_LOGS_DIR }}/e2e-test-output.log"
4444
exit ${PIPESTATUS[0]}
4545
env:
4646
APP_BINARY_PATH: ${{ env.APP_BINARY_PATH }}

Cargo.lock

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/desktop/src/store/tinybase/localPersister2.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ import { SCHEMA, type Schemas } from "@hypr/store";
55

66
import { createLocalPersister2 } from "./localPersister2";
77

8-
vi.mock("@tauri-apps/api/path", () => ({
9-
appDataDir: vi.fn().mockResolvedValue("/mock/data/dir/"),
8+
vi.mock("@hypr/plugin-path2", () => ({
9+
commands: {
10+
base: vi.fn().mockResolvedValue("/mock/data/dir/"),
11+
},
1012
}));
1113

1214
vi.mock("@tauri-apps/plugin-fs", () => ({

apps/desktop/src/store/tinybase/localPersister2.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { appDataDir } from "@tauri-apps/api/path";
21
import { exists, mkdir } from "@tauri-apps/plugin-fs";
32
import { createCustomPersister } from "tinybase/persisters/with-schemas";
43
import type { MergeableStore, OptionalSchemas } from "tinybase/with-schemas";
54

65
import { commands, type JsonValue } from "@hypr/plugin-export";
6+
import { commands as path2Commands } from "@hypr/plugin-path2";
77
import { type EnhancedNote, type Session } from "@hypr/store";
88
import { isValidTiptapContent } from "@hypr/tiptap/shared";
99

@@ -28,7 +28,7 @@ export function createLocalPersister2<Schemas extends OptionalSchemas>(
2828
const batchItems: [JsonValue, string][] = [];
2929
const dirsToCreate = new Set<string>();
3030

31-
const dataDir = await appDataDir();
31+
const dataDir = await path2Commands.base();
3232

3333
for (const [id, row] of Object.entries(tables?.enhanced_notes ?? {})) {
3434
// @ts-ignore

apps/desktop/src/store/zustand/listener/general.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { getIdentifier } from "@tauri-apps/api/app";
2-
import { appDataDir } from "@tauri-apps/api/path";
32
import { Effect, Exit } from "effect";
43
import { create as mutate } from "mutative";
54
import type { StoreApi } from "zustand";
@@ -18,6 +17,7 @@ import {
1817
commands as listener2Commands,
1918
events as listener2Events,
2019
} from "@hypr/plugin-listener2";
20+
import { commands as path2Commands } from "@hypr/plugin-path2";
2121

2222
import { fromResult } from "../../../effect";
2323
import type { BatchActions, BatchState } from "./batch";
@@ -205,7 +205,7 @@ export const createGeneralSlice = <
205205
const [dataDirPath, micUsingApps, bundleId] = yield* Effect.tryPromise({
206206
try: () =>
207207
Promise.all([
208-
appDataDir(),
208+
path2Commands.base(),
209209
detectCommands
210210
.listMicUsingApplications()
211211
.then((r) =>
@@ -291,8 +291,8 @@ export const createGeneralSlice = <
291291
onSuccess: () => {
292292
if (sessionId) {
293293
void Promise.all([
294-
appDataDir(),
295-
getIdentifier().catch(() => "com.hyprnote.app"),
294+
path2Commands.base(),
295+
getIdentifier().catch(() => "com.hyprnote.stable"),
296296
])
297297
.then(([dataDirPath, bundleId]) => {
298298
const sessionPath = `${dataDirPath}/hyprnote/sessions/${sessionId}`;

e2e/blackbox/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"type": "module",
66
"scripts": {
7-
"test": "wdio run wdio.blackbox.conf.ts"
7+
"e2e": "wdio run wdio.blackbox.conf.ts"
88
},
99
"devDependencies": {
1010
"@wdio/cli": "^9.21.1",

plugins/hooks/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ tokio = { workspace = true, features = ["macros", "rt"] }
1717
hypr-docs = { workspace = true }
1818

1919
[dependencies]
20+
tauri-plugin-path2 = { workspace = true }
21+
2022
tauri = { workspace = true, features = ["test"] }
2123
tauri-specta = { workspace = true, features = ["derive", "typescript"] }
2224

@@ -30,5 +32,3 @@ futures-util = { workspace = true }
3032
shellexpand = { workspace = true }
3133
thiserror = { workspace = true }
3234
tokio = { workspace = true, features = ["process", "time"] }
33-
34-
tauri-plugin-path2 = { path = "../path2" }

plugins/listener2/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ tauri-plugin = { workspace = true, features = ["build"] }
1414
specta-typescript = { workspace = true }
1515

1616
[dependencies]
17+
tauri-plugin-path2 = { workspace = true }
18+
1719
hypr-audio-utils = { workspace = true }
1820
hypr-language = { workspace = true }
1921

@@ -36,5 +38,3 @@ tokio-stream = { workspace = true }
3638
tracing = { workspace = true }
3739

3840
aspasia = "0.2.1"
39-
40-
tauri-plugin-path2 = { path = "../path2" }

plugins/misc/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ indoc = { workspace = true }
1616
specta-typescript = { workspace = true }
1717

1818
[dependencies]
19+
tauri-plugin-opener = { workspace = true }
20+
tauri-plugin-path2 = { workspace = true }
21+
1922
hypr-audio-utils = { workspace = true }
2023
hypr-buffer = { workspace = true }
2124
hypr-host = { workspace = true }
2225

2326
tauri = { workspace = true, features = ["test"] }
24-
tauri-plugin-opener = { workspace = true }
2527
tauri-specta = { workspace = true, features = ["derive", "typescript"] }
2628

2729
dirs = { workspace = true }
@@ -31,5 +33,3 @@ rodio = { workspace = true, features = ["wav"] }
3133
specta = { workspace = true }
3234
sysinfo = { workspace = true }
3335
thiserror = { workspace = true }
34-
35-
tauri-plugin-path2 = { path = "../path2" }

plugins/path2/js/bindings.gen.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,8 @@
66

77

88
export const commands = {
9-
async base() : Promise<Result<string, string>> {
10-
try {
11-
return { status: "ok", data: await TAURI_INVOKE("plugin:path2|base") };
12-
} catch (e) {
13-
if(e instanceof Error) throw e;
14-
else return { status: "error", error: e as any };
15-
}
9+
async base() : Promise<string> {
10+
return await TAURI_INVOKE("plugin:path2|base");
1611
}
1712
}
1813

0 commit comments

Comments
 (0)