|
| 1 | +## Effection Website |
| 2 | + |
| 3 | +The Effection website shows documentation and packages that it pulls from GIT |
| 4 | +repositories on GitHub. |
| 5 | + |
| 6 | +## About Git Integration |
| 7 | + |
| 8 | +The Effection website uses sophisticated GitHub integration to dynamically load |
| 9 | +and display documentation and packages from Effection repositories. This |
| 10 | +integration works through multiple layers: |
| 11 | + |
| 12 | +### Repository Access |
| 13 | + |
| 14 | +- **Dual Provider System**: Uses both Git commands (`git-provider.ts`) and |
| 15 | + GitHub's Octokit API (`octokit-provider.ts`) for redundant access to |
| 16 | + repository data |
| 17 | +- **Dynamic Remote Management**: Automatically adds and fetches GitHub remotes |
| 18 | + for repositories, enabling access to branches, tags, and file contents |
| 19 | +- **Branch & Tag Detection**: Intelligently determines whether references are |
| 20 | + branches or tags and normalizes them to proper Git reference formats |
| 21 | + |
| 22 | +### Documentation Loading |
| 23 | + |
| 24 | +- **Guides**: Pulls structured documentation from `docs/structure.json` and |
| 25 | + loads MDX files from the `docs/` directory in the |
| 26 | + [**thefrontside/effection**](https://github.com/thefrontside/effection) |
| 27 | + repository |
| 28 | +- **API Documentation**: Generates API documentation using Deno's documentation |
| 29 | + generator from TypeScript source files in the |
| 30 | + [**thefrontside/effection**](https://github.com/thefrontside/effection) |
| 31 | + repository (supports both v3 and v4 via tags like `effection-v3.*` and |
| 32 | + `effection-v4.*`) |
| 33 | +- **README Integration**: Loads and renders README.md files from package |
| 34 | + directories using MDX processing |
| 35 | + |
| 36 | +### Package Discovery |
| 37 | + |
| 38 | +- **Workspace Integration**: Reads `deno.json` files to discover packages and |
| 39 | + their configurations within: |
| 40 | + - [**thefrontside/effection**](https://github.com/thefrontside/effection) - |
| 41 | + Core Effection library packages |
| 42 | + - [**thefrontside/effectionx**](https://github.com/thefrontside/effectionx) - |
| 43 | + Extended Effection ecosystem packages |
| 44 | +- **Multi-Version Support**: Handles different versions of packages by working |
| 45 | + with Git tags and branches from both repositories |
| 46 | +- **Export Mapping**: Maps package exports to their corresponding source files |
| 47 | + for direct GitHub links |
| 48 | + |
| 49 | +### Dynamic Content |
| 50 | + |
| 51 | +- **Live Repository Data**: Fetches star counts, default branches, and |
| 52 | + repository metadata directly from GitHub |
| 53 | +- **Content Versioning**: Supports loading content from specific Git references |
| 54 | + (branches, tags, commits) |
| 55 | +- **Badge Integration**: Generates badges for JSR packages, npm packages, bundle |
| 56 | + sizes, and other metrics |
| 57 | + |
| 58 | +This integration ensures that the website always reflects the current state of |
| 59 | +the Effection ecosystem by pulling data directly from the source repositories on |
| 60 | +GitHub. |
| 61 | + |
| 62 | +## Deployment |
| 63 | + |
| 64 | +The website is deployed to Deno Deploy using a static site generation process |
| 65 | +powered by the [Staticalize](https://github.com/thefrontside/staticalize) |
| 66 | +utility: |
| 67 | + |
| 68 | +### Automated Deployment Process |
| 69 | + |
| 70 | +- **Trigger**: Runs automatically every 8 hours via scheduled GitHub Action, on |
| 71 | + pushes to `main` branch, and can be manually triggered |
| 72 | +- **Static Generation**: The live website is crawled and converted to static |
| 73 | + files using Staticalize |
| 74 | +- **Search Integration**: Pagefind indexes the static content to enable |
| 75 | + client-side search functionality |
| 76 | +- **Deno Deploy**: Static files are uploaded to |
| 77 | + [Deno Deploy](https://deno.com/deploy) and served via their edge network |
| 78 | + |
| 79 | +### Deployment Pipeline |
| 80 | + |
| 81 | +1. **Server Startup**: Spins up the dynamic website locally using |
| 82 | + `deno task dev` |
| 83 | +2. **Content Crawling**: Staticalize crawls `http://127.0.0.1:8000` to generate |
| 84 | + static HTML/CSS/JS |
| 85 | +3. **Search Indexing**: Pagefind processes the static files to create search |
| 86 | + indexes |
| 87 | +4. **Upload**: Deploys the built static site to the `effection-www` project on |
| 88 | + Deno Deploy |
| 89 | + |
| 90 | +This ensures the website stays current with repository changes while providing |
| 91 | +fast global delivery through static hosting. |
| 92 | + |
| 93 | +## Troubleshooting |
| 94 | + |
| 95 | +### "Bad credentials" Error from GitHub API |
| 96 | + |
| 97 | +If you encounter an `HttpError: Bad credentials` error when running the website: |
| 98 | + |
| 99 | +1. **Verify your GITHUB_TOKEN**: Ensure the `GITHUB_TOKEN` environment variable |
| 100 | + is set with a valid GitHub personal access token |
| 101 | +2. **Clear the cache**: Old cached data may contain requests made with an |
| 102 | + expired or invalid token. Run the clear-cache task: |
| 103 | + ```bash |
| 104 | + deno task clear-cache |
| 105 | + ``` |
| 106 | +3. **Restart the server**: After clearing the cache, restart the development |
| 107 | + server |
| 108 | + |
| 109 | +This error typically occurs when the cache contains authenticated requests from |
| 110 | +a previous token that is no longer valid. |
0 commit comments