The following is a set of guidelines for contributing to the Frocentric Wordpress codebase, which are hosted in the Frocentric Organisation on GitHub. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.
This project and everyone participating in it is governed by the Frocentric Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to tech.team@frocentric.io.
All project issues are created, discussed and managed within the repository. Ad-hoc or real-time issue conversations may take place within the project chat group as appropriate.
Frocentric uses GitLab Flow for commit management. Examples below are based on the bash commandline environment, but you may use your Git client of preference, e.g. GitHub Desktop, Tower, etc.
To get started with your local development environment, you should first clone the main branch of the repository:
git clone git@github.com:frocentric/wordpress.git
cd wordpress
composer install
Create local feature branches to manage your work. These should be branched directly off of the main branch and named as "issue-[issue number]".
$ git checkout -b issue-XXDeveloping in the Frocentric codebase is best conducted with an IDE like VS Code or PHPStorm, which provide code management, debugging and other helpful functionality.
As our WordPress configuration is managed via Composer, extensions like plugins and themes can't be installed or updated freely via the WordPress control panel. Installing a new extension requires adding the relevant entry to composer.json and (also if updating extensions) then executing:
$ composer updateIt is recommended to keep your changes grouped logically within individual commits. When reviewing or maintaining code, it's often easier to review segregated changes that are split across multiple commits.
$ git add my/changed/files
$ git commitA good commit message should describe what changed and why. Frocentric projects follow the Conventional Commits specification to streamline documentation and maintenance.
Examples of commit messages with semantic prefixes:
fix: don't overwrite prevent_default if default wasn't preventedfeat: add app.isPackaged() methodchore: beautifl site-specific plugin now activated by default
Accepted prefixes:
fix: A bug fixfeat: A new featuredocs: Documentation changestest: Adding missing tests or correcting existing testsbuild: Changes that affect the build systemci: Changes to our CI configuration files and scriptsperf: A code change that improves performancerefactor: A code change that neither fixes a bug nor adds a featurestyle: Changes that do not affect the meaning of the code (linting)vendor: Bumping a dependency like libchromiumcontent or node
Other things to keep in mind when writing a commit message:
- The first line should:
- contain a short description of the change (50 characters or less)
- be entirely in lowercase with the exception of proper nouns, acronyms, and the words that refer to code, like function/variable names
- Keep the second line blank.
- Wrap all other lines at 72 columns.
A commit that has the text BREAKING CHANGE: at the beginning of its optional
body or footer section introduces a breaking API change (correlating with Major
in semantic versioning). A breaking change can be part of commits of any type.
e.g., a fix:, feat: & chore: types would all be valid, in addition to any
other type.
See conventionalcommits.org for more details.
We use Commitizen and commitlint to support the creation of compliant commit messages. The following extensions are recommended for commits from IDEs/editors:
- Conventional Commits for VS Code.
- Conventional Commits for JetBrains IDEs (PHPStorm, WebStorm, etc)
Once you have committed your changes, you should then use git merge to synchronize your branch with the latest changes from the GitHub repository.
$ git fetch origin
$ git merge origin/mainThis ensures that your working branch has the latest changes from the main branch.
Once your commits are ready to go, push your working branch to GitHub.
$ git push origin issue-XXOnce your changes are ready to be deployed, submit a pull request to the main branch, where it will be reviewed and merged or passed back for any requested changes.
Note: The standard Git commandline doesn't support making a pull request on GitHub, so you must use the web interface or a desktop client for this step
After being merged to main, a GitHub Action
is configured that automatically deploys the code to the staging website. Once the pull request is merged,
the deployment will take 2-3 minutes to execute, after which you can review and test your changes in that environment.