Protractor JS pre-processors

I am aware that there is the option within Karma to use pre-processors however, in Protractor I can't see the same sort of thing. I am currently using the onPrepare option but I am wondering if it is possible / currently if there is a way to have the a npm module to always run prior (basically the same as the onPrepare) but by the config and not having to do any require etc.

Try using something like scripts in your package.json:

"scripts": {
    "postinstall": "bower install",
    "pretest": "npm install",
    "test": "karma start test/karma.conf.js",
    "test-single-run": "karma start test/karma.conf.js  --single-run",
    "preupdate-webdriver": "npm install",
    "update-webdriver": "webdriver-manager update",
    "preprotractor": "npm run update-webdriver && node setUp.js",
    "protractor": "protractor test/protractor-conf.js",
    "postprotractor": "node tearDown.js",
}

By saying 'npm run protractor' in your cmd, both scripts in pre-(setUp.js) and postprotractor (tearDown.js) will be run before and after your e2e tests.