First, thank you for taking the time to contribute!
The following is a set of guidelines for contributors as well as information and instructions around our maintenance process. The two are closely tied together in terms of how we all work together and set expectations, so while you may not need to know everything in here to submit an issue or pull request, it's best to keep them in the same document.
Contributing isn't just writing code - it's anything that improves the project. All contributions are managed right here on GitHub. Here are some ways you can help:
If you're running into an issue, please take a look through existing issues and open a new one if needed. If you're able, include steps to reproduce, environment information, and screenshots/screencasts as relevant.
New features and enhancements are also managed via issues.
Pull requests represent a proposed solution to a specified problem. They should always reference an issue that describes the problem and contains discussion about the problem itself. Discussion on pull requests should be limited to the pull request itself, i.e. code review.
For more on how 10up writes and manages code, check out our 10up Engineering Best Practices.
The develop
branch is the development branch which means it contains the next version to be released. trunk
contains the latest released version. Always work on the develop
branch and open up PRs against develop
.
- Node.js >= 16.0.0.
- Clone the project
[email protected]:10up/10up-toolkit.git
somewhere. cd
into the cloned repository- Run
npm install
- Install wp-env using
npm -g i @wordpress/env
if you don't already have it. - Go to the
projects/10up-theme
folder where you cloned the repository. - Run
wp-env start
which will give you a WP instance to work in. - Activate the
10up-theme
theme under Appearances > Themes - Run
npm start
to watch for changes and build.
After completing the steps above, you can make changes to the ./packages/
files and see how they change the build you have in the sample ./projects/10up-theme
project. You can experiment by adding a console.log to the 10up-toolkit/packages/toolkit/scripts/start.js
file and looking the output in the terminal.
This is a mono repo that leverages NPM Workspaces If you get a warning about missing files, modules, or packages you should do :
npm install
-> get public dependenciesnpm run build
-> build all dependencies
if your issues are not mentioned here please open an issue so that we can extend the guides
We use changesets to manage changelogs and releases.
When creating a PR that should trigger a release you should include a changeset within your PR.
To include a changeset follow these steps:
- Run
npx changeset add
- Follow the prompts, the CLI will ask you to select which packages should have a major, minor and patch bump. Use space to select the packages and hit enter to go to the next step. To skip a prompt (e.g if you changes do not require a major bump) just hit enter without selecting a package.
- Enter a short message describing the changes. You can always change the changelog entry by editing the newly created file in
.changesets/[name].md
- Add the changesets to your PR (
git add
), commit and push.
A github bot will check if you PR include a changeset file. If it doesn't you will be warned in the PR.
Whenever a PR is merged to the develop
branch, if it contains a changeset a new PR will be opened automatically against develop
to bump versions and push to npm
under the next
tag. Merging this PR opened by changeset
will trigger the release flow.
You do not need to release a new version to NPM on every PR that is merged, you can batch as many PRs as you want. For stable releases though, typically we'd only merge develop
into trunk
once we're ready for a new stable release.
Here's a summary of the process
- Merge a PR with changesets files into
develop
- Wait for
changeset
to open a new PR calledRelease (next)
. - Optionally merge more PRs into
develop
if you want to include other changes in the same release. Doing so will update theRelease (next)
PR automatically. - Merge the PR opened by
changeset
intodevelop
. - A new release under the
next
tag will be pushed to npm. - A new GitHub Release with the changelog will be created automatically.
Whenever a PR is merged to the trunk
branch, if it contains a changeset a new PR will be opened automatically against trunk
to bump versions and push to npm
under the latest
tag. Merging this PR opened by changeset
will trigger the release flow.
To promote a next release to a stable release, first make sure to release the @next
version by merging the Release (@next)
PR opened by changeset. Then open a PR from develop
against trunk
and merge the Release
PR into trunk
.
After a new stable version has been released, merge trunk
back into develop
.
Here's a summary of the process
- Follow the process to create a
next
release and test that the release is good to go. - Merge
develop
intotrunk
. - Wait for
changeset
to open a new PR calledRelease
. - Merge the PR opened by
changeset
intotrunk
. - A new release under the
latest
tag will be pushed to npm. - Merge
trunk
back intodevelop
. - A new GitHub Release with the changelog will be created automatically.