And I forgot to welcome you to the community so welcome lol!
Thats very kind, thanks. Always happy to contribute too I’m coming from Symfony and TYPO3 background, maybe that is where my confusion starts using Composer with Mautic (And maybe it is just a project-issue which I should report [resulting from a transformation-in-progress], but that is what I’m trying to figure out^^). Let me explain from the beginning:
Somewhere I’ve read that the installation via Composer is (or will be) the recommended way of installing it, which makes totally sense. The Docs also recomment using the mautic/recommended-project
which gives us a full and ready-to-install composer.json (Depending on the system, Composer will already install everything).
Our project directory will contain the following structure:
project-root/
- app/ (is empty, just contains a .htaccess file)
- bin/
- docroot/ (this is the public HTTP accessible folder containing the Mautic app)
- vendor/
- composer.json
- composer.lock
- .gitignore
- ... (and some other files)
Now, if I run git init
inside the project-root, followed by git status
, it seems that EVERYTHING will be added to my repository, because Mautic’s .gitignore file might not be ready yet for setups using Composer (This just came into my mind while writing here).
What I would expect (from other project-setups) is ONLY adding the following files to my repo:
project-root/
- composer.json (here I have to customize the project-name, e.g. "vendor/my-project")
- composer.lock
- .gitignore
With this setup, we would be able to create a packages
folder (which is added to the repository), containing all project-related plugins and themes, each with an own composer.json. Composer will symlink them if installed to the project (or unlink them), which is very handy.
In case some core-files or other plugin-files must be modified/patched, we can make use of Composer-Patches providing some .diff files also added to the repository.
In my opinion this would be the most clean and reliable way to setup a project like this, especially without committing the whole Mautic core files (For sure, future updates have to be done by Composer as well).
Here is a .gitignore file which I had expected from the mautic/recommended-project
:
/.DS_Store
/.idea/
/app/
/bin/
/docroot/
# private or sensitive data like credentials should be replaced by getenv(), then the local.php can be added to the repo as well
!/docroot/app/config/local.php
/vendor/
.env*
autoload.php
Gruntfile.js
package.json
package-lock.json
It excludes everything which comes from the Mautic packages, except the customized composer.json/-lock. All custom project-related files like packages/ or .ddev/ will be added to the repo.
Questions remain:
- Is this a recommended Mautic setup?
- Is it an error/issue from
mautic/recommended-project
, that Mautic’s default .gitignore is not compatible with this setup (yet)?
- Even if I customize the default .gitignore like above, the scaffold will overwrite it on every Composer action. What is the recommended way to avoid it (probably also customize the
docroot/app/assets/scaffold/files/example.gitignore
file)?
As more I write here, I think it becomes more and more clear that probably it is a topic only for mautic/recommended-project
… but nore sure?!