cancel
Showing results for 
Search instead for 
Did you mean: 

"composer install" overwrite customizations outside of vendor folder

0 Kudos

"composer install" overwrite customizations outside of vendor folder

Feature request from vesan-83, posted on GitHub Aug 18, 2016

"composer install" command overwrite modifications in mapped files (files from composer.json -> extra.map node of magento/magento2-base module).

Preconditions

Magento 2.1.0

Steps to reproduce

  1. Clone the project where any of mapped file is customized e.g. pub/index.php or dev/tools/grunt/configs/themes.js
  2. Run "composer install"

Expected result

  1. Customized file will stay customized so that "composer install" will not touch existing files.

Actual result

  1. Customized file is replaced by default one
8 Comments
apiuser
New Member

Comment from maderlock, posted on GitHub Aug 18, 2016

I suspect that this is a feature, not a bug. Are there particular files that you think should be not part of the Magento core?

apiuser
New Member

Comment from hostep, posted on GitHub Aug 18, 2016

Duplicate for dev/tools/grunt/configs/themes.js file: https://github.com/magento/magento2/issues/4697

For the pub/index.php file, this is very dangerous what you are asking. If Magento decides to update the index.php file in a new version, and you upgraded your project you would miss those updates on the index.php file.

apiuser
New Member

Comment from remkoj-ism, posted on GitHub Aug 18, 2016

For the pub/index.php file, this is very dangerous what you are asking. If Magento decides to update the index.php file in a new version, and you upgraded your project you would miss those updates on the index.php file.

The "composer install" command is IMHO intended to restore the dependencies of the application, but not modify the application in any way. The fact that it modifies a file which may contain additional pre-initialization logic (it may not be the most beautiful way, but it can be the most efficient way) breaks the ability to distribute an application without including its dependencies.

When talking about the "composer upgrade" command, especially when it updates the Magento base package, I agree with the argument above.

apiuser
New Member

Comment from hostep, posted on GitHub Aug 18, 2016

Ok that probably makes sense.

We currently have the same "problem" with the pub/.htaccess file, but we work around it in our deploy scripts, by doing this:

run('tools/composer.phar install --prefer-dist --no-dev')
run('git checkout pub/.htaccess')
apiuser
New Member

Comment from andimov, posted on GitHub Aug 22, 2016

This is a duplicate of #4697 I'm closing this one. Please feel free to reopen if you need.

apiuser
New Member

Comment from vesan-83, posted on GitHub Aug 28, 2016

It's not duplicate for #4697, I'm talking about creating development environment (git clone and composer install after) but not about upgrade procedure.

apiuser
New Member

Comment from vesan-83, posted on GitHub Aug 28, 2016

Please feel free to reopen if you need. How?

baldwin_pieter
Core Contributor

 Email me when someone replies