What folders/files are now considered core for Magento 2? As in "Don't edit these files since they can be overwritten in an update" I need to scan a site for core overrides and I'm looking for the folders to compare against fresh install.
2 Answers
Assume "core" by default
When you initially download Magento through composer, it creates all of those folders and files. This means that all of those can be updated by Magento.
The only safe files to modify are:
composer.json
andcomposer.lock
- anything in the
app
folder - as well as any files you've manually created in the root folder (such as
nginx.conf
or.gitignore
)
(These also happen to be the same files you should commit, except for app/etc/env.php
)
Trying to compare to a fresh install likely won't work: Consider the vendor
folder. It has stuff from Magento itself, but if you ever add a module from a 3rd party, it also goes in the vendor
folder. (In fact, I recommend adding your custom site changes this way as well).
However, your problem (I believe) is solved if you only let people commit certain files (as I've listed above). This way, you know that they aren't overriding core files. See GIT and deployment strategies (I recommend Vladimir's answer)
-
I thought about using a git based strategy for this too. It’s not for a project, it’s for an script I’m building to see if a site’s core is edited. I agree it’s not very precise to just pick some dirs and leave the rest out. Commented Mar 14, 2018 at 19:37
-
1If you are determined to do a script this way, there's no easy rule to apply, because its hard to tell which changes actually change the functionality. Regardless, I recommend that you ignore any extra files (except for files in any
etc
folder), and ignore modifications to the files listed above. Commented Mar 14, 2018 at 20:09
Usualy /vendor/
files and /lib/
files. you can make extends / override the files if you use the needed path for the file you want to change, ex:
if you want to edit menu.js
file from /lib/web/mage
you would have to do an extend of it and declare it in requirejs-config.js
of your theme or ( NOT RECOMANDED ) copy the file in Your_Theme/web/mage/
and it will override it.