Instruction file imported from dwirx/TMDB-media (
.cursor/rules/development-workflow.mdc). Copyright stays with the author.
Development Workflow
Getting Started
- Clone the repository to
.obsidian/plugins/<plugin-name>/ - Run
npm installto install dependencies - Run
npm run devto start development build - Enable plugin in Settings → Community plugins
- Reload Obsidian to load the plugin
Development Commands
npm run dev- Start development build with watch modenpm run build- Create production buildnpm run version- Bump version and update fileseslint main.ts- Run code analysis (if eslint is installed)
Testing Workflow
- Make changes to main.ts or other source files
- Changes automatically compile to
main.jsin dev mode - Reload Obsidian (Ctrl/Cmd + R) to test changes
- Check console for errors and debug information
- Test on different file types and scenarios
Debugging Tips
- Use
console.log()for debugging (removed in production build) - Check Obsidian's developer console for errors
- Use
new Notice()for user feedback during development - Test with different vault configurations
- Verify plugin loads correctly after Obsidian restart
Code Quality
- Use TypeScript strict mode (enabled in tsconfig.json)
- Follow ESLint recommendations if configured
- Write self-documenting code with clear variable names
- Add comments for complex logic
- Keep functions focused and small
File Management
- Don't commit
main.jsornode_modules/to version control - Keep source files in TypeScript (.ts)
- Use meaningful file names and organization
- Document any external dependencies or requirements
Plugin Lifecycle Testing
- Test plugin loading and unloading
- Verify all registered events are cleaned up
- Test settings persistence across reloads
- Ensure commands work in different contexts
- Test error handling and edge cases