mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-23 17:18:32 +02:00
Run oxfmt across repo, add format script and docs
Add .oxfmtignore to skip generated bindings and wasm-pack output. Add npm format script, update DEVELOPMENT.md for Vite+ toolchain, and format all non-generated files with oxfmt. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,24 +1,24 @@
|
||||
import { Channel, invoke } from '@tauri-apps/api/core';
|
||||
import { emit } from '@tauri-apps/api/event';
|
||||
import type { WatchResult } from '@yaakapp-internal/tauri';
|
||||
import { SyncOp } from './bindings/gen_sync';
|
||||
import { WatchEvent } from './bindings/gen_watch';
|
||||
import { Channel, invoke } from "@tauri-apps/api/core";
|
||||
import { emit } from "@tauri-apps/api/event";
|
||||
import type { WatchResult } from "@yaakapp-internal/tauri";
|
||||
import { SyncOp } from "./bindings/gen_sync";
|
||||
import { WatchEvent } from "./bindings/gen_watch";
|
||||
|
||||
export * from './bindings/gen_models';
|
||||
export * from "./bindings/gen_models";
|
||||
|
||||
export async function calculateSync(workspaceId: string, syncDir: string) {
|
||||
return invoke<SyncOp[]>('cmd_sync_calculate', {
|
||||
return invoke<SyncOp[]>("cmd_sync_calculate", {
|
||||
workspaceId,
|
||||
syncDir,
|
||||
});
|
||||
}
|
||||
|
||||
export async function calculateSyncFsOnly(dir: string) {
|
||||
return invoke<SyncOp[]>('cmd_sync_calculate_fs', { dir });
|
||||
return invoke<SyncOp[]>("cmd_sync_calculate_fs", { dir });
|
||||
}
|
||||
|
||||
export async function applySync(workspaceId: string, syncDir: string, syncOps: SyncOp[]) {
|
||||
return invoke<void>('cmd_sync_apply', {
|
||||
return invoke<void>("cmd_sync_apply", {
|
||||
workspaceId,
|
||||
syncDir,
|
||||
syncOps: syncOps,
|
||||
@@ -30,10 +30,10 @@ export function watchWorkspaceFiles(
|
||||
syncDir: string,
|
||||
callback: (e: WatchEvent) => void,
|
||||
) {
|
||||
console.log('Watching workspace files', workspaceId, syncDir);
|
||||
console.log("Watching workspace files", workspaceId, syncDir);
|
||||
const channel = new Channel<WatchEvent>();
|
||||
channel.onmessage = callback;
|
||||
const unlistenPromise = invoke<WatchResult>('cmd_sync_watch', {
|
||||
const unlistenPromise = invoke<WatchResult>("cmd_sync_watch", {
|
||||
workspaceId,
|
||||
syncDir,
|
||||
channel,
|
||||
@@ -46,7 +46,7 @@ export function watchWorkspaceFiles(
|
||||
return () =>
|
||||
unlistenPromise
|
||||
.then(async ({ unlistenEvent }) => {
|
||||
console.log('Unwatching workspace files', workspaceId, syncDir);
|
||||
console.log("Unwatching workspace files", workspaceId, syncDir);
|
||||
unlistenToWatcher(unlistenEvent);
|
||||
})
|
||||
.catch(console.error);
|
||||
@@ -59,11 +59,11 @@ function unlistenToWatcher(unlistenEvent: string) {
|
||||
}
|
||||
|
||||
function getWatchKeys() {
|
||||
return sessionStorage.getItem('workspace-file-watchers')?.split(',').filter(Boolean) ?? [];
|
||||
return sessionStorage.getItem("workspace-file-watchers")?.split(",").filter(Boolean) ?? [];
|
||||
}
|
||||
|
||||
function setWatchKeys(keys: string[]) {
|
||||
sessionStorage.setItem('workspace-file-watchers', keys.join(','));
|
||||
sessionStorage.setItem("workspace-file-watchers", keys.join(","));
|
||||
}
|
||||
|
||||
function addWatchKey(key: string) {
|
||||
@@ -79,6 +79,6 @@ function removeWatchKey(key: string) {
|
||||
// On page load, unlisten to all zombie watchers
|
||||
const keys = getWatchKeys();
|
||||
if (keys.length > 0) {
|
||||
console.log('Unsubscribing to zombie file watchers', keys);
|
||||
console.log("Unsubscribing to zombie file watchers", keys);
|
||||
keys.forEach(unlistenToWatcher);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@yaakapp-internal/sync",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"main": "index.ts"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user