The solution is to upgrade to CJE 1.7.0 or later. This version offers a feature to provide scripts handling the registration / unregistration via the attributes register_script / unregister_script.

For existing installation, the operation cje prepare registration-update can be used. Then you can provide the path to registration / unregistration scripts in the registration-update.config. For example: