dandelion / dandelion
Requires
- php: >=7.3
- ext-curl: *
- ext-json: *
- ext-phar: *
- ext-sysvsem: *
- guzzlehttp/guzzle: ^7.0.0
- phpdocumentor/reflection-docblock: ^5.0.0
- pimple/pimple: ^3.3.0
- swaggest/json-schema: ^0.12.0
- symfony/console: ^5.0.0
- symfony/finder: ^5.0.0
- symfony/lock: ^5.0.0
- symfony/process: ^5.0.0
- symfony/property-access: ^5.0.0
- symfony/property-info: ^5.0.0
- symfony/serializer: ^5.0.0
Requires (Dev)
- codeception/codeception: ^4.0
- mikey179/vfsstream: ^1.6
- php-coveralls/php-coveralls: ^2.2
- phpmd/phpmd: ^2.8
- phpstan/phpstan: ^0.12
- roave/security-advisories: dev-master as 1.0.0
- sebastian/phpcpd: ^5.0
- sllh/composer-versions-check: ^2.0
- squizlabs/php_codesniffer: ^3.5
This package is auto-updated.
Last update: 2024-11-30 01:47:09 UTC
README
Getting started
Set up a repository which includes all your packages source code and the dandelion configuration file.
Example structure:
.
+-- dandelion.json
+-- Package1
| +-- ...
+-- Package2
| +-- ...
+-- tmp
Next you want to create read-only repositories for your packages in order to split and release into those repositories. The read-only repositories will be the one you link to in your dandelion configuration file.
Create a temp folder in your repository root where the split repositories will be located. You can set this directory to any path you like in the configuration file.
Usage
The recommended way is to use docker. The docker image comes with a self-contained splitsh binary, you don't need to download or compile it yourself. If you choose one of the other options to run Dandelion, please have a look at the section Install splitsh.
Choose your favorite method below.
Workflow example
- Commit and push changes to your monorepo
- Use split all to push all changes to read-only repositories
- Use release all to create new releases for your packages
Available commands
dandelion split:all
-> splits all packages listed in your configurationdandelion split $PACKAGE_NAME
-> split out a specific packagedandelion release:all
-> release all packages listed in your configurationdandelion release $PACKAGE_NAME
-> release a specific package
Docker
docker run --rm -v $PWD:/home/dandelion dandelion:latest -c "$COMMAND"
When you choose Docker as preferred way, you will need to use a Git authentication flow that runs without user interaction. If that is not a viable option for you but you still want to use Docker, you can configure your own Docker image using a keypair authentication flow.
PHAR
Download the latest release from the Github.
php dandelion.phar $COMMAND
composer
Global Installation
composer global require dandelionphp/dandelion
Make sure to add composer to your PATH:
macOS: $HOME/.composer/vendor/bin
GNU / Linux Distributions: $HOME/.config/composer/vendor/bin or $HOME/.composer/vendor/bin
dandelion $COMMAND
Local Installation
composer require --dev dandelionphp/dandelion
vendor/bin/dandelion $COMMAND
Install splitsh
Currently splitsh-lite is available for MacOS and Linux. If you need a different version you have to compile it from source. In case you need to compile an alpine version, you might want to take a look at the dockerfile, which does exatly that in the fist stage.
Download the binary from Github and place it in /usr/local/bin
or wherever you like.
If you choose a different location keep in mind to set the path in the configuration file.
Configuration
You can download an example configuration here.
Properties
repositories(type:Object):
Contains all information about your repositories. Repository name can be anything.
url(type:String):
Url to read-only repository.
path(type:String):
Name of your local package.
version(type:String):
Package version to release.
pathToTempDirectory(type:String):
Can be any writeable path and is used to create releases of your packages.
pathToSplitshLite(type:String):
Path to splitsh library, default is /usr/local/bin/split-slite, see install splitsh for more information.
Example Config
{ "repositories": { "dandelion-example-1": { "url": "https://<GITHUB_TOKEN>@github.com/<OWNER>/<REPO>.git", "path": "example-1/", "version": "1.1.0" }, "dandelion-example-2": { "url": "https://<GITHUB_TOKEN>@github.com/<OWNER>/<REPO>.git", "path": "example-2/", "version": "1.0.0" } }, "pathToTempDirectory": "/tmp/", "pathToSplitshLite": "/usr/bin/splitsh-lite" }
Note: It is important to use trailing slashes on path references
Git Authentication
Github
If you choose to use the token based authentication, keep in mind that your token will be visible in plain text in your dandelion config as well as
in .git/config
. You'll find more information about that auth style here.
Go to your Github settings and create a personal access token. The scope for the access token is repo
.