NixH
NixH

Reputation: 539

Shopware 6 delete specific files from vendor

When I run build-administration I get the following error during the step "Calling reporter service for single check."

ERROR in unable to locate '/var/www/vendor/store.shopware.com/netinexteasycoupondesigns/src/Resources/app/administration/static/**/*' glob

The vendor of the plugin recommended to delete the path src/Resources/app inside the plugins source files. Since they're installed via composer I'm not able to delete these files persistently e.g. on production or other environments.

How can I persist these changes? With a composer patch, or is there any other way?

Upvotes: 4

Views: 1032

Answers (3)

Tobias Pierschel
Tobias Pierschel

Reputation: 81

w´re aware of the problem, but there is no satisfying solution because shopware forces us to ship the uncompiled source files in our plugins

In most cases the deployment doesnt work because you use an outdated version of NodeJs and NPM.

So please make sure you have the lastest NPM LTS Version installed - NodeJS 12 is outdated - use the latest like NodeJS 16 and NPM 8.x

If it's not possible to update NodeJs and NPM there are two options:

Option 1

  • deactivate our plugin: bin/console plugin:deactivate NetiNextEasyCouponDesigns
  • build administration: bin/build-administration.sh
  • activate our plugin: bin/console plugin:activate NetiNextEasyCouponDesigns

Option 2

  • remove directory: NetiNextEasyCouponDesigns/src/Resources/app/administration
  • build administration: bin/build-administration.sh

Upvotes: 2

Alex
Alex

Reputation: 35008

WARNING: This does not work as intended

This answer is probably invalid, we are investigating, but using this method, some important parts seem to be missing from the build.

I let this answer stand as a warning an hope, someone will provide a better answer


Original answer:

We assume you have certain 3rd party plugins which don't need to be built, as well as some own project specific plugins which need building.

If we take a look build-administration.sh, it normally executed bundle:dump which would write the var/plugin.json which determined which packages to build in the build process. The file is usually not committed to the git repository.

Do not build 3rd party dependencies

The following approach would work to avoid building 3rd party dependencies.

  • Add var/plugins.json to the git
  • Remove all non-custom modules from plugins.json
  • Call SHOPWARE_SKIP_BUNDLE_DUMP=1 bin/build-administration.sh to avoid rebuilding the plugins.json

You have to remember to add new custom plugins manually to the file. Probably the easiest way is to call bundle:dump again then remove the 3rd party modules.

Another option might be to generate the plugins.json before the build using bundle:dump and then filter the file using jq. But I did not test this.

Depending on the number of plugins, this will also speed up the build process.

Upvotes: 5

dneustadt
dneustadt

Reputation: 13161

That plugin has additional NPM dependencies that it relies on in the build process. I tried running npm clean-install in custom/plugins/NetiNextEasyCouponDesigns/src/Resources/app/administration/ but it still wouldn't compile afterwards. I assume you don't have to actually recompile this plugins assets. Unless the developer of the plugin fixes the issue, building the administration will fail in one way or another.

If you have a pipeline that runs composer und builds the administration, I would recommend to simply require this plugin after the administration has been built. Since plugins come with pre-built assets, there most often is no reason to rebuild them.

Another simple way to exclude this plugin from building is to deactivate it before starting the build...

bin/console plugin:deactivate NetiNextEasyCouponDesigns

...and then afterwards activate it again:

bin/console plugin:activate NetiNextEasyCouponDesigns

Upvotes: 3

Related Questions