Writing a Shopware 6 plugin with a new CMS block

I have a beginner question regarding writing shopware 6 plugins with custom CMS blocks. Documentation specifies how to create custom CMS blocks and how to create a plugin. It also tells us this bit:

In order to test your changes now, you should rebuild your Administration. This can be done with the following command: ./bin/build-administration.sh

Following this my plugin and custom CMS block works, but this is a manually run command.

So my question is, do we have to call this rebuild in our plugin install method? Or is there some other way? Of course I’d prefer for my plugin users not to have to run any CLI commands :slight_smile:

This needs to be done only ones to bundle you javascript with web pack. And of course any time you change your javascript code within the plugin.

You can distribute your plugin and it will run on any installation without using the cli command.

Thank you for the answer.

So to clarify. One just needs to run the rebuild once (and again if JS files in the plugin change). Then the plugin can be activated/deactivated & installed/uninstalled through the web interface at will.

This raises a question. Does this make the plugin tied to specific shopware version? For example lets say I run this on 6.5.0.0 and I wanted to install on 6.5.2.1. Would it work - assuming there are no other breaking changes?

Being restricted to a version has nothing to do with that command. Maybe some PHP classes changes, or … If that happens, you plug-in might fail and crashes the complete shop. Thus you can add versions in your composer.json to tell the user, this plugin runs only in version ….

Thanks for the answer, but that’s not what I’m asking for. I know how to deal with changes of PHP classes my code extends or uses. My question is if there will be an additional dependency on the exact version that was used to run
./bin/build-administration.sh
Beyond the changes in code my plugin is actually using.

As for specifying exact version as a dependency its beside the point in this conversation.