Developer Guide

Table of Contents

Getting Started

Prerequisites

Before you begin, ensure you have:

Fork and Clone

git clone https://github.com/YOUR_USERNAME/obsidian-github-projects.git
cd obsidian-github-projects
git remote add upstream https://github.com/alexnodeland/obsidian-github-projects.git

Development Setup

Quick Setup with Make

# Install dependencies and set up development environment
make setup VAULT=/path/to/your/vault

Start development with auto-rebuild

make dev VAULT=/path/to/your/vault

Manual Setup

npm install
npm run build
./scripts/setup-dev.sh /path/to/your/vault

Or manually copy files:

mkdir -p /path/to/vault/.obsidian/plugins/github-projects
cp main.js manifest.json styles.css /path/to/vault/.obsidian/plugins/github-projects/
- Open Obsidian - Go to Settings → Community Plugins - Disable Safe Mode if enabled - Enable "GitHub Projects"

Development Workflow

Watch Mode for Development

Use the watch mode for continuous development:

# Using Make (recommended)
make dev VAULT=/path/to/your/vault

Or using the script directly

./scripts/dev-watch.sh /path/to/your/vault

This will:

After each rebuild:

Making Changes

git checkout -b feature/your-feature-name
# Run tests
npm test

Run tests in watch mode

npm run test:watch

Run linter

npm run lint

Type check

npm run build
git add .
git commit -m "feat: add awesome new feature"

Follow Conventional Commits format:

git push origin feature/your-feature-name

Then create a Pull Request on GitHub.

Project Structure

obsidian-github-projects/
├── .github/
│   └── workflows/          # GitHub Actions CI/CD
├── docs/                   # Documentation
├── src/
│   ├── api/               # GitHub API client
│   │   ├── client.ts      # GraphQL client
│   │   └── queries.ts     # GraphQL queries
│   ├── state/             # State management
│   │   ├── ProjectState.ts    # Project state
│   │   └── types.ts           # Type definitions
│   ├── utils/             # Utility functions
│   │   ├── github.ts      # GitHub helpers
│   │   └── storage.ts     # Storage helpers
│   ├── views/             # UI components
│   │   ├── components/    # Reusable components
│   │   │   ├── Card.tsx
│   │   │   ├── Column.tsx
│   │   │   └── DetailModal.tsx
│   │   └── ProjectBoardView.tsx
│   ├── __tests__/         # Unit tests
│   ├── __mocks__/         # Test mocks
│   ├── main.tsx           # Plugin entry point
│   └── settings.ts        # Settings tab
├── styles.css             # Plugin styles
├── manifest.json          # Plugin manifest
├── package.json           # Dependencies
├── tsconfig.json          # TypeScript config
├── jest.config.js         # Jest config
├── esbuild.config.mjs     # Build config
└── Makefile              # Development tasks

Key Files

Code Standards

TypeScript

Naming Conventions

Code Style

We use ESLint for code quality. Run before committing:

npm run lint

Key rules:

Component Guidelines

Preact Components:

Example:

interface CardProps {
  item: ProjectItem;
  onMove: (itemId: string, statusId: string) => void;
}

export function Card({ item, onMove }: CardProps) { // Component implementation }

State Management

Testing

Running Tests

# Run all tests
npm test

Run tests in watch mode

npm run test:watch

Run tests with coverage

npm test -- --coverage

Run specific test file

npm test -- Card.test.tsx

Writing Tests

Place tests in src/__tests__/ directory:

import { render, screen } from '@testing-library/preact';
import { Card } from '../views/components/Card';

describe('Card', () => { it('renders card title', () => { const item = { id: '1', title: 'Test Issue', content: '' }; render();

expect(screen.getByText('Test Issue')).toBeInTheDocument(); }); });

Test Coverage

Current coverage baseline: ~12% (statements, branches, functions, lines)

Target: Gradually increase to >80% coverage

Check coverage:

npm test -- --coverage

Coverage reports are generated in coverage/ directory.

Note: Coverage thresholds are currently set to 10% to match the existing codebase. As you add features, please include tests to incrementally improve coverage.

Building

Development Build

npm run dev

This creates an unminified build with source maps for debugging.

Production Build

npm run build

This creates an optimized, minified build without source maps.

Build Output

The build process generates:

Contributing

Pull Request Process

   npm test
   npm run lint
   npm run build
   
- What changes were made - Why the changes were needed - How to test the changes

Code Review Guidelines

When reviewing PRs:

Release Process

Version Numbering

We follow Semantic Versioning:

Creating a Release

npm version patch  # or minor, or major
git add .
git commit -m "chore: bump version to X.Y.Z"
git tag X.Y.Z
git push origin main --tags
- Run tests - Build the plugin - Create a GitHub release - Upload release artifacts

Release Checklist

Development Tools

Useful Make Commands

make setup VAULT=/path    # Initial setup
make dev VAULT=/path      # Development mode
make build                # Production build
make test                 # Run tests
make lint                 # Run linter
make clean                # Clean build artifacts
make coverage             # Generate coverage report

Debugging

Browser DevTools:

Source Maps: Development builds include source maps for debugging TypeScript in DevTools.

Obsidian API Documentation

Getting Help

License

By contributing, you agree that your contributions will be licensed under the MIT License.