starter
starter copied to clipboard
feature: use zx to improve scripting dev experience
Description
Adds the zx package to improve the experience of shell scripting with node. zx provides useful wrappers around child_process, escapes arguments and gives sensible defaults.
ZX uses ES modules and prefers to use .mjs extension. If this is undesirable, the PR can be updated to use .js and wrap the scripts in void async function () {}(). The scripts could also be written in typescript as ZX can compile and execute .ts files
Performance impact
None, except when scripts are written in typescript. .ts files are passed to ts-node which is slower than calling node directly.
Security impact
N/A || unknown
Checklist
- [x] My code matches the project's code style and
yarn lint:fixpasses. - [ ] I've added tests for the new feature, and
yarn testpasses. - [ ] I have detailed the new feature in the relevant documentation.
- [ ] I have added this feature to 'Pending' in the
RELEASE_NOTES.mdfile (if one exists). - [ ] If this is a breaking change I've explained why.
Thanks for raising a pull request. Alas, I'm concerned that moving to shell commands, e.g. using rm -rf instead of rimraf, will decrease our Windows compatibility. I also see negligible benefit in adding this extra dependency and all its dependencies when it seems most of its functionality is already provided by node natively just with slightly different syntax. I'm going to leave the PR open because I think other people may find it useful (particularly people who only need to support unix... though if this were me I'd personally just use bash scripts directly) but I think it's unlikely I'll merge it.