What is the best practice for adding tasks to build process?

In ionic2 beta I’ve done this using gulp , so I added unit-testing , karma , coverage , add tasks (and complicated ones ) using different gulp packages . now I see ionic2 rc0 using rollup , I don’t understand how can I add a unit-testing or any other task , let’s say I want to add task to replace configuration based on environment @ build process .

I hope that Ionic team will not change the builder core so hard in the future or at least make a global configuration file. For example I don’t want to have app and theme folder in my project src and now I must correct node_modules files for this.

As for the question:
I think, that best practice is to use hooks (all info you can find in your_project/hooks/README.md). But this feature seem’s not work in rc1. So here is the solution (I don’t like it, but this is only choice for now):

Modify your package.json build and watch fields by adding execute command to js file

"scripts": {
    "build": "node hooks/your_task_name.js; ionic-app-scripts build",
    "watch": "node hooks/your_task_name.js; ionic-app-scripts watch"

And in hooks/your_task_name.js (you can move script in any folder you like) you can write your task logic (without module exports, just logic).

If you need unit test - you can use this project. It is quite good and updated together with the Ionic

I’ve tried multiple ways and short of overwriting the build scripts to add small changes (as there is no way to insert custom scripts between the ionic scripts ) or using the cordova hooks (which all run after the scripts have completed this still seems to be the best way to do it.