trial: monoreponised

some trivial fix
This commit is contained in:
vorotamoroz
2026-06-12 05:10:18 +01:00
parent 1e7c1db1c4
commit b62a565c8a
20 changed files with 476 additions and 84 deletions
+1
View File
@@ -1,2 +1,3 @@
pouchdb-browser.js
main_org.js
_types
@@ -93,7 +93,7 @@ export declare class TrysteroReplicatorP2PServer {
_acceptablePeers: Computed<[settings: P2PSyncSetting], RegExp[]>;
_shouldDenyPeers: Computed<[settings: P2PSyncSetting], RegExp[]>;
isAcceptablePeer(peerId: string): Promise<boolean | undefined>;
__send(data: Payload, peerId: string): Promise<any>;
__send(data: Payload, peerId: string): Promise<void[] | undefined>;
processArrivedRPC(data: Payload, peerId: string): Promise<void>;
private _onPeerJoin;
private _onPeerLeave;
+67
View File
@@ -0,0 +1,67 @@
import tsParser from "@typescript-eslint/parser";
import tsPlugin from "@typescript-eslint/eslint-plugin";
import svelteParser from "svelte-eslint-parser";
const warnWhileDev = "off";
export const tsBaseRules = {
// -- Base rules (turned off in favour of TS specific versions or explicitly disabled).
"no-unused-vars": "off",
"no-unused-labels": "off",
"no-prototype-builtins": "off",
"require-await": "off",
// -- TypeScript specific rules
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-redundant-type-constituents": "warn",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-deprecated": warnWhileDev,
"@typescript-eslint/no-unused-vars": ["error", { args: "none" }],
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/require-await": "error",
"@typescript-eslint/no-misused-promises": "error",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
// -- General rules
"no-async-promise-executor": warnWhileDev,
"no-constant-condition": ["error", { checkLoops: false }],
"no-undef": "off",
};
export const tsBaseConfig = {
files: ["**/*.ts"],
plugins: {
"@typescript-eslint": tsPlugin,
},
languageOptions: {
parser: tsParser,
parserOptions: {
project: "./tsconfig.json",
rootDir: "./",
},
},
rules: tsBaseRules,
};
export const svelteBaseConfig = {
files: ["**/*.svelte"],
plugins: {
"@typescript-eslint": tsPlugin,
},
languageOptions: {
parser: svelteParser,
parserOptions: {
parser: tsParser,
extraFileExtensions: [".svelte"],
rootDir: "./",
},
},
rules: {
"no-unused-vars": "off",
},
};
+12 -58
View File
@@ -5,6 +5,7 @@ import { defineConfig, globalIgnores } from "eslint/config";
import * as sveltePlugin from "eslint-plugin-svelte";
import svelteParser from "svelte-eslint-parser";
import importAlias from "@dword-design/eslint-plugin-import-alias";
import { tsBaseConfig, svelteBaseConfig } from "./eslint.config.common.mjs";
const warnWhileDev = "off"; // Change to "warn" to enable warnings for rules that are currently disabled.
export default defineConfig([
globalIgnores([
@@ -57,63 +58,21 @@ export default defineConfig([
...obsidianmd.configs.recommended,
importAlias.configs.recommended,
{
files: ["**/*.ts"],
// ignores:["src/lib/**/*.ts"], // Exclude library files from root linting (they have different environments and rules).
...tsBaseConfig,
languageOptions: {
...tsBaseConfig.languageOptions,
globals: { ...globals.browser, PouchDB: "readonly" },
parser: tsParser,
parserOptions: {
project: "./tsconfig.json",
},
},
linterOptions: {
reportUnusedDisableDirectives: false,
plugins: {
...tsBaseConfig.plugins,
},
rules: {
// -- Base rules (turned off in favour of TS specific versions or explicitly disabled).
"no-unused-vars": "off",
"no-unused-labels": "off",
"no-prototype-builtins": "off",
"require-await": "off",
// -- TypeScript specific rules (Gradual adoption of stricter rules, currently set to 'warn' for a while).
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-redundant-type-constituents": "warn",
// -- TypeScript specific rules
// @typescript-eslint/no-unsafe-* rules and @typescript-eslint/no-explicit-any:
// This project contains a lot of library-sh code where the use of `any` is often necessary and justified.
// Rules is now set to 'off' for a while.
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
// -- Reasonable rules.
"@typescript-eslint/no-deprecated": warnWhileDev,
"@typescript-eslint/no-unused-vars": ["error", { args: "none" }],
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/require-await": "error",
"@typescript-eslint/no-misused-promises": "error",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
...tsBaseConfig.rules,
// -- Obsidian rules
// obsidianmd/no-unsupported-api: usually this project checks for API support at runtime, so this rule is not critical but can be helpful to catch potential issues.
"obsidianmd/no-unsupported-api": warnWhileDev,
// -- General rules
"no-async-promise-executor": warnWhileDev,
"no-constant-condition": ["error", { checkLoops: false }],
// -- Disabled rules
// no-undef: This option breaks the global declarations for the library files and is not worth the effort to fix at this time.
"no-undef": "off",
// -- Plugin specific overrides
"obsidianmd/rule-custom-message": "off",
"obsidianmd/ui/sentence-case": "off",
"obsidianmd/no-plugin-as-component": "off",
// -- Temporary overrides for migration
"obsidianmd/no-static-styles-assignment": "off",
// -- Project specific rules
@@ -130,21 +89,16 @@ export default defineConfig([
},
},
{
files: ["**/*.svelte"],
...svelteBaseConfig,
languageOptions: {
...svelteBaseConfig.languageOptions,
globals: { ...globals.browser, PouchDB: "readonly" },
parser: svelteParser,
parserOptions: {
parser: tsParser,
extraFileExtensions: [".svelte"],
project: "./tsconfig.json",
},
},
plugins: {
...svelteBaseConfig.plugins,
},
rules: {
// no-unused-vars:
// Svelte template's declarations have a lot of false positives and the rule is not worth the effort to fix at this time.
// it may improve in the future with some options as like ["error", { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }],]
"no-unused-vars": "off",
...svelteBaseConfig.rules,
"obsidianmd/no-plugin-as-component": "off",
"obsidianmd/ui/sentence-case": "off",
"@dword-design/import-alias/prefer-alias": [
+127 -3
View File
@@ -8,6 +8,11 @@
"name": "obsidian-livesync",
"version": "0.25.74",
"license": "MIT",
"workspaces": [
"src/apps/cli",
"src/apps/webpeer",
"src/apps/webapp"
],
"dependencies": {
"@aws-sdk/client-s3": "^3.808.0",
"@smithy/fetch-http-handler": "^5.3.10",
@@ -4695,7 +4700,6 @@
"integrity": "sha512-SR7FqgegaexEg73xvf3ArtygXegagMdXnL0EZMpxrWvvhQxvicD/E8p0ib0J91riPRtQUViyh67Xjw3NqvyhVg==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@vitest/browser": "4.1.8",
"@vitest/mocker": "4.1.8",
@@ -4720,7 +4724,6 @@
"integrity": "sha512-lt3kovsyHwYe00wq4D1ti0Z974fWj4NLp6siqiyEufUpyFwK9Yhi7rBhac9JL5aA0zoMrJqc4vYPZRUnI7l7nw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@bcoe/v8-coverage": "^1.0.2",
"@vitest/utils": "4.1.8",
@@ -10585,6 +10588,10 @@
"uc.micro": "^2.0.0"
}
},
"node_modules/livesync-webapp": {
"resolved": "src/apps/webapp",
"link": true
},
"node_modules/locate-app": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/locate-app/-/locate-app-2.5.0.tgz",
@@ -11733,7 +11740,6 @@
"integrity": "sha512-vA30H8Nvkq/cPBnNw4Q8TWz1EJyqgpuinBcHET0YVJVFldr8JDNiU9LaWAE1KqSkRYazuaBhTpB5ZzShOezQ6A==",
"dev": true,
"license": "Apache-2.0",
"peer": true,
"dependencies": {
"playwright-core": "1.58.2"
},
@@ -12853,6 +12859,10 @@
"dev": true,
"license": "MIT"
},
"node_modules/self-hosted-livesync-cli": {
"resolved": "src/apps/cli",
"link": true
},
"node_modules/semver": {
"version": "7.8.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.1.tgz",
@@ -15845,6 +15855,10 @@
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==",
"license": "BSD-2-Clause"
},
"node_modules/webpeer": {
"resolved": "src/apps/webpeer",
"link": true
},
"node_modules/werift": {
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/werift/-/werift-0.23.0.tgz",
@@ -16517,6 +16531,116 @@
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
}
},
"src/apps/cli": {
"name": "self-hosted-livesync-cli",
"version": "0.25.74-cli",
"dependencies": {
"@aws-sdk/client-s3": "^3.808.0",
"@smithy/fetch-http-handler": "^5.3.10",
"@smithy/md5-js": "^4.2.9",
"@smithy/middleware-apply-body-checksum": "^4.3.9",
"@smithy/protocol-http": "^5.3.9",
"@smithy/querystring-builder": "^4.2.9",
"@smithy/types": "^4.14.3",
"@smithy/util-retry": "^4.4.5",
"@trystero-p2p/nostr": "^0.24.0",
"chokidar": "^4.0.0",
"diff-match-patch": "^1.0.5",
"fflate": "^0.8.2",
"idb": "^8.0.3",
"markdown-it": "^14.1.1",
"minimatch": "^10.2.2",
"obsidian": "^1.12.3",
"octagonal-wheels": "^0.1.46",
"pouchdb-adapter-leveldb": "^9.0.0",
"qrcode-generator": "^1.4.4",
"werift": "^0.23.0",
"xxhash-wasm-102": "npm:xxhash-wasm@^1.0.2"
},
"devDependencies": {
"@dword-design/eslint-plugin-import-alias": "^8.1.8",
"@eslint/js": "^9.39.3",
"@sveltejs/vite-plugin-svelte": "^6.2.4",
"@tsconfig/svelte": "^5.0.8",
"@types/deno": "^2.5.0",
"@types/diff-match-patch": "^1.0.36",
"@types/markdown-it": "^14.1.2",
"@types/micromatch": "^4.0.10",
"@types/node": "^24.10.13",
"@types/pouchdb": "^6.4.2",
"@types/pouchdb-adapter-http": "^6.1.6",
"@types/pouchdb-adapter-idb": "^6.1.7",
"@types/pouchdb-browser": "^6.1.5",
"@types/pouchdb-core": "^7.0.15",
"@types/pouchdb-mapreduce": "^6.1.10",
"@types/pouchdb-replication": "^6.4.7",
"@types/transform-pouch": "^1.0.6",
"@typescript-eslint/eslint-plugin": "^8.61.0",
"@typescript-eslint/parser": "8.61.0",
"@vitest/browser": "^4.1.8",
"@vitest/browser-playwright": "^4.1.8",
"@vitest/coverage-v8": "^4.1.8",
"dotenv-cli": "^11.0.0",
"esbuild": "0.25.0",
"esbuild-plugin-inline-worker": "^0.1.1",
"esbuild-svelte": "^0.9.4",
"eslint": "^9.39.3",
"eslint-plugin-obsidianmd": "^0.3.0",
"eslint-plugin-svelte": "^3.15.0",
"events": "^3.3.0",
"globals": "^14.0.0",
"playwright": "^1.58.2",
"postcss": "^8.5.6",
"pouchdb-adapter-http": "^9.0.0",
"pouchdb-adapter-idb": "^9.0.0",
"pouchdb-adapter-indexeddb": "^9.0.0",
"pouchdb-adapter-memory": "^9.0.0",
"pouchdb-core": "^9.0.0",
"pouchdb-errors": "^9.0.0",
"pouchdb-find": "^9.0.0",
"pouchdb-mapreduce": "^9.0.0",
"pouchdb-merge": "^9.0.0",
"pouchdb-replication": "^9.0.0",
"pouchdb-utils": "^9.0.0",
"prettier": "3.8.1",
"rollup-plugin-copy": "^3.5.0",
"svelte": "5.41.1",
"svelte-check": "^4.4.3",
"svelte-eslint-parser": "^1.8.0",
"svelte-preprocess": "^6.0.3",
"terser": "^5.39.0",
"tinyglobby": "^0.2.15",
"transform-pouch": "^2.0.0",
"tsx": "^4.21.0",
"typescript": "5.9.3",
"typescript-eslint": "^8.61.0",
"vite": "^7.3.1",
"vite-plugin-istanbul": "^8.0.0",
"vitest": "^4.1.8",
"webdriverio": "^9.27.0",
"yaml": "^2.8.2"
}
},
"src/apps/webapp": {
"name": "livesync-webapp",
"version": "0.0.1",
"devDependencies": {
"typescript": "5.9.3",
"vite": "^7.3.1"
}
},
"src/apps/webpeer": {
"version": "0.0.0",
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^6.2.4",
"@tsconfig/svelte": "^5.0.8",
"eslint-plugin-svelte": "^3.15.0",
"svelte": "5.41.1",
"svelte-check": "^4.4.3",
"typescript": "5.9.3",
"vite": "^7.3.1"
}
}
}
}
+7 -2
View File
@@ -16,7 +16,7 @@
"dev": "node --env-file=.env esbuild.config.mjs",
"prebuild": "npm run bakei18n",
"build": "node esbuild.config.mjs production",
"lib:build:types":"node generate-types.mjs",
"lib:build:types": "node generate-types.mjs",
"postbuild": "npm run lib:build:types",
"buildVite": "npx dotenv-cli -e .env -- vite build --mode production",
"buildViteOriginal": "npx dotenv-cli -e .env -- vite build --mode original",
@@ -147,5 +147,10 @@
"qrcode-generator": "^1.4.4",
"werift": "^0.23.0",
"xxhash-wasm-102": "npm:xxhash-wasm@^1.0.2"
}
},
"workspaces": [
"src/apps/cli",
"src/apps/webpeer",
"src/apps/webapp"
]
}
+19
View File
@@ -0,0 +1,19 @@
import { tsBaseConfig } from "../../../eslint.config.common.mjs";
import globals from "globals";
import { defineConfig, globalIgnores } from "eslint/config";
export default defineConfig([
globalIgnores([
"dist",
"node_modules",
"test",
"testdeno"
]),
{
...tsBaseConfig,
languageOptions: {
...tsBaseConfig.languageOptions,
globals: { ...globals.node },
},
}
]);
+90 -4
View File
@@ -1,18 +1,20 @@
{
"name": "self-hosted-livesync-cli",
"private": true,
"version": "0.0.0",
"version": "0.25.74-cli",
"main": "dist/index.cjs",
"type": "module",
"scripts": {
"dev": "vite",
"package:apply-repo": "node scripts/apply-package.mjs",
"prebuild": "node scripts/check-submodule.mjs",
"build": "vite build",
"preview": "vite preview",
"cli": "node dist/index.cjs",
"buildRun": "npm run build && npm run cli --",
"build:docker": "docker build -f Dockerfile -t livesync-cli ../../..",
"check": "svelte-check --tsconfig ./tsconfig.app.json && tsc -p tsconfig.node.json",
"lint": "eslint --cache .",
"check": "tsc --noEmit",
"test:unit": "cd ../../.. && npx vitest run --config vitest.config.unit.ts src/apps/cli/main.unit.spec.ts src/apps/cli/commands/utils.unit.spec.ts src/apps/cli/commands/runCommand.unit.spec.ts src/apps/cli/commands/p2p.unit.spec.ts",
"test:e2e:two-vaults": "bash test/test-e2e-two-vaults-with-docker-linux.sh",
"test:e2e:two-vaults:common": "bash test/test-e2e-two-vaults-common.sh",
@@ -38,6 +40,90 @@
"test:e2e:docker:p2p-sync": "RUN_BUILD=0 LIVESYNC_TEST_DOCKER=1 bash test/test-p2p-sync-linux.sh",
"test:e2e:docker:all": "export RUN_BUILD=0 && npm run test:e2e:docker:setup-put-cat && npm run test:e2e:docker:push-pull && npm run test:e2e:docker:sync-two-local && npm run test:e2e:docker:mirror && npm run test:e2e:docker:remote-commands"
},
"dependencies": {},
"devDependencies": {}
"dependencies": {
"@aws-sdk/client-s3": "^3.808.0",
"@smithy/fetch-http-handler": "^5.3.10",
"@smithy/md5-js": "^4.2.9",
"@smithy/middleware-apply-body-checksum": "^4.3.9",
"@smithy/protocol-http": "^5.3.9",
"@smithy/querystring-builder": "^4.2.9",
"@smithy/types": "^4.14.3",
"@smithy/util-retry": "^4.4.5",
"@trystero-p2p/nostr": "^0.24.0",
"chokidar": "^4.0.0",
"diff-match-patch": "^1.0.5",
"fflate": "^0.8.2",
"idb": "^8.0.3",
"markdown-it": "^14.1.1",
"minimatch": "^10.2.2",
"obsidian": "^1.12.3",
"octagonal-wheels": "^0.1.46",
"pouchdb-adapter-leveldb": "^9.0.0",
"qrcode-generator": "^1.4.4",
"werift": "^0.23.0",
"xxhash-wasm-102": "npm:xxhash-wasm@^1.0.2"
},
"devDependencies": {
"@dword-design/eslint-plugin-import-alias": "^8.1.8",
"@eslint/js": "^9.39.3",
"@sveltejs/vite-plugin-svelte": "^6.2.4",
"@tsconfig/svelte": "^5.0.8",
"@types/deno": "^2.5.0",
"@types/diff-match-patch": "^1.0.36",
"@types/markdown-it": "^14.1.2",
"@types/micromatch": "^4.0.10",
"@types/node": "^24.10.13",
"@types/pouchdb": "^6.4.2",
"@types/pouchdb-adapter-http": "^6.1.6",
"@types/pouchdb-adapter-idb": "^6.1.7",
"@types/pouchdb-browser": "^6.1.5",
"@types/pouchdb-core": "^7.0.15",
"@types/pouchdb-mapreduce": "^6.1.10",
"@types/pouchdb-replication": "^6.4.7",
"@types/transform-pouch": "^1.0.6",
"@typescript-eslint/eslint-plugin": "^8.61.0",
"@typescript-eslint/parser": "8.61.0",
"@vitest/browser": "^4.1.8",
"@vitest/browser-playwright": "^4.1.8",
"@vitest/coverage-v8": "^4.1.8",
"dotenv-cli": "^11.0.0",
"esbuild": "0.25.0",
"esbuild-plugin-inline-worker": "^0.1.1",
"esbuild-svelte": "^0.9.4",
"eslint": "^9.39.3",
"eslint-plugin-obsidianmd": "^0.3.0",
"eslint-plugin-svelte": "^3.15.0",
"events": "^3.3.0",
"globals": "^14.0.0",
"playwright": "^1.58.2",
"postcss": "^8.5.6",
"pouchdb-adapter-http": "^9.0.0",
"pouchdb-adapter-idb": "^9.0.0",
"pouchdb-adapter-indexeddb": "^9.0.0",
"pouchdb-adapter-memory": "^9.0.0",
"pouchdb-core": "^9.0.0",
"pouchdb-errors": "^9.0.0",
"pouchdb-find": "^9.0.0",
"pouchdb-mapreduce": "^9.0.0",
"pouchdb-merge": "^9.0.0",
"pouchdb-replication": "^9.0.0",
"pouchdb-utils": "^9.0.0",
"prettier": "3.8.1",
"rollup-plugin-copy": "^3.5.0",
"svelte": "5.41.1",
"svelte-check": "^4.4.3",
"svelte-eslint-parser": "^1.8.0",
"svelte-preprocess": "^6.0.3",
"terser": "^5.39.0",
"tinyglobby": "^0.2.15",
"transform-pouch": "^2.0.0",
"tsx": "^4.21.0",
"typescript": "5.9.3",
"typescript-eslint": "^8.61.0",
"vite": "^7.3.1",
"vite-plugin-istanbul": "^8.0.0",
"vitest": "^4.1.8",
"webdriverio": "^9.27.0",
"yaml": "^2.8.2"
}
}
+28
View File
@@ -0,0 +1,28 @@
// Copy package.json dependencies and devDependencies from the repo root to the cli package.json, and set the version to match the repo root version with a -cli suffix.
import fs from "node:fs";
import path from "node:path";
import process from "node:process";
const cliDir = process.cwd();
const repoRoot = path.resolve(cliDir, "../../..");
const repoPackageJsonPath = path.join(repoRoot, "package.json");
const repoPackageJson = JSON.parse(fs.readFileSync(repoPackageJsonPath, "utf-8"));
const devDependenciesToCopy = repoPackageJson.devDependencies || {};
const dependenciesToCopy = repoPackageJson.dependencies || {};
const packageJsonPath = path.join(cliDir, "package.json");
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
packageJson.dependencies = {
...packageJson.dependencies,
...dependenciesToCopy,
};
packageJson.devDependencies = {
...packageJson.devDependencies,
...devDependenciesToCopy,
};
packageJson.version = `${repoPackageJson.version}-cli`;
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 4), "utf-8");
console.log("Applied package.json dependencies and version from repo root to cli package.json");
console.log(
"Please do not forget to pick dependencies that are actually needed in the cli package.json, and remove the ones that are not needed."
);
+8 -8
View File
@@ -16,17 +16,17 @@
/* Linting */
"strict": false,
// "noImplicitAny": false,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noFallthroughCasesInSwitch": true,
"noFallthroughCasesInSwitch": true
/* Path mapping */
"baseUrl": ".",
"paths": {
"@/*": ["../../*"],
"@lib/*": ["../../lib/src/*"]
}
// /* Path mapping */
// "paths": {
// "@/*": ["../../*"],
// "@lib/*": ["../../lib/src/*"]
// }
},
"include": ["*.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules", "dist"]
"exclude": ["node_modules", "dist", "test", "testdeno"]
}
+18
View File
@@ -0,0 +1,18 @@
import { tsBaseConfig } from "../../../eslint.config.common.mjs";
import globals from "globals";
import { defineConfig, globalIgnores } from "eslint/config";
export default defineConfig([
globalIgnores([
"dist",
"node_modules",
"test"
]),
{
...tsBaseConfig,
languageOptions: {
...tsBaseConfig.languageOptions,
globals: { ...globals.browser },
},
}
]);
+3 -1
View File
@@ -9,7 +9,9 @@
"build": "vite build",
"build:docker": "docker build -f Dockerfile -t livesync-webapp ../../..",
"run:docker": "docker run -p 8002:80 livesync-webapp",
"preview": "vite preview"
"preview": "vite preview",
"check": "tsc --noEmit",
"lint": "eslint --cache ."
},
"dependencies": {},
"devDependencies": {
+28
View File
@@ -0,0 +1,28 @@
import { tsBaseConfig, svelteBaseConfig } from "../../../eslint.config.common.mjs";
import globals from "globals";
import { defineConfig, globalIgnores } from "eslint/config";
import * as sveltePlugin from "eslint-plugin-svelte";
export default defineConfig([
globalIgnores([
"dist",
"node_modules"
]),
...sveltePlugin.configs["flat/base"],
{
...tsBaseConfig,
files: ["src/**/*.ts"],
languageOptions: {
...tsBaseConfig.languageOptions,
globals: { ...globals.browser },
},
},
{
...svelteBaseConfig,
files: ["src/**/*.svelte"],
languageOptions: {
...svelteBaseConfig.languageOptions,
globals: { ...globals.browser },
},
},
]);
+3 -2
View File
@@ -9,7 +9,8 @@
"build:docker": "docker build -f Dockerfile -t livesync-webpeer ../../..",
"run:docker": "docker run -p 8001:80 livesync-webpeer",
"preview": "vite preview",
"check": "svelte-check --tsconfig ./tsconfig.app.json && tsc -p tsconfig.node.json"
"check": "svelte-check --tsconfig ./tsconfig.app.json && tsc -p tsconfig.node.json",
"lint": "eslint --cache src"
},
"dependencies": {},
"devDependencies": {
@@ -17,7 +18,7 @@
"@sveltejs/vite-plugin-svelte": "^6.2.4",
"@tsconfig/svelte": "^5.0.8",
"svelte": "5.41.1",
"svelte-check": "^443.3",
"svelte-check": "^4.4.3",
"typescript": "5.9.3",
"vite": "^7.3.1"
},
+1 -1
View File
@@ -1,5 +1,5 @@
<script lang="ts">
import { Menu } from "@/lib/src/services/implements/browser/Menu";
import { Menu } from "@lib/services/implements/browser/Menu";
import { getDialogContext } from "@lib/services/implements/base/SvelteDialog";
let result = $state<string | boolean>("");
@@ -633,7 +633,7 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
}
}
display(): void {
override display(): void {
const changeDisplay = this.changeDisplay.bind(this);
const { containerEl } = this;
this.settingComponents.length = 0;
+1 -1
View File
@@ -23,6 +23,6 @@
"@lib/*": ["./src/lib/src/*", "./_types/src/lib/src/*"]
}
},
"include": ["**/*.ts", "test/**/*.test.ts", "**/*.unit.spec.ts"],
"include": ["**/*.ts", "test/**/*.test.ts", "**/*.unit.spec.ts", "**/*.svelte"],
"exclude": ["pouchdb-browser-webpack", "utils", "src/apps", "src/**/*.test.ts", "**/_test/**", "utilsdeno"]
}
+1 -1
View File
@@ -21,6 +21,6 @@
"utilsdeno",
"node_modules",
"test/**/*.test.ts",
"**/*.unit.spec.ts",
"**/*.unit.spec.ts"
]
}
+2 -1
View File
@@ -1,7 +1,8 @@
{
"version": "5",
"specifiers": {
"npm:ts-morph@*": "28.0.0"
"npm:ts-morph@*": "28.0.0",
"npm:ts-morph@latest": "28.0.0"
},
"npm": {
"@ts-morph/common@0.29.0": {
+58
View File
@@ -0,0 +1,58 @@
import { Project, SyntaxKind } from "npm:ts-morph";
function processFile(filePath: string) {
const project = new Project();
const sourceFile = project.addSourceFileAtPath(filePath);
// 1. Collect all 'any' type nodes in the file
const anyTypeNodes = sourceFile.getDescendantsOfKind(SyntaxKind.AnyKeyword);
const sourceText = sourceFile.getFullText();
const lineBreak = sourceText.includes("\r\n") ? "\r\n" : "\n";
const lines = sourceText.split(/\r?\n/);
const targetLines = new Set<number>();
// 2. Collect the line numbers that contain 'any'
anyTypeNodes.forEach((anyNode: any) => {
const { line } = sourceFile.getLineAndColumnAtPos(anyNode.getStart());
targetLines.add(line - 1);
});
// 3. Add an inline disable only to lines that contain 'any'
for (const lineIndex of targetLines) {
const line = lines[lineIndex];
if (!line) {
continue;
}
if (line.includes("eslint-disable-line @typescript-eslint/no-explicit-any")) {
continue;
}
lines[lineIndex] = `${line} // eslint-disable-line @typescript-eslint/no-explicit-any`;
}
const updatedSourceText = lines.join(lineBreak);
// Output the result
return updatedSourceText;
}
const targetDir = `../_types/`;
async function processDir(dirPath: string) {
for await (const entry of Deno.readDir(dirPath)) {
if (entry.isDirectory) {
await processDir(`${dirPath}/${entry.name}`);
}
if (entry.isFile && entry.name.endsWith(".d.ts")) {
const filePath = `${dirPath}/${entry.name}`;
console.log(`Processing: ${filePath}`);
const updatedContent = processFile(filePath);
// Write the file. To revert, regenerate it with npm run lib:build:types.
await Deno.writeTextFile(filePath, updatedContent);
// console.log(`Updated content for ${filePath}:\n${updatedContent}\n`);
console.log(`Processed: ${filePath}`);
}
}
}
await processDir(targetDir);