I've created a custom module for developer mode only. So, I want to create functionality that disables module automatically when mode change from developer to production.
This is where composer comes in handly:
Add the module to the require-dev part of your composer.json.
In your production system you get all packes WITHOUT dev:
composer install --no-dev
In your local enviroment you just
composer install to get all packes which are located in the require-dev part.
Fore more information read here: composer require dev version