Development
Introduction
Thanks for contributing — you rock! 🤘
Before getting started, please view the wiki and read the following documentation.
Table of Contents
Submitting Issues and Feature Requests
Before submitting an issue or making a feature request, please search for existing issues or look at our Github Discussions.
If you do file an issue, be sure to fill out the report completely!
Development
Environments and Primary Branches
There are several environments when working with Headless WordPress, both for the Frontend and the Backend.
Next.js (Frontend)
- Vercel Prod -
main
branch - Auto deploy - Vercel Develop -
develop
branch - Auto deploy - Vercel Preview - Auto generated with each branch and PR.
WordPress (Backend)
- WP Engine Prod -
main
branch - Manual releases only - WP Engine Dev -
develop
branch - Auto deploy via Buddy
Note: The WordPress install has a seperate Github Repo.
Git Workflow
- Create a
feature
branch offmain
- Work locally adhering to coding standards
- Merge your
feature
intodevelop
to test on WPE Dev environment - When your
feature
has been tested on WPE Dev, open a Pull Request (PR) and fill out the PR template - Your PR must pass assertions and both Vercel and Chromatic need to complete a preview deployment successfully
- After peer review, the PR will be merged back into
main
- Repeat ♻️
PR Preview Deployments
Vercel and Chromatic are connected to this Github repository and will automatically build and deploy a unique URL for each Pull Request.
Learn more about Vercel + Github and Chromatic + Github integrations.
Code Linting
This project has several rulesets and uses ESLint, Prettier, and Stylelint to enforce standards.
In addition to real-time linting, you could run the following commands in your terminal.
These commands are also used in a pre-commit hook.
Lint JavaScript:
npm run lint:js
Lint CSS:
npm run lint:css
Format your code:
npm run format
Tips to help your PR get approved
- Make sure your code editor supports real-time linting and has the recommended extensions installed
- JSDocs are required for all JavaScript functions
- Run
npm run build && npm run start
before submitting your PR, to ensure a successful build - Be courteous in your communications
Storybook
To work with Storybook on your Local, run the following command:
npm run storybook
Stories are written in .mdx
and should be placed next to the component.
Learn how to write stories for this starter.