Tribe Libs is a collection of libraries created by Modern Tribe for use with Square One-based WordPress projects. It is required by the Square One core plugin.
composer require moderntribe/tribe-libs
All usage documentation lives in the Square One repository.
Usage of Tribe Libs is not actively supported by Modern Tribe outside of client contracts. Pull requests and suggestions are welcome and will be addressed based on business need.
This library comprises a large collection of smaller libraries that can be included in whole or in part on Square One projects. These libraries are developed following the monorepo model. All changes are committed to this, the parent project. Maintenance of the individual packages is managed using the Monorepo Builder utility.
- Ensure that all code for the release is merged to
master
- Ensure that all updates for the release are logged in
CHANGELOG.md
- Run the release script, with the version number for the release (format:
v<major>.<minor>.<patch>
):./monorepo.sh release v3.0.0
- The script will handle several steps for you automatically:
- Set any package interdependencies to the new version
- Update
CHANGELOG.md
with the appropriate version number - Create the git tag and push it to GitHub
- Bump the
master
branch version to the next minor version number
- When the tag is pushed to GitHub, an Action there will automatically split the monorepo and deploy the tag to all of the package repos. (Note: The GH Action will run as a bot user with appropriate permissions to write to all of the package repositories. Those repositories are read-only for normal usage.)
- Create a new directory for the package in
src
. Create your code there, include an independentcomposer.json
for the package (you can copy the sample), and commit it to tribe-libs. - Create an empty public GitHub repository for the package (you probably need to be an org admin to
complete this step). Follow the naming convention
moderntribe/square1-*
. Ensure that the usertr1b0t
has write access to the repo. Use the scriptdev/monorepo/scripts/create-package-repo.sh
to create the repo and add thetr1b0t
user automatically../dev/monorepo/scripts/create-package-repo.sh square1-my-new-repo
- Add the directory and repo to the
directories_to_repositories
map inmonorepo-builder.yml
. - Run the script to merge the package
composer.json
files to the rootcomposer.json
file:./monorepo.sh merge
- After the next release, Register the package on Packagist.
- Add the dependency to
composer.json
in the package(s) that needs it. - Run the
merge
command to merge dependencies up to the rootcomposer.json
./monorepo.sh merge
You will rarely need to do this, but it is documented here just in case.
- Set the
master
branch alias for all packages./monorepo.sh set-alias 3.0
- Bump the interdependencies among the packages to the same version.
./monorepo.sh bump-interdependency "^3.0"
A release should be automatically deployed to all package repos by GitHub Actions whenever a tag is pushed to GitHub. That is really just running this command (but with appropriate permissions to push to all repos):
./monorepo.sh split --tag="v3.0.0"
Your GitHub user must have write access to all of the square1-*
repositories to complete this successfully (this is
why we have the GitHub Action).