Pass JSON-serialized arguments to commands
Hi again,
It would be nice if, when calling the hook, arguments passed by rollup to the hook were transfered as arguments to the spawned process. This would allow to use positional parameters ($1, $2, $3..., $0 being obviously the shell) into the command, to eventually transfer it to other scripts.
It could be easily done by using the 2nd optional parameter of child_process.spawn here:
https://github.com/audinue/rollup-plugin-execute/blob/81476377f3c5ee88a9daf2bacbd6f41da3d10959/index.js#L20-L24
Again, I'm OK to submit a PR.
:beers: Cheers !
Use case example please.
For example, I'm using a script to execute actions on new file (in my case, refresh a manifest.json file). Using such parameters could help me avoid scanning the FS for new bundles.
For now, I have to use a naming convention to differenciate fresh rollup output files and already post-processed files. Using the writeBundle params ({ [fileName: string]: AssetInfo | ChunkInfo }), I could simply have a list of fresh files by parsing the $1 argument from JSON.
My use case relies on #3 too, and both of them together could allow to use this plugin in a pretty straightforward way to dispatch actions using rollup's data/intermediate state infos to other scripts, opening great possibilities in build processes.
Hey there! What's up about this feature request ?