Move files
This commit is contained in:
parent
6bb051460e
commit
dd6f63f357
50 changed files with 72 additions and 78 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -7,8 +7,8 @@ node_modules
|
|||
# Rust build folder
|
||||
backend/target
|
||||
|
||||
obsidian-plugin/dist
|
||||
sync-client/dist
|
||||
frontend/obsidian-plugin/dist
|
||||
frontend/sync-client/dist
|
||||
|
||||
backend/db.sqlite3*
|
||||
backend/config.yml
|
||||
|
|
|
|||
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"jest.jestCommandLine": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" npx jest",
|
||||
"jest.rootPath": "plugin"
|
||||
"jest.rootPath": "plugin",
|
||||
"files.exclude": {
|
||||
"**/node_modules": true
|
||||
}
|
||||
}
|
||||
|
|
@ -56,7 +56,10 @@ export class ObsidianFileOperations implements FileOperations {
|
|||
}
|
||||
|
||||
await this.createParentDirectories(normalizePath(path));
|
||||
await this.vault.adapter.writeBinary(normalizePath(path), newContent);
|
||||
await this.vault.adapter.writeBinary(
|
||||
normalizePath(path),
|
||||
newContent.buffer as ArrayBuffer
|
||||
);
|
||||
}
|
||||
|
||||
public async write(
|
||||
|
|
@ -78,7 +81,7 @@ export class ObsidianFileOperations implements FileOperations {
|
|||
);
|
||||
await this.vault.adapter.writeBinary(
|
||||
normalizePath(path),
|
||||
newContent
|
||||
newContent.buffer as ArrayBuffer
|
||||
);
|
||||
return newContent;
|
||||
}
|
||||
|
|
@ -123,8 +123,7 @@ export default class VaultLinkPlugin extends Plugin {
|
|||
database.getSettings().fetchChangesUpdateIntervalMs
|
||||
);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
database.addOnSettingsChangeHandlers(async (settings, oldSettings) => {
|
||||
database.addOnSettingsChangeHandlers((settings, oldSettings) => {
|
||||
this.registerRemoteEventListener(
|
||||
database,
|
||||
syncService,
|
||||
|
|
@ -133,7 +132,13 @@ export default class VaultLinkPlugin extends Plugin {
|
|||
);
|
||||
|
||||
if (!oldSettings.isSyncEnabled && settings.isSyncEnabled) {
|
||||
await syncer.scheduleSyncForOfflineChanges();
|
||||
syncer
|
||||
.scheduleSyncForOfflineChanges()
|
||||
.catch((_error: unknown) => {
|
||||
Logger.getInstance().error(
|
||||
"Failed to schedule sync for offline changes"
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -2,13 +2,8 @@ import type { IconName, WorkspaceLeaf } from "obsidian";
|
|||
import { ItemView, setIcon } from "obsidian";
|
||||
|
||||
import { intlFormatDistance } from "date-fns";
|
||||
import type {
|
||||
SyncHistory,
|
||||
HistoryEntry,
|
||||
Database,
|
||||
RelativePath
|
||||
} from "sync-client";
|
||||
import { SyncType, SyncSource, SyncStatus } from "sync-client";
|
||||
import type { SyncHistory, HistoryEntry, Database } from "sync-client";
|
||||
import { SyncType, SyncSource, SyncStatus, Logger } from "sync-client";
|
||||
|
||||
export class HistoryView extends ItemView {
|
||||
public static readonly TYPE = "history-view";
|
||||
|
|
@ -23,9 +18,10 @@ export class HistoryView extends ItemView {
|
|||
super(leaf);
|
||||
this.icon = HistoryView.ICON;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
history.addSyncHistoryUpdateListener(async () => {
|
||||
await this.updateView();
|
||||
history.addSyncHistoryUpdateListener(() => {
|
||||
this.updateView().catch((_error: unknown) => {
|
||||
Logger.getInstance().error("Failed to update history view");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -65,6 +61,7 @@ export class HistoryView extends ItemView {
|
|||
}
|
||||
|
||||
element.createEl("span", {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
||||
text: entry.relativePath
|
||||
});
|
||||
|
||||
14
frontend/obsidian-plugin/tsconfig.json
Normal file
14
frontend/obsidian-plugin/tsconfig.json
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"module": "ESNext",
|
||||
"target": "ES2023",
|
||||
"noImplicitAny": true,
|
||||
"moduleResolution": "bundler",
|
||||
"strictNullChecks": true,
|
||||
"lib": [
|
||||
"DOM",
|
||||
"ESNext"
|
||||
]
|
||||
}
|
||||
}
|
||||
12
package-lock.json → frontend/package-lock.json
generated
12
package-lock.json → frontend/package-lock.json
generated
|
|
@ -17,12 +17,18 @@
|
|||
"typescript-eslint": "8.24.1"
|
||||
}
|
||||
},
|
||||
"backend/sync_lib/pkg": {
|
||||
"../backend/sync_lib/pkg": {
|
||||
"name": "sync_lib",
|
||||
"version": "0.0.30",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"backend/sync_lib/pkg": {
|
||||
"name": "sync_lib",
|
||||
"version": "0.0.30",
|
||||
"extraneous": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@ampproject/remapping": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz",
|
||||
|
|
@ -6584,7 +6590,7 @@
|
|||
}
|
||||
},
|
||||
"node_modules/sync_lib": {
|
||||
"resolved": "backend/sync_lib/pkg",
|
||||
"resolved": "../backend/sync_lib/pkg",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/sync-client": {
|
||||
|
|
@ -7485,7 +7491,7 @@
|
|||
"openapi-fetch": "0.13.4",
|
||||
"openapi-typescript": "7.6.1",
|
||||
"p-queue": "^8.1.0",
|
||||
"sync_lib": "file:../backend/sync_lib/pkg",
|
||||
"sync_lib": "file:../../backend/sync_lib/pkg",
|
||||
"ts-jest": "^29.2.5",
|
||||
"ts-loader": "^9.5.2",
|
||||
"tslib": "2.8.1",
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
"build": "npm run build --workspaces",
|
||||
"dev": "npm run dev --workspaces",
|
||||
"test": "npm run test --workspaces",
|
||||
"lint": "eslint --fix sync-client obsidian-plugin; prettier --write \"sync-client/**/*.(ts|scss|json|html)\" \"obsidian-plugin/**/*.(ts|scss|json|html)\"",
|
||||
"lint": "rm -rf **/dist/index.js && eslint --fix sync-client obsidian-plugin; prettier --write \"sync-client/**/*.(ts|scss|json|html)\" \"obsidian-plugin/**/*.(ts|scss|json|html)\"",
|
||||
"update": "ncu -u -ws"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
"name": "sync-client",
|
||||
"version": "1.0.0",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/types/src/index.d.ts",
|
||||
"types": "dist/types/index.d.ts",
|
||||
"scripts": {
|
||||
"dev": "webpack watch --mode development",
|
||||
"build": "webpack --mode production",
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
"devDependencies": {
|
||||
"tslib": "2.8.1",
|
||||
"typescript": "5.7.3",
|
||||
"sync_lib": "file:../backend/sync_lib/pkg",
|
||||
"sync_lib": "file:../../backend/sync_lib/pkg",
|
||||
"@types/jest": "^29.5.14",
|
||||
"@types/node": "^22.13.4",
|
||||
"jest": "^29.7.0",
|
||||
|
|
@ -25,4 +25,4 @@
|
|||
"webpack": "^5.98.0",
|
||||
"webpack-cli": "^6.0.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
import { RelativePath } from "../database/document-metadata";
|
||||
import {
|
||||
tryLockDocument,
|
||||
waitForDocumentLock,
|
||||
unlockDocument
|
||||
} from "./document-lock";
|
||||
import type { RelativePath } from "src/database/document-metadata";
|
||||
|
||||
describe("Document Lock Operations", () => {
|
||||
const testPath: RelativePath = "test/document/path";
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import type { RelativePath } from "src/database/document-metadata";
|
||||
import { RelativePath } from "../database/document-metadata";
|
||||
|
||||
const locked = new Set<RelativePath>();
|
||||
const waiters = new Map<RelativePath, (() => void)[]>();
|
||||
|
|
@ -4,7 +4,7 @@ import fs from "fs";
|
|||
describe("deserialize", () => {
|
||||
it("should serialize a Uint8Array to a base64 string", async () => {
|
||||
const wasmBin = fs.readFileSync(
|
||||
"../backend/sync_lib/pkg/sync_lib_bg.wasm"
|
||||
"../../backend/sync_lib/pkg/sync_lib_bg.wasm"
|
||||
);
|
||||
await init({ module_or_path: wasmBin });
|
||||
|
||||
|
|
@ -5,7 +5,7 @@ import fs from "fs";
|
|||
describe("serialize", () => {
|
||||
it("should serialize a Uint8Array to a base64 string", async () => {
|
||||
const wasmBin = fs.readFileSync(
|
||||
"../backend/sync_lib/pkg/sync_lib_bg.wasm"
|
||||
"../../backend/sync_lib/pkg/sync_lib_bg.wasm"
|
||||
);
|
||||
await init({ module_or_path: wasmBin });
|
||||
|
||||
15
frontend/sync-client/tsconfig.json
Normal file
15
frontend/sync-client/tsconfig.json
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"module": "ESNext",
|
||||
"target": "ESNext",
|
||||
"noImplicitAny": true,
|
||||
"moduleResolution": "bundler",
|
||||
"strictNullChecks": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"lib": [
|
||||
"DOM",
|
||||
"ESNext"
|
||||
]
|
||||
},
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"id": "vault-link",
|
||||
"name": "VaultLink",
|
||||
"version": "0.0.30",
|
||||
"minAppVersion": "0.0.0",
|
||||
"description": "Self-hosted synchronization and collaboration for your Vault.",
|
||||
"author": "Andras Schmelczer",
|
||||
"authorUrl": "https://schmelczer.dev",
|
||||
"isDesktopOnly": false
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"inlineSourceMap": true,
|
||||
"inlineSources": true,
|
||||
"module": "ESNext",
|
||||
"target": "ES6",
|
||||
"noImplicitAny": true,
|
||||
"moduleResolution": "bundler",
|
||||
"isolatedModules": true,
|
||||
"strictNullChecks": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"lib": [
|
||||
"DOM",
|
||||
"ES5",
|
||||
"ES6",
|
||||
"ES7"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts"
|
||||
]
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"baseUrl": ".",
|
||||
"target": "ES2022",
|
||||
"noImplicitAny": true,
|
||||
"moduleResolution": "node",
|
||||
"strictNullChecks": true,
|
||||
"esModuleInterop": true,
|
||||
"lib": [
|
||||
"DOM",
|
||||
"ESNext"
|
||||
]
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue