asch/fix-everything #188

Open
andras wants to merge 114 commits from asch/fix-everything into main
11 changed files with 2566 additions and 4163 deletions
Showing only changes of commit 904a2737d4 - Show all commits

Bump deps, improve e2e test and pick up changes in the plugin

Andras Schmelczer 2026-03-28 11:17:18 +00:00

View file

@ -8,12 +8,12 @@
## Develop ## Develop
### Install [nvm](https://github.com/nvm-sh/nvm) ### Set up Node.JS 25 with [nvm](https://github.com/nvm-sh/nvm)
- `curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash` - `curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash`
- `nvm install 22` - `nvm install 25`
- `nvm use 22` - `nvm use 25`
- Optionally set the system-wide default: `nvm alias default 22` - Optionally, set the system-wide default: `nvm alias default 25`
### Set up Rust ### Set up Rust

View file

@ -8,7 +8,7 @@ export default [
"sync-client/src/services/types.ts", "sync-client/src/services/types.ts",
"**/dist/", "**/dist/",
"**/*.mjs", "**/*.mjs",
"**/*.js" "**/*.js",
] ]
}, },
...tseslint.config({ ...tseslint.config({
@ -17,6 +17,7 @@ export default [
}, },
extends: [eslint.configs.recommended, tseslint.configs.all], extends: [eslint.configs.recommended, tseslint.configs.all],
rules: { rules: {
"no-console": "error",
"no-unused-vars": "off", "no-unused-vars": "off",
"@typescript-eslint/restrict-template-expressions": "off", "@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/no-unused-vars": "off", "@typescript-eslint/no-unused-vars": "off",

View file

@ -8,6 +8,7 @@ The repo depends on the latest plugin API (obsidian.d.ts) in TypeScript Definiti
**Note:** The Obsidian API is still in early alpha and is subject to change at any time! **Note:** The Obsidian API is still in early alpha and is subject to change at any time!
This sample plugin demonstrates some of the basic functionality the plugin API can do. This sample plugin demonstrates some of the basic functionality the plugin API can do.
- Adds a ribbon icon, which shows a Notice when clicked. - Adds a ribbon icon, which shows a Notice when clicked.
- Adds a command "Open Sample Modal" which opens a Modal. - Adds a command "Open Sample Modal" which opens a Modal.
- Adds a plugin setting tab to the settings page. - Adds a plugin setting tab to the settings page.
@ -57,31 +58,6 @@ Quick starting guide for new plugin devs:
- Copy over `main.js`, `styles.css`, `manifest.json` to your vault `VaultFolder/.obsidian/plugins/your-plugin-id/`. - Copy over `main.js`, `styles.css`, `manifest.json` to your vault `VaultFolder/.obsidian/plugins/your-plugin-id/`.
## Funding URL
You can include funding URLs where people who use your plugin can financially support it.
The simple way is to set the `fundingUrl` field to your link in your `manifest.json` file:
```json
{
"fundingUrl": "https://buymeacoffee.com"
}
```
If you have multiple URLs, you can also do:
```json
{
"fundingUrl": {
"Buy Me a Coffee": "https://buymeacoffee.com",
"GitHub Sponsor": "https://github.com/sponsors",
"Patreon": "https://www.patreon.com/"
}
}
```
## API Documentation ## API Documentation
See https://github.com/obsidianmd/obsidian-api See https://github.com/obsidianmd/obsidian-api

View file

@ -13,25 +13,25 @@
"author": "", "author": "",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@types/node": "^24.8.1", "@types/node": "^25.0.2",
"css-loader": "^7.1.2", "css-loader": "^7.1.2",
"date-fns": "^4.1.0", "date-fns": "^4.1.0",
"file-loader": "^6.2.0", "file-loader": "^6.2.0",
"fs-extra": "^11.3.0", "fs-extra": "^11.3.2",
"mini-css-extract-plugin": "^2.9.2", "mini-css-extract-plugin": "^2.9.4",
"obsidian": "1.10.2", "obsidian": "1.11.0",
"reconcile-text": "^0.8.0", "reconcile-text": "^0.11.0",
"resolve-url-loader": "^5.0.0", "resolve-url-loader": "^5.0.0",
"sass": "^1.91.0", "sass": "^1.96.0",
"sass-loader": "^16.0.6", "sass-loader": "^16.0.6",
"sync-client": "file:../sync-client", "sync-client": "file:../sync-client",
"terser-webpack-plugin": "^5.3.14", "terser-webpack-plugin": "^5.3.16",
"ts-loader": "^9.5.2", "ts-loader": "^9.5.4",
"tslib": "2.8.1", "tslib": "2.8.1",
"tsx": "^4.20.6", "tsx": "^4.21.0",
"typescript": "5.8.3", "typescript": "5.9.3",
"url": "^0.11.4", "url": "^0.11.4",
"webpack": "^5.99.9", "webpack": "^5.103.0",
"webpack-cli": "^6.0.1" "webpack-cli": "^6.0.1"
} }
} }

View file

@ -142,7 +142,7 @@ export default class VaultLinkPlugin extends Plugin {
}); });
if (IS_DEBUG_BUILD) { if (IS_DEBUG_BUILD) {
debugging.logToConsole(client); debugging.logToConsole(client.logger);
} }
return client; return client;

View file

@ -132,7 +132,8 @@ export class RemoteCursorsPluginValue implements PluginValue {
] ]
) )
}, },
edited edited,
"Markdown"
); );
reconciled.cursors.forEach(({ id, position }) => { reconciled.cursors.forEach(({ id, position }) => {

View file

@ -266,9 +266,8 @@ export class SyncSettingsTab extends PluginSettingTab {
new Notice("Checking connection to the server..."); new Notice("Checking connection to the server...");
new Notice( new Notice(
( (await this.syncClient.checkConnection())
await this.syncClient.checkConnection() .serverMessage
).serverMessage
); );
await this.statusDescription.updateConnectionState(); await this.statusDescription.updateConnectionState();
} else { } else {
@ -351,22 +350,6 @@ export class SyncSettingsTab extends PluginSettingTab {
}) })
); );
new Setting(containerEl)
.setName("Sync concurrency")
.setDesc(
"How many concurrent sync operations to run. Setting this value higher may increase the overall performance, however, it will require more memory as well. If you notice frequent crashes, especially on mobile, set this to 1."
)
.addSlider((text) =>
text
.setLimits(1, 16, 1)
.setDynamicTooltip()
.setInstant(false)
.setValue(this.syncClient.getSettings().syncConcurrency)
.onChange(async (value) =>
this.syncClient.setSetting("syncConcurrency", value)
)
);
new Setting(containerEl) new Setting(containerEl)
.setName("Maximum file size to be uploaded (MB)") .setName("Maximum file size to be uploaded (MB)")
.setDesc( .setDesc(

File diff suppressed because it is too large Load diff

View file

@ -5,7 +5,9 @@
"sync-client", "sync-client",
"obsidian-plugin", "obsidian-plugin",
"test-client", "test-client",
"local-client-cli" "deterministic-tests",
"local-client-cli",
"history-ui"
], ],
"prettier": { "prettier": {
"trailingComma": "none", "trailingComma": "none",
@ -29,16 +31,15 @@
"build": "npm run build --workspaces", "build": "npm run build --workspaces",
"dev": "concurrently --kill-others \"npm run dev -w sync-client\" \"npm run dev -w obsidian-plugin\"", "dev": "concurrently --kill-others \"npm run dev -w sync-client\" \"npm run dev -w obsidian-plugin\"",
"test": "npm run test --workspaces", "test": "npm run test --workspaces",
"lint": "eslint --fix sync-client obsidian-plugin test-client local-client-cli && prettier --write \"**/*.ts\"", "lint": "eslint --fix sync-client obsidian-plugin test-client deterministic-tests local-client-cli && prettier --write \"**/*.ts\"",
"update": "ncu -u -ws" "update": "ncu -u"
}, },
"devDependencies": { "devDependencies": {
"concurrently": "^9.2.1", "concurrently": "^9.2.1",
"eclint": "^2.8.1", "eslint": "9.39.2",
"eslint": "9.38.0", "eslint-plugin-unused-imports": "^4.3.0",
"eslint-plugin-unused-imports": "^4.1.4", "npm-check-updates": "^19.2.0",
"npm-check-updates": "^19.1.1", "prettier": "^3.7.4",
"prettier": "^3.6.2", "typescript-eslint": "8.49.0"
"typescript-eslint": "8.41.0"
} }
} }

