|
| 1 | +# Contributing to Acode |
| 2 | + |
| 3 | +Thank you for your interest in contributing to Acode! This guide will help you get started with development. |
| 4 | + |
| 5 | +## Quick Start Options |
| 6 | + |
| 7 | +### Option 1: DevContainer (Recommended) |
| 8 | + |
| 9 | +1. Install the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) in VS Code or other editors that support DevContainers. |
| 10 | + |
| 11 | +2. Clone and open the repository: |
| 12 | + ```bash |
| 13 | + git clone https://github.com/Acode-Foundation/Acode.git |
| 14 | + code Acode |
| 15 | + ``` |
| 16 | + |
| 17 | +3. When VS Code prompts "Reopen in Container", click it |
| 18 | + - Or use Command Palette (Cmd/Ctrl+Shift+P) → "Dev Containers: Reopen in Container" |
| 19 | + |
| 20 | +4. Wait for the container to build (~5-10 minutes first time, subsequent opens are instant) |
| 21 | + |
| 22 | +5. Once ready, build the APK: |
| 23 | + ```bash |
| 24 | + pnpm run build paid dev apk |
| 25 | + ``` |
| 26 | + |
| 27 | + > Use any package manager (pnpm, bun, npm, yarn, etc.) |
| 28 | +
|
| 29 | +### Option 2: Docker CLI (For Any Editor) |
| 30 | + |
| 31 | +If your editor doesn't support DevContainers, you can use Docker directly: |
| 32 | + |
| 33 | +```bash |
| 34 | +# Clone the repository |
| 35 | +git clone https://github.com/Acode-Foundation/Acode.git |
| 36 | +cd Acode |
| 37 | + |
| 38 | +# Build the Docker image from our Dockerfile |
| 39 | +docker build -t acode-dev .devcontainer/ |
| 40 | + |
| 41 | +# Run the container with your code mounted |
| 42 | +docker run -it --rm \ |
| 43 | + -v "$(pwd):/workspaces/acode" \ |
| 44 | + -w /workspaces/acode \ |
| 45 | + acode-dev \ |
| 46 | + bash |
| 47 | + |
| 48 | +# Inside the container, run setup and build |
| 49 | +# bun run setup && bun run build paid dev apk |
| 50 | +pnpm run setup |
| 51 | +pnpm run build paid dev apk # or pnpm run build p d |
| 52 | +``` |
| 53 | + |
| 54 | +**Keep container running for repeated use:** |
| 55 | +```bash |
| 56 | +# Start container in background |
| 57 | +docker run -d --name acode-dev \ |
| 58 | + -v "$(pwd):/workspaces/acode" \ |
| 59 | + -w /workspaces/acode \ |
| 60 | + acode-dev \ |
| 61 | + sleep infinity |
| 62 | + |
| 63 | +# Execute commands in the running container |
| 64 | +docker exec -it acode-dev bash -c "pnpm run setup" |
| 65 | +docker exec -it acode-dev pnpm run build paid dev apk |
| 66 | + |
| 67 | +# Stop and remove when done |
| 68 | +docker stop acode-dev && docker rm acode-dev |
| 69 | +``` |
| 70 | + |
| 71 | +--- |
| 72 | + |
| 73 | +## 🛠️ Manual Setup (Without Docker) |
| 74 | + |
| 75 | +If you prefer not to use Docker at all: |
| 76 | + |
| 77 | +### Prerequisites |
| 78 | + |
| 79 | +| Requirement | Version | |
| 80 | +|------------|---------| |
| 81 | +| **Node.js** | 18+ (22 recommended) | |
| 82 | +| **pnpm** or **bun** | Latest | |
| 83 | +| **Java JDK** | 17+ (21 recommended) | |
| 84 | +| **Android SDK** | API 35 | |
| 85 | +| **Gradle** | 8.x | |
| 86 | + |
| 87 | +### Environment Setup |
| 88 | + |
| 89 | +Add these to your shell profile (`~/.bashrc`, `~/.zshrc`, or `~/.config/fish/config.fish`): |
| 90 | + |
| 91 | +**macOS:** |
| 92 | +```bash |
| 93 | +export ANDROID_HOME="$HOME/Library/Android/sdk" |
| 94 | +export PATH="$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/cmdline-tools/latest/bin" |
| 95 | +``` |
| 96 | + |
| 97 | +**Linux:** |
| 98 | +```bash |
| 99 | +export ANDROID_HOME="$HOME/Android/Sdk" |
| 100 | +export PATH="$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/cmdline-tools/latest/bin" |
| 101 | +``` |
| 102 | + |
| 103 | +Some more environment variables, check [cordova docs](https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html). |
| 104 | + |
| 105 | +### Build Steps |
| 106 | + |
| 107 | +```bash |
| 108 | +# Clone the repository |
| 109 | +git clone https://github.com/Acode-Foundation/Acode.git |
| 110 | +cd Acode |
| 111 | + |
| 112 | +# Install dependencies and set up Cordova |
| 113 | +pnpm run setup |
| 114 | + |
| 115 | +# Build the APK |
| 116 | +pnpm run build paid dev apk # or pnpm run build p d |
| 117 | +``` |
| 118 | + |
| 119 | +The APK will be at: `platforms/android/app/build/outputs/apk/debug/app-debug.apk` |
| 120 | + |
| 121 | + |
| 122 | +## 📝 Contribution Guidelines |
| 123 | + |
| 124 | +### Before Submitting a PR |
| 125 | + |
| 126 | +1. **Fork** the repository and create a branch from `main` |
| 127 | +2. **Make changes** - keep commits focused and atomic |
| 128 | +3. **Check code quality:** |
| 129 | + ```bash |
| 130 | + pnpm run check |
| 131 | + ``` |
| 132 | +4. **Test** on a device or emulator if possible |
| 133 | + |
| 134 | +### Pull Request Checklist |
| 135 | + |
| 136 | +- [ ] Clear description of changes |
| 137 | +- [ ] Reference to related issue (if applicable) |
| 138 | +- [ ] Screenshots/GIFs for UI changes |
| 139 | +- [ ] Passing CI checks |
| 140 | + |
| 141 | +### Code Style |
| 142 | + |
| 143 | +We use [Biome](https://biomejs.dev/) for linting and formatting: |
| 144 | +- Run `pnpm run check` before committing |
| 145 | +- Install the Biome VS Code extension for auto-formatting |
| 146 | + |
| 147 | +### Commit Messages |
| 148 | + |
| 149 | +Use clear, descriptive messages: |
| 150 | +``` |
| 151 | +feat: add dark mode toggle to settings |
| 152 | +fix: resolve crash when opening large files |
| 153 | +docs: update build instructions |
| 154 | +refactor: simplify file loading logic |
| 155 | +``` |
| 156 | + |
| 157 | +## 🌍 Adding Translations |
| 158 | + |
| 159 | +1. Create a JSON file in `src/lang/` (e.g., `fr-fr.json` for French) |
| 160 | +2. Add it to `src/lib/lang.js` |
| 161 | +3. Use the translation utilities: |
| 162 | + ```bash |
| 163 | + pnpm run lang add # Add new string |
| 164 | + pnpm run lang remove # Remove string |
| 165 | + pnpm run lang search # Search strings |
| 166 | + pnpm run lang update # Update translations |
| 167 | + ``` |
| 168 | + |
| 169 | +## 🔌 Plugin Development |
| 170 | + |
| 171 | +To create plugins for Acode: |
| 172 | +- [Plugin Starter Repository](https://github.com/Acode-Foundation/acode-plugin) |
| 173 | +- [Plugin Documentation](https://docs.acode.app/) |
0 commit comments