Table of Contents
Technology
We use Gatsby for static site generation because sites built with it are very fast.
This framework uses React and JavaScript/TypeScript.
Source Code
The website lives in docs/
directory of golangci-lint repository.
Theme
Initially the site is based on @rocketseat theme.
Later we've merged it's code into src/@rocketseat
because we needed too much changes
and gatsby shadowing doesn't
allow shadowing gatsby-node.js
or gatsby-config.js
.
Navigation
Left menu is configured in src/config/sidebar.yml
.
Articles
Articles are located in src/docs/
in *.mdx
files. MDX is markdown
allowing to use React
components.
Templating
We use templates like {.SomeField}
inside our mdx
files. There templates are expanded
by running make expand_website_templates
in the root of the repository.
It runs script scripts/expand_website_templates/main.go
that rewrites mdx
files with replaced templates.
CDN and DNS
We use CloudFlare for CDN, proxying and DNS management.
Hosting
We use Netlify as static website hosting and CD.
It's integrated into our pull requests: if docs/
directory has changes Netlify
will trigger website rebuild and deploy it's preview for a branch. You can view
it to ensure that everything ok.
Netlify deploys the website to production after merging anything to a master
branch.
Local Testing
Run:
npm installnpm run start
And navigate to http://localhost:8000
after successfull Gatsby build.
There is no need to restart Gatsby server almost for all changes: it supports hot reload.
Also, there is no need to refresh a webpage: hot reload updates changed content on the open page.
Trigger Website Rebuild
Currently, Netlify triggers rebuild only if anything has changes in docs/
directory.
But we can add a new linter and need to change a documentation to list the linter.
To do it run
go run ./scripts/expand_website_templates/main.go -only-state
It saves a hash of template replacements (that include all linters, configs, etc)
into docs/template_data.state
.