View file

@ -11,14 +11,14 @@
"test": "tsx --test 'src/**/*.test.ts'" "test": "tsx --test 'src/**/*.test.ts'"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^24.8.1", "@types/node": "^25.0.2",
"sync-client": "file:../sync-client", "sync-client": "file:../sync-client",
"ts-loader": "^9.5.2", "ts-loader": "^9.5.4",
"tslib": "2.8.1", "tslib": "2.8.1",
"tsx": "^4.20.6", "tsx": "^4.21.0",
"typescript": "5.8.3", "typescript": "5.9.3",
"uuid": "^13.0.0", "uuid": "^13.0.0",
"webpack": "^5.99.9", "webpack": "^5.103.0",
"webpack-cli": "^6.0.1" "webpack-cli": "^6.0.1"
} }
} }

View file

@ -19,35 +19,48 @@ process_count=$1
mkdir -p logs mkdir -p logs
# Build and restart the server
echo "Building server..."
cd sync-server
cargo build --release
# Kill any existing server process
echo "Stopping existing server..."
pkill -f "sync_server" 2>/dev/null || true
sleep 1
# Clean databases
echo "Cleaning databases..."
rm -rf databases
# Start the server in the background
echo "Starting server..."
./target/release/sync_server config-e2e.yml &
server_pid=$!
echo "Server started with PID: $server_pid"
# Ensure server is killed on script exit
cleanup_server() {
echo "Stopping server (PID: $server_pid)..."
kill $server_pid 2>/dev/null || true
wait $server_pid 2>/dev/null || true
}
trap cleanup_server EXIT
cd ..
cd frontend cd frontend
npm ci npm ci
npm run build npm run build
../scripts/utils/wait-for-server.sh ../scripts/utils/wait-for-server.sh
cd ..
scripts/update-api-types.sh
if [[ $(git status --porcelain) ]]; then
git status --porcelain
echo "Failing CI because the working directory is not clean after generating api types"
exit 1
fi
cd frontend
pids=() pids=()
for i in $(seq 1 $process_count); do for i in $(seq 1 $process_count); do
# Create a named pipe for this process node test-client/dist/cli.js > "../logs/log_${i}.log" 2>&1 &
pipe="/tmp/vaultlink_pipe_$$_$i"
mkfifo "$pipe"
# Start the node process writing to the pipe
node test-client/dist/cli.js > "$pipe" 2>&1 &
pid=$! pid=$!
pids+=($pid) pids+=($pid)
echo "Started process $i with PID: $pid" echo "Started process $i with PID: $pid (log: logs/log_${i}.log)"
# Read from pipe, prefix with PID
(sed "s/^/[PID $pid] /" < "$pipe" > "../logs/log_${i}.log"; rm "$pipe") &
done done
cd .. cd ..
@ -75,10 +88,25 @@ print_failed_log() {
return 1 return 1
} }
echo "Monitoring $process_count processes" E2E_TIMEOUT=${2:-3600}
start_time=$(date +%s)
echo "Monitoring $process_count processes (timeout: ${E2E_TIMEOUT}s)"
# Monitor processes # Monitor processes
while true; do while true; do
# Script-level timeout to prevent indefinite hangs
current_time=$(date +%s)
elapsed=$((current_time - start_time))
if [ $elapsed -ge $E2E_TIMEOUT ]; then
echo "E2E timeout reached (${E2E_TIMEOUT}s). Killing remaining processes."
for pid in "${pids[@]}"; do
if [ -n "$pid" ]; then
kill $pid 2>/dev/null || true
fi
done
exit 1
fi
if print_failed_log; then if print_failed_log; then
# Kill remaining processes # Kill remaining processes
for pid in "${pids[@]}"; do for pid in "${pids[@]}"; do