This guide explains why and how to preview Pulsar content locally with detailed steps and various examples.
It is required to preview your changes locally and attach the preview screenshots in your PR description. It brings many benefits, including but not limited to:
Pulsar documentation is built using Docusaurus. To preview your changes as you edit the files, you can run a local development server that serves your website and reflect the latest changes.
To verify docs are built correctly before submitting a contribution, you should set up your local environment to build and display the docs locally.
corepack enable)Installing prerequisites with Homebrew on macOS or Linux:
# uninstall any existing node installation brew uninstall node # install node v20 LTS brew install node@20 # link node v20 brew link node@20 # enable corepack corepack enable
Docusaurus supports Node v18 LTS and v20 LTS so ensure you have one of these versions installed. Sometimes Homebrew has Corepack installed, but it's not available.
Some commands to fix the corepack installation:
# delete node symlinks if they exist brew unlink node # uninstall default node version brew uninstall node # uninstall yarn brew uninstall yarn # upgrade packages brew upgrade # delete node@20 symlinks brew unlink node@20 # install node v20 LTS if not already installed brew install node@20 # recreate symlinks brew link node@20 # delete broken symlinks in /opt/homebrew/bin find /opt/homebrew/bin -type l ! -exec test -e {} \; -delete # enable corepack, if the command fails, remove the conflicting files from `/opt/homebrew/bin` and try again corepack enable
Please also ensure that you have upgraded Homebrew packages to the latest versions. Run brew upgrade to upgrade all installed packages.
Don‘t install yarn separately from a package manager since it’s included with corepack, which is bundled with node@20. If you're using Homebrew, uninstall any existing yarn installation with brew uninstall yarn to avoid conflicts.
If corepack enable fails due to file conflicts, verify that no legacy corepack or yarn package is already installed. If found, remove them. Removing corepack on updated Homebrew installations is not recommended since it uninstalls the node@20 package. If corepack enable continues to fail due to conflicting files, manually remove the conflicting files from /opt/homebrew/bin and try again.
Pulsar website changes refer to all the changes made to the Pulsar website, including but not limited to the following pages:
Follow these steps to preview the website changes.
Change to the working directory:
cd pulsar-site/
Run the following command to preview changes:
# Preview changes on master (next version documentation) ./preview.sh # preview changes on a specific version ./preview.sh 4.0.x # preview changes on multiple versions ./preview.sh 4.0.x 3.0.x current
If you have content staleness issues, you can pass the --clean (or -c) flag to the preview.sh script to clean Docusaurus cache and start a fresh build. This runs yarn run docusaurus clear before starting the preview server.
By default, a browser window will open at http://localhost:3000 to show the changes:
:::tip
When you click on Docs, you are taken to the latest stable version (e.g., http://localhost:3000/docs/2.10.x/). If you want to preview changes on master, change the URL to http://localhost:3000/docs/next
:::
Switch to your command-line interface and press Control+C.