./flow package:create (The hidden feature)
Okay, let's be honest. You know that package:create command.
But did you know, that if your composer.json contains a repository with a local path
Flow will create the package in that path and run a composer require .?
The composer.json has to look like this:
{
"name": "vendor/distro",
"description": "Vendor Distro Something",
"config": {
"bin-dir": "bin",
"vendor-dir": "Packages/Libraries"
},
"repositories": [
{
"type": "path",
"url": "./Repository/*"
},
],
"scripts": {
"post-install-cmd": "Neos\\Flow\\Composer\\InstallerScripts::postUpdateAndInstall",
"post-update-cmd": "Neos\\Flow\\Composer\\InstallerScripts::postUpdateAndInstall",
"post-package-install": "Neos\\Flow\\Composer\\InstallerScripts::postPackageUpdateAndInstall",
"post-package-update": "Neos\\Flow\\Composer\\InstallerScripts::postPackageUpdateAndInstall"
}
}The essential Part is, that the url begins with ./ and ends with /* for the feature to work.
Wanna replace the index.php of your distribution? Wanna deliver an .htaccess file with your package? Tired of writing scripts that copy stuff during deployment?
Try installer-resource-folders now and get a surprise for free!
This composer package extra config tells the flow framework to copy files during package installation.
Pack your stuff into your package's Resources/Private/Installer/Distribution/Defaults
or Resources/Private/Installer/Distribution/Essentials folder and add the extra section to your package's composer.json:
{
"name": "vendor/package",
"description": "Vendor Package Something",
"extra": {
"neos": {
"installer-resource-folders": [
"Resources/Private/Installer/"
]
}
}
}