- Node.js 22+ (see
.nvmrc) - npm 10+
npm install-
GITHUB_TOKEN— a GitHub personal access token, required byfetchGithubContributions(GitHub's GraphQL API requires authentication even for public data). No scopes are needed. Export it in your shell before running anything that hits GitHub:export GITHUB_TOKEN=ghp_xxxGitLab's contribution data (
fetchGitlabContributions) uses a public endpoint and needs no token.
npm run build # compile to dist/
npm run fetch -- gitlab <username> # print a GitLab user's contribution days
npm run fetch -- github <username> # print a GitHub user's contribution days (needs GITHUB_TOKEN)
# generate the unified graph (needs GITHUB_TOKEN, GITHUB_USERNAME, GITLAB_USERNAME)
# writes <prefix>-light.svg and <prefix>-dark.svg
npm run generate-graph -- contributions.github/workflows/generate-graph.yml runs generate-graph daily and pushes the
resulting contributions-light.svg / contributions-dark.svg to a dedicated assets
branch (kept separate from main so scheduled runs don't add noise to its history). The
README embeds both via a <picture> element with prefers-color-scheme sources, so
GitHub shows whichever variant matches the viewer's theme — a README can't run any code
(no fetch, no scripts) to pick a theme at runtime, only reference static image URLs, so
both variants have to be pre-rendered. Files are served from raw.githubusercontent.com,
which serves straight out of a public repo with no auth needed.
DevGrid isn't published as an npm package or a reusable GitHub Action yet — the way to run this for yourself today is to fork or copy this repo and point it at your own accounts:
- In
.github/workflows/generate-graph.yml, change theGITHUB_USERNAMEandGITLAB_USERNAMEenv values to your own usernames on each platform. - Make sure the repo allows Actions to push: Settings → Actions → General → Workflow
permissions → "Read and write permissions". Some accounts/orgs default this to
read-only, which would make the workflow's push step fail even though
permissions: contents: writeis already declared in the workflow file. No token or secret needs to be created —${{ github.token }}(auto-provided by Actions) is enough to query GitHub'scontributionsCollection, confirmed working. - In
README.md, update the threeraw.githubusercontent.com/manuelzzz/DevGrid/...URLs to your own<owner>/<repo>. - Run the workflow once manually (Actions tab → "Generate contribution graph" → Run
workflow) to create the
assetsbranch and the first two SVGs, rather than waiting for the next scheduled run.
npm test # run tests once
npm run test:watch # run tests in watch modenpm run lint # check for lint errors
npm run lint:fix # fix lint errors automatically
npm run format # format files with Prettier
npm run format:check # check formatting without writing
npm run typecheck # check TypeScript types without emittingCI runs format:check, lint, typecheck, and test on every push and pull request. Run these locally before pushing.