Skip to content

Latest commit

 

History

History
205 lines (138 loc) · 4.71 KB

File metadata and controls

205 lines (138 loc) · 4.71 KB

Contributing to Draftly

Thank you for your interest in contributing to Draftly! We welcome contributions from the community and are excited to have you on board.

Table of Contents


Code of Conduct

By participating in this project, you agree to maintain a respectful and inclusive environment for everyone. Please be kind and constructive in all interactions.


Getting Started

  1. Fork the repository on GitHub.
  2. Clone your fork locally:
    git clone https://github.com/YOUR_USERNAME/draftly.git
    cd draftly
  3. Add the upstream remote:
    git remote add upstream https://github.com/NeuroNexul/draftly.git

Development Setup

Prerequisites

  • Node.js >= 20
  • Bun >= 1.3.5 (package manager)

Install Dependencies

bun install

Start Development Server

bun dev

This starts the development server with hot reloading for both the web app and the draftly package.

Build

bun run build

Lint & Format

# Lint all packages
bun run lint

# Format code with Prettier
bun run format

Project Structure

This is a monorepo managed with Turborepo.

draftly/
├── apps/
│   └── web/              # Next.js web application (playground)
├── packages/
│   └── draftly/          # Core library (published to npm)
│       ├── src/
│       │   ├── editor/   # CodeMirror editor integration
│       │   ├── plugins/  # Built-in plugins
│       │   └── preview/  # Static HTML renderer
│       └── package.json
├── package.json          # Root workspace config
├── turbo.json            # Turborepo config
└── README.md

Making Changes

Branch Naming

Use descriptive branch names:

  • feature/add-table-plugin – New features
  • fix/image-rendering-bug – Bug fixes
  • docs/update-readme – Documentation
  • refactor/plugin-architecture – Code refactoring

Commit Messages

Follow Conventional Commits:

feat: add table plugin support
fix: resolve image widget rendering issue
docs: update installation instructions
refactor: simplify plugin registration
chore: update dependencies

Changesets

We use Changesets for versioning. If your change affects the public API or fixes a bug, add a changeset:

bun run changeset

Follow the prompts to describe your changes. This creates a file in .changeset/ that will be used to generate the changelog.


Submitting a Pull Request

  1. Sync with upstream:

    git fetch upstream
    git rebase upstream/main
  2. Push your branch:

    git push origin your-branch-name
  3. Open a Pull Request on GitHub against the main branch.

  4. Fill out the PR template with:

    • A clear description of the changes
    • Related issue numbers (if any)
    • Screenshots for UI changes
  5. Wait for review – maintainers will review your PR and may request changes.


Coding Guidelines

TypeScript

  • Use strict TypeScript – avoid any where possible.
  • Export types from index.ts files.
  • Use descriptive variable and function names.

Code Style

  • We use Prettier for formatting – run bun run format before committing.
  • We use ESLint for linting – run bun run lint to check for issues.

Plugins

When creating a new plugin:

  1. Create a new file in packages/draftly/src/plugins/.
  2. Extend the DraftlyPlugin base class.
  3. Export the plugin from packages/draftly/src/plugins/index.ts.
  4. Add the plugin to allPlugins array if it should be included by default.
  5. Update documentation if needed.

Testing

  • Test your changes in the playground app (apps/web).
  • Ensure the build passes: bun run build.
  • Ensure linting passes: bun run lint.

Reporting Issues

Found a bug or have a feature request? Open an issue with:

  • Bug reports: Steps to reproduce, expected behavior, actual behavior, screenshots if applicable.
  • Feature requests: Clear description of the feature and its use case.

Questions?

Feel free to open a Discussion or reach out to the maintainers.

Thank you for contributing! 🎉