Ways to Contribute
Report Bugs
Found an issue? Open a bug report on GitHub with details about the problem.
Suggest Features
Have an idea for improvement? Create a feature request to discuss it.
Improve Documentation
Help make the docs better by fixing typos or adding clarifications.
Submit Code
Fix bugs or implement features by submitting a pull request.
Development Setup
Install dependencies
The project uses npm for package management:This installs all required dependencies including TypeScript, esbuild, and eslint.
Start development build
Run the development build with watch mode:This uses esbuild to compile TypeScript and automatically rebuilds on file changes.
Link to your test vault
Create a symlink from your Obsidian vault to the development folder:
On Windows, use
mklink /D instead of ln -s to create the symlink.Project Structure
The codebase is organized into focused modules:main.ts- Core plugin logic including localStorage interception, sync operations, and command registrationsettings.ts- DefinesSyncFoldSettingsinterface withenableSyncandfoldspropertiestypes.ts- Type definitions for fold data structures (Fold,FoldedProperties,FoldStateData)
Build Commands
The project provides several npm scripts:The production build command (
npm run build) runs TypeScript type checking before bundling with esbuild.Code Style
The project uses ESLint with TypeScript support to maintain code quality. Before submitting a PR:-
Run the linter to check for issues:
-
Auto-fix issues where possible:
-
Ensure all TypeScript types are correct (the build command checks this):
- Use TypeScript with strict type checking
- Follow existing code patterns and structure
- Keep
main.tsfocused on plugin lifecycle - Add JSDoc comments for public APIs
- Use descriptive variable and function names
Testing
While the project doesn’t currently have automated tests, you should thoroughly test your changes:-
Manual testing in Obsidian:
- Test fold creation, modification, and deletion
- Verify sync behavior across mock “devices” (different vault folders)
- Test with both the setting enabled and disabled
-
Test the manual commands:
- Export folds from local storage
- Import folds into local storage
-
Edge cases to consider:
- Large numbers of folds (performance)
- Files being renamed or moved
- Plugin reload/unload behavior
- Mobile vs desktop compatibility
The plugin sets
isDesktopOnly: false in manifest.json, so test on mobile if possible.Pull Request Process
Make your changes
- Write clean, well-documented code
- Follow existing code style and patterns
- Test thoroughly in Obsidian
- Run
npm run lint:fixbefore committing
Push and create PR
Push your branch and create a pull request on GitHub:In your PR description:
- Explain what changes you made and why
- Reference any related issues
- Describe how you tested the changes
- Note any breaking changes or migration steps
Technical Details
How Sync Works
Understanding the sync mechanism helps when contributing:-
localStorage Interception (
main.ts:130-159):- Wraps
localStorage.setItemandlocalStorage.removeItem - Monitors keys prefixed with
{appId}-note-fold- - Triggers debounced sync on changes
- Wraps
-
Debounced Sync (
main.ts:170-182):- 150ms debounce prevents excessive writes
- Batches rapid fold changes into single save
-
External Change Detection (
main.ts:73-107):- Detects when
data.jsonchanges (from sync) - Updates localStorage to match
- Uses cache to minimize unnecessary updates
- Detects when
Build System
The project uses esbuild for fast compilation:- Configuration in
esbuild.config.mjs - Bundles all dependencies into
main.js - Supports both development (watch) and production modes
- TypeScript compilation with type checking
Funding
If you’d like to support the project financially, consider sponsoring the author:GitHub Sponsors
Support the development of Sync Folds and other open source projects.
License
Sync Folds is licensed under the 0BSD License (Zero-Clause BSD). This is an extremely permissive license that allows you to:- Use the code for any purpose
- Modify and distribute the code
- Use the code commercially or privately
- No attribution required
Questions?
If you have questions about contributing:- Open a GitHub Discussion
- Comment on a related issue
- Reach out to @itsonlyjames