Closed RIP21 closed 5 years ago
@RIP21 thank you for the kind words!
In response to your question: yes and no. I'll explain:
You can't configure Rescripts to take in custom commands via the CLI (such as a rescripts format
command). If you want this functionality, I encourage you to PR the codebase 💯 what you can do is create a Rescript called format
which triggers the necessary code:
rescript-format.js
module.exports = config => {
format() // trigger the formatting
return config
}
... and then use that Rescript in your config:
module.exports = [
require.resolve('./path/to/rescript-format.js')
]
You can also tell the Rescript to spawn a new child process if your formatter is an executable.
My favorite solution though would be to move the formatting code into a scripts
folder, give it executable permissions, and trigger it directly from your package.json
. It's a more common pattern––plus––it makes it clear that it's not a built-in property of react-scripts
or rescripts
, and other developers working on your project can more easily locate the relevant code.
Please let me know if you have any more questions :)
Hehe. Quite obvious solution, my point was to make it as an executable so you can call like rescript format
but if it's impossible I'll consider a PR cause it would be neat thing :)
Calling stuff from scripts making it non reusable... Anyway I can create my own cli tool and make it to npm if so needed, anyway. I try to keep dependencies list as small as possible :)
Thanks for a quick response.
I read through the Readme and project looks awesome indeed. I'm a maintainer of our own fork of
react-scripts
at Revolut and I'm really tired of keeping it in sync with upstream CRA. This one gives ability to basically reduce it all to one big Revolut rescript except one thing, there is no possibility to add custom script. We have a script namedformat
that runsprettier
in a predefined manner. So basicallyrevolut-react-scripts format
is possible likestart, test, build
etc., but with this one I think it's impossible to do so. Or maybe I'm wrong? :)If it's impossible that would be amazing to be able to do something like that.