Skip to content

Latest commit

 

History

History
164 lines (128 loc) · 7.36 KB

README.md

File metadata and controls

164 lines (128 loc) · 7.36 KB

Effection Website

The Effection website shows documentation and packages that it pulls from GIT repositories on GitHub.

Configuration

Every argument and environment variable the site accepts is declared in one place, cli.ts, using Configliere. Inputs are validated before main() starts, so a bad value fails immediately with a message instead of surfacing as a confusing runtime error later in the boot.

Run deno run -A main.tsx --help for the current list. Each parameter is addressable two ways — as a --kebab-case flag or as a SCREAMING_SNAKE_CASE environment variable — and the command line wins when both are supplied.

Flag Environment Default Purpose
--port PORT 8000 Port the HTTP server listens on. 0 picks a free one
--github-token GITHUB_TOKEN unauthenticated GitHub access token for the API
--jsr-api JSR_API none JSR API token; the score card is skipped without it
--deno-deployment-id DENO_DEPLOYMENT_ID fresh id per boot Deployment identity behind the ETag
--effectionx-dir EFFECTIONX_DIR none Local effectionx checkout to read instead of cloning
--clones-dir CLONES_DIR build/clones Git clones of the documented repositories
--worktrees-dir WORKTREES_DIR build/worktrees A git worktree per documented series
--pagefind-dir PAGEFIND_DIR pagefind Generated Pagefind search bundle
--tailwind-input TAILWIND_INPUT main.css Tailwind entry stylesheet
--tailwind-outdir TAILWIND_OUTDIR tailwind Where the compiled stylesheet is written
--verbose VERBOSE false Emit debug and warning logs, not just info and error

The defaults reproduce what used to be hardcoded, so deno task dev and the deployment workflow need no flags.

Development

deno task dev

Using a local checkout of effectionx

The website clones thefrontside/effectionx into build/clones and reads its packages from main. To see a checkout you are working in instead — its branch, its uncommitted changes and all — point EFFECTIONX_DIR at it:

EFFECTIONX_DIR=../effectionx deno task dev

--effectionx-dir ../effectionx does the same thing, as with every other parameter in the table above.

The directory is used exactly as it is on disk. It is never fetched or reset, so the site cannot disturb work in progress, and a path that does not exist fails at startup rather than on the first request that needs it.

About Git Integration

The Effection website uses sophisticated GitHub integration to dynamically load and display documentation and packages from Effection repositories. This integration works through multiple layers:

Repository Access

  • Dual Provider System: Uses both Git commands (git-provider.ts) and GitHub's Octokit API (octokit-provider.ts) for redundant access to repository data
  • Dynamic Remote Management: Automatically adds and fetches GitHub remotes for repositories, enabling access to branches, tags, and file contents
  • Branch & Tag Detection: Intelligently determines whether references are branches or tags and normalizes them to proper Git reference formats

Documentation Loading

  • Guides: Pulls structured documentation from docs/structure.json and loads MDX files from the docs/ directory in the thefrontside/effection repository
  • API Documentation: Generates API documentation using Deno's documentation generator from TypeScript source files in the thefrontside/effection repository (supports both v3 and v4 via tags like effection-v3.* and effection-v4.*)
  • README Integration: Loads and renders README.md files from package directories using MDX processing

Package Discovery

  • Workspace Integration: Reads deno.json files to discover packages and their configurations within:
  • Multi-Version Support: Handles different versions of packages by working with Git tags and branches from both repositories
  • Export Mapping: Maps package exports to their corresponding source files for direct GitHub links

Dynamic Content

  • Live Repository Data: Fetches star counts, default branches, and repository metadata directly from GitHub
  • Content Versioning: Supports loading content from specific Git references (branches, tags, commits)
  • Badge Integration: Generates badges for JSR packages, npm packages, bundle sizes, and other metrics

This integration ensures that the website always reflects the current state of the Effection ecosystem by pulling data directly from the source repositories on GitHub.

Deployment

The website is deployed to Deno Deploy using a static site generation process powered by the Staticalize utility:

Automated Deployment Process

  • Trigger: Runs automatically every 8 hours via scheduled GitHub Action, on pushes to main branch, and can be manually triggered
  • Static Generation: The live website is crawled and converted to static files using Staticalize
  • Search Integration: Pagefind indexes the static content to enable client-side search functionality
  • Deno Deploy: Static files are uploaded to Deno Deploy and served via their edge network

Deployment Pipeline

  1. Server Startup: Spins up the dynamic website locally using deno task dev
  2. Content Crawling: Staticalize crawls http://127.0.0.1:8000 to generate static HTML/CSS/JS
  3. Search Indexing: Pagefind processes the static files to create search indexes
  4. Upload: Deploys the built static site to the effection-www project on Deno Deploy

This ensures the website stays current with repository changes while providing fast global delivery through static hosting.

Troubleshooting

"Bad credentials" Error from GitHub API

If you encounter an HttpError: Bad credentials error when running the website:

  1. Verify your GITHUB_TOKEN: Ensure the GITHUB_TOKEN environment variable is set with a valid GitHub personal access token
  2. Clear the cache: Old cached data may contain requests made with an expired or invalid token. Run the clear-cache task:
    deno task clear-cache
  3. Restart the server: After clearing the cache, restart the development server

This error typically occurs when the cache contains authenticated requests from a previous token that is no longer valid.