Developer Guide
This guide provides information for developers who want to contribute to the Make It Rain plugin.
Table of Contents
- Getting Started
- Project Structure
- Development Setup
- Testing
- Contributing
- Architecture
- Best Practices
Getting Started
Prerequisites
- Node.js (v16 or higher)
- npm or yarn
- Git
- Obsidian (for testing)
- Raindrop.io account and API token
Quick Start
- Fork the repository
- Clone your fork
- Install dependencies
- Build the plugin
- Link to Obsidian
# Clone repository
git clone https://github.com/your-username/make-it-rain.git
# Install dependencies
npm install
# Build plugin
npm run build
# Watch for changes
npm run dev
Project Structure
make-it-rain/
├── src/
│ ├── components/ # UI components
│ ├── services/ # Core services
│ ├── types/ # TypeScript types
│ ├── utils/ # Utility functions
│ └── main.ts # Plugin entry point
├── tests/ # Test files
├── docs/ # Documentation
├── manifest.json # Plugin manifest
└── package.json # Dependencies
Key Directories
src/components/: UI components and viewssrc/services/: Core functionalitysrc/types/: TypeScript interfacessrc/utils/: Helper functionstests/: Test suites
Development Setup
Environment Setup
- Install dependencies
- Configure development environment
- Set up testing environment
- Configure API access
Development Workflow
- Create feature branch
- Make changes
- Run tests
- Build plugin
- Test in Obsidian
- Submit PR
Debugging
- Enable developer mode
- Use console logging
- Check error messages
- Monitor network requests
Testing
Unit Tests
// Example test
describe('TemplateService', () => {
it('should validate template', () => {
const service = new TemplateService();
const result = service.validateTemplate('');
expect(result.valid).toBe(true);
});
});
Integration Tests
// Example test
describe('ImportService', () => {
it('should import items', async () => {
const service = new ImportService();
const items = await service.importItems([], {});
expect(items).toBeDefined();
});
});
Test Coverage
- Run tests with coverage
- Check coverage report
- Add missing tests
- Maintain coverage
Contributing
Code Style
- Use TypeScript
- Follow ESLint rules
- Use Prettier
- Add comments
Git Workflow
- Create branch
- Make changes
- Commit changes
- Push branch
- Create PR
Pull Request Process
- Update documentation
- Add tests
- Check CI
- Get review
- Merge changes
Architecture
Core Components
RaindropService: API integrationTemplateService: Template processingImportService: Note creationSettingsService: Configuration
Data Flow
- User triggers import
- Fetch data from API
- Process templates
- Create notes
- Update UI
Event System
// Example event handling
eventManager.on(PluginEventType.IMPORT_START, (event) => {
console.log('Import started:', event.data);
});
Best Practices
Code Organization
- Use TypeScript
- Follow SOLID principles
- Write clean code
- Add documentation
Error Handling
try {
await service.importItems(items);
} catch (error) {
errorHandler.handle(error);
}
Performance
- Use async/await
- Implement caching
- Optimize templates
- Monitor resources
Security
- Validate input
- Handle tokens
- Sanitize output
- Check permissions
API Integration
Raindrop.io API
// Example API call
const items = await raindropService.getCollectionItems(id, {
page: 1,
perPage: 50
});
Obsidian API
// Example Obsidian API usage
app.vault.create(
'path/to/note.md',
content
);
Template System
Template Development
// Example template
const template = `
#
## Summary
`;
Template Variables
- ``: Raindrop title
- ``: Raindrop excerpt
- ``: Original URL
- ``: Content type
- ``: Creation date
- ``: Last update date
- ``: Collection info
- ``: Raindrop tags
Template Helpers
- ``: Conditional blocks
- ``: Iteration
- ``: Date formatting
- ``: Text sanitization
Error Handling
Common Errors
- API Rate Limits
- Network Issues
- Invalid Templates
- File System Errors
Error Recovery
- Automatic Retries
- Fallback Options
- User Notifications
- Error Logging
Performance Optimization
Caching
- API Response Cache
- Template Cache
- File System Cache
- Memory Management
Resource Management
- Connection Pooling
- Memory Usage
- File Handles
- Network Connections
Security Considerations
API Security
- Token Management
- Rate Limiting
- Request Validation
- Response Sanitization
File System Security
- Path Validation
- Permission Checks
- File Operations
- Error Handling
Documentation
Code Documentation
- JSDoc Comments
- Type Definitions
- API Documentation
- Usage Examples
User Documentation
- Installation Guide
- Configuration Guide
- Usage Guide
- Troubleshooting Guide
Release Process
Version Management
- Semantic Versioning
- Changelog Updates
- Release Notes
- Tag Management
Deployment
- Build Process
- Testing
- Distribution
- Updates
Support
Community Support
- GitHub Issues
- Discussions
- Pull Requests
- Documentation
Developer Support
- Code Review
- Mentoring
- Best Practices
- Tools and Resources