DevShop Git Repo Management
The Megarepo
Many components of the devshop framework are included in one single "megarepo".
This page documents how to add new components that need to be split up into separate git repos, and how to import existing git repos into new components.
Secondary Repos
Components
DevShop is a DevOps framework. It contains many components that work independently.
These components are pushed out to other git repos as Composer Packages.
Adding new Components
To add a new component follow these steps:
Pick a name for the component. Try to use two words, CamelCase. A component
can include many classes, so group them logically.
Create a new directory in
./src/DevShop/Component
using the component name.Copy the
./src/DevShop/Templates/ComponentTemplate
folderinto .src/DevShop/Component
and rename it.Add a the component code. This folder will become a standalone Composer package.
Follow the direction of the symfony/symfony repository. See the Process Component for an example of best practices.
Create a git repository on GitHub: https://github.com/new
Select
devshop-packages
as the owner.Add the same purpose statement from the
README.md
to the Description field.Format the repository name by converting CamelCase ComponentName to
component-name
.Set it to Public.
DO NOT SELECT Initialize this repository with a README, Add .gitigire or Add a license. The GitSplit tool will populate this repo.
Press "Create Repository" to create the new git repo.
Add the package name to the
replace
section ofdevshop/composer.json
. If the component is required by thedevshop
CLI, add it torequire
instead as"devshop/component-name": "*"
.Add the Secondary Repository information to the
config.git-split.repos
section of the maindevshop/composer.json
file.Use the path within the
opendevshop/devshop
repo to the component as the key of the array element, and the git repo URL as the value.It should look something like this:
Create a new branch from
develop
and push it:Use the branch naming convention
component/php/git-split
.NOTE: GitHub now provides a direct link to the "Create Pull Request" page after you push a new branch. Look for this in the output of the first
git push
command on a new branch.
GitHub Actions: Automated Git Split
As soon as you push this new branch, (even before you submit a pull request), GitHub Actions will run our workflows on your branch. Check the GitHub Actions page on the DevShop Repo for the Git Management workflow results.
Once you feel your component is read for review by the DevShop Team, submit a Pull Request!
Merging in external repos
If a component repo exists already, you can merge it in with the git subtree
command.
Create a new branch from develop
first, then pull in the tree:
Then submit a PR against develop
branch.
See https://www.jvt.me/posts/2018/06/01/git-subtree-monorepo/ for a good explanation.
List of Components
This list is changing rapidly. We'll try to keep it up to date with status.
Component: GitSplit
GitSplit - Composer command and bin script to run splitsh-lite. This is used to split the monorepo.
Follow Symfony
Symfony solved how to build a big repo with many components.
Refer to Symfony/symfony codebase for examples.
Useful examples include:
Commit to add a new Component: https://github.com/symfony/symfony/commit/053de25edffaf39a6d7e16d0badbedf79f89a8e3#diff-b5d0ee8c97c7abd7e3fa29b9a27d1780
Last updated