|
| 1 | +# Contributing to Plan Visualizer |
| 2 | + |
| 3 | +Thank you for your interest in contributing to Plan Visualizer! This document provides guidelines and instructions for contributing to the project. |
| 4 | + |
| 5 | +## Getting Started |
| 6 | + |
| 7 | +### Fork the Repository |
| 8 | + |
| 9 | +To contribute to this project, you'll need to fork the repository first: |
| 10 | + |
| 11 | +1. Navigate to the [Plan Visualizer repository](https://github.com/NGA-TRAN/plan-visualizer) |
| 12 | +2. Click the "Fork" button in the top-right corner |
| 13 | +3. This creates a copy of the repository in your GitHub account |
| 14 | + |
| 15 | +### Clone Your Fork |
| 16 | + |
| 17 | +After forking, clone your fork to your local machine: |
| 18 | + |
| 19 | +```bash |
| 20 | +git clone https://github.com/YOUR_USERNAME/plan-visualizer.git |
| 21 | +cd plan-visualizer |
| 22 | +``` |
| 23 | + |
| 24 | +### Set Up Upstream Remote |
| 25 | + |
| 26 | +Add the original repository as an upstream remote to keep your fork synchronized: |
| 27 | + |
| 28 | +```bash |
| 29 | +git remote add upstream https://github.com/NGA-TRAN/plan-visualizer.git |
| 30 | +``` |
| 31 | + |
| 32 | +## Development Setup |
| 33 | + |
| 34 | +### Prerequisites |
| 35 | + |
| 36 | +- **Node.js**: Version 20 or higher |
| 37 | +- **npm**: Comes with Node.js, or install separately |
| 38 | +- **Git**: For version control |
| 39 | + |
| 40 | +### Installation |
| 41 | + |
| 42 | +1. Install dependencies: |
| 43 | + |
| 44 | +```bash |
| 45 | +npm install |
| 46 | +``` |
| 47 | + |
| 48 | +2. Verify the installation: |
| 49 | + |
| 50 | +```bash |
| 51 | +npm list plan-viz @excalidraw/excalidraw |
| 52 | +``` |
| 53 | + |
| 54 | +You should see the required packages listed. |
| 55 | + |
| 56 | +## Development Workflow |
| 57 | + |
| 58 | +### Running the Development Server |
| 59 | + |
| 60 | +Start the development server with hot-reload: |
| 61 | + |
| 62 | +```bash |
| 63 | +npm run dev |
| 64 | +``` |
| 65 | + |
| 66 | +The application will be available at `http://localhost:4174` (or the next available port). |
| 67 | + |
| 68 | +### Building for Production |
| 69 | + |
| 70 | +Build the project for production: |
| 71 | + |
| 72 | +```bash |
| 73 | +npm run build |
| 74 | +``` |
| 75 | + |
| 76 | +This command: |
| 77 | +- Runs TypeScript type checking (`tsc`) |
| 78 | +- Builds the production bundle with Vite (`vite build`) |
| 79 | +- Outputs optimized files to the `dist/` directory |
| 80 | + |
| 81 | +### Testing the Production Build Locally |
| 82 | + |
| 83 | +After building, preview the production build locally: |
| 84 | + |
| 85 | +```bash |
| 86 | +npm run preview |
| 87 | +``` |
| 88 | + |
| 89 | +This command: |
| 90 | +- Runs TypeScript type checking (`tsc`) |
| 91 | +- Builds the production bundle (`vite build`) |
| 92 | +- Starts a preview server (`vite preview`) |
| 93 | + |
| 94 | +The application will be available at **http://localhost:4174/** (or the next available port). |
| 95 | + |
| 96 | +> **Note**: The preview server serves the production build, which is useful for testing how the app will behave when deployed. |
| 97 | +
|
| 98 | +### Other Useful Commands |
| 99 | + |
| 100 | +- **Type checking**: `npm run type-check` - Check TypeScript types without building |
| 101 | +- **Linting**: `npm run lint` - Check code for linting errors |
| 102 | +- **Formatting**: `npm run format` - Format code with Prettier |
| 103 | + |
| 104 | +## Making Changes |
| 105 | + |
| 106 | +### Create a Branch |
| 107 | + |
| 108 | +Create a new branch for your changes: |
| 109 | + |
| 110 | +```bash |
| 111 | +git checkout -b feature/your-feature-name |
| 112 | +``` |
| 113 | + |
| 114 | +Or for bug fixes: |
| 115 | + |
| 116 | +```bash |
| 117 | +git checkout -b fix/your-bug-description |
| 118 | +``` |
| 119 | + |
| 120 | +### Make Your Changes |
| 121 | + |
| 122 | +- Write clean, readable code |
| 123 | +- Follow the existing code style |
| 124 | +- Add comments where necessary |
| 125 | +- Update documentation if needed |
| 126 | + |
| 127 | +### Test Your Changes |
| 128 | + |
| 129 | +Before submitting: |
| 130 | + |
| 131 | +1. **Run the development server** and test your changes: |
| 132 | + ```bash |
| 133 | + npm run dev |
| 134 | + ``` |
| 135 | + |
| 136 | +2. **Build and preview** to ensure the production build works: |
| 137 | + ```bash |
| 138 | + npm run build |
| 139 | + npm run preview |
| 140 | + ``` |
| 141 | + Then test at http://localhost:4174/ |
| 142 | + |
| 143 | +3. **Run type checking**: |
| 144 | + ```bash |
| 145 | + npm run type-check |
| 146 | + ``` |
| 147 | + |
| 148 | +4. **Run linting**: |
| 149 | + ```bash |
| 150 | + npm run lint |
| 151 | + ``` |
| 152 | + |
| 153 | +### Commit Your Changes |
| 154 | + |
| 155 | +Write clear, descriptive commit messages: |
| 156 | + |
| 157 | +```bash |
| 158 | +git add . |
| 159 | +git commit -m "Add: description of your changes" |
| 160 | +``` |
| 161 | + |
| 162 | +Use conventional commit prefixes when appropriate: |
| 163 | +- `Add:` for new features |
| 164 | +- `Fix:` for bug fixes |
| 165 | +- `Update:` for updates to existing features |
| 166 | +- `Refactor:` for code refactoring |
| 167 | +- `Docs:` for documentation changes |
| 168 | + |
| 169 | +### Keep Your Fork Updated |
| 170 | + |
| 171 | +Before creating a pull request, sync your fork with the upstream repository: |
| 172 | + |
| 173 | +```bash |
| 174 | +git fetch upstream |
| 175 | +git checkout main |
| 176 | +git merge upstream/main |
| 177 | +git push origin main |
| 178 | +``` |
| 179 | + |
| 180 | +Then update your feature branch: |
| 181 | + |
| 182 | +```bash |
| 183 | +git checkout feature/your-feature-name |
| 184 | +git merge main |
| 185 | +``` |
| 186 | + |
| 187 | +## Submitting Changes |
| 188 | + |
| 189 | +### Push to Your Fork |
| 190 | + |
| 191 | +Push your branch to your fork: |
| 192 | + |
| 193 | +```bash |
| 194 | +git push origin feature/your-feature-name |
| 195 | +``` |
| 196 | + |
| 197 | +### Create a Pull Request |
| 198 | + |
| 199 | +1. Go to your fork on GitHub |
| 200 | +2. Click "New Pull Request" |
| 201 | +3. Select your branch |
| 202 | +4. Fill out the pull request template (if available) with: |
| 203 | + - Description of changes |
| 204 | + - Related issues (if any) |
| 205 | + - Testing steps |
| 206 | + - Screenshots (if applicable) |
| 207 | + |
| 208 | +### Pull Request Guidelines |
| 209 | + |
| 210 | +- Keep pull requests focused on a single feature or fix |
| 211 | +- Write clear descriptions of what changed and why |
| 212 | +- Reference related issues |
| 213 | +- Ensure all checks pass (linting, type checking, etc.) |
| 214 | +- Be responsive to feedback and questions |
| 215 | + |
| 216 | +## Code Style |
| 217 | + |
| 218 | +- Follow TypeScript best practices |
| 219 | +- Use functional components with hooks |
| 220 | +- Follow the existing project structure |
| 221 | +- Use meaningful variable and function names |
| 222 | +- Add JSDoc comments for complex functions |
| 223 | + |
| 224 | +## Project Structure |
| 225 | + |
| 226 | +``` |
| 227 | +plan-visualizer/ |
| 228 | +├── src/ |
| 229 | +│ ├── app/ # App configuration and routing |
| 230 | +│ ├── features/ # Feature modules |
| 231 | +│ ├── shared/ # Shared components and utilities |
| 232 | +│ ├── store/ # State management |
| 233 | +│ └── types/ # TypeScript type definitions |
| 234 | +├── public/ # Static assets |
| 235 | +├── dist/ # Production build output |
| 236 | +└── specs/ # Project specifications |
| 237 | +``` |
| 238 | + |
| 239 | +## Questions? |
| 240 | + |
| 241 | +If you have questions or need help: |
| 242 | + |
| 243 | +- Open an issue on GitHub |
| 244 | +- Check existing issues and discussions |
| 245 | +- Review the [README.md](README.md) for project overview |
| 246 | + |
| 247 | +## License |
| 248 | + |
| 249 | +By contributing, you agree that your contributions will be licensed under the MIT License. |
| 250 | + |
| 251 | +Thank you for contributing to Plan Visualizer! 🎉 |
0 commit comments