tigrisdata.com/blog
This website is built using Docusaurus 2, a modern static website generator.
Prerequisites
Node.js version >= 14 or above (which can be checked by running node -v).
Installation
npm installConfiguration
Copy .env.local.example to .env.local:
cp .env.local.example .env.localLocal Development
npm run startThis command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
Creating a blog post
To scaffold a blog post run:
npm run blog:new --slug={slug for your post}This will create a directory in the format {current date}-{slug} with a
index.mdx. Update index.mdx with your blog post content.
Testing newsletter subscription
Newsletters subscriptions make a POST request to http://www.tigrisdata.com/api/newsletter/
This works in production because the blog is served from the same http://www.tigrisdata.com domain. It will not work in other scenarios where a cross-domain request is attempted since CORS is not enabled on the newsletter subscription API endpoint.
So to test this locally, you'll need to use a local proxy. To support this, you
can change the base URL of the newsletter subscription API endpoint using
NEXT_NEWSLETTER_API_BASE_URL in the .env.local file.
If you use https://github.com/garmeeh/local-cors-proxy, you can then set
NEXT_NEWSLETTER_API_BASE_URL to http://localhost:8010/proxy.
Build
npm run buildServe
npm run serveThis command generates static content into the build directory and can be
served using any static contents hosting service.
Code Quality
1. Linting
The coding style rules are defined by Prettier and enforced by Eslint
2. Git Hooks
We use pre-commit to automatically setup and run git hooks.
On every git commit we check the code quality using prettier and eslint.
Install pre-commit and initialize it with the included commit hooks as follows:
brew install pre-commit
pre-commit install