How to work with git + composer + development and production enviroment?



How to work with git and composer in development and production enviroment?

I have some problems… i don’t know how to solve this in correct way.

I need solution for dev (oxid vm) and production (on server) enviroment.

Me and my friend works together on few our modules in the same time. All modules are in git repository.

At this moment we are using only git for pushing and pulling out actual versions of modules. In main composer file we have to add row with AUTOLOAD for each module we have. At this moment we have more than 10 our modules (all private modules) on each OXID instance. Now we want to make updates a little bit faster - one operation for all modules. Please tell me how do this in correct way?

I have some plan, I will describe it and add please give me some hint if you have any:

DEVELOPER ENVIROMENT (local vm) - read & write from git

  • download all our modules with “git clone” method and add “autoload” path in main composer.json
  • for update all modules use option in PHPStorm “VCS > Update Project” - all manually added modules to phpstorm will updated

Question: Can i use composer update for my modules which I will update with git?
I ask because when i’m using composer for updating modules in dev env I have some problems. For example composer is downloading “.git” catalog in “vendor/myvendor/mymodname” catalog too. Is it ok? When I execute “composer update” and I have “.git” catalog in vendor, terminal throws me info that it has a problem with overriding some files from this catalog.
I also noticed that PHPStorm shows me new remote branch “composer/master” in my vcs tool but this branch not exist in bitbucket.

PRODUCTION ENVIROMENT (online server) - only read from git

  • add all modules with composer:
    composer config repositories.myvendor/mymodname vcs https://[email protected]/mymodname.git
    composer require myvendor/mymodname:dev-master

  • for update all modules i can use:
    composer update --no-scripts --no-plugins
    composer update

  • optional: execute command for source catalog after composer update: ( find source/Application/modules/myvendor -type d -name “.git” && find source/Application/modules/myvendor -name “.gitignore” && find source/Application/modules/myvendor -name “.gitmodules” ) | xargs -d ‘\n’ rm -rf to remove all .git folders and the same for vendor

Question 1: Is catalog “.git” in “vendor/myvendor/mymodname” folder will be make some mess? I think until I don’t make any changes in code and don’t make any commits in “source/Application/modules/myvendor/mymodname” it will be ok.
Question 2: Is any option to execute composer which some flag and then i will not have any .git catalog in “source/Application/modules/myvendor/mymodname” or “vendor/myvendor/mymodname”? Is the only one solution is and private option???