graphile / starter

Opinionated SaaS quick-start with pre-built user account and organization system for full-stack application development in React, Node.js, GraphQL and PostgreSQL. Powered by PostGraphile, TypeScript, Apollo Client, Graphile Worker, Graphile Migrate, GraphQL Code Generator, Ant Design and Next.js
https://graphile-starter.herokuapp.com
Other
1.74k stars 219 forks source link

feature: use zx to improve scripting dev experience #271

Open zacaytion opened 3 years ago

zacaytion commented 3 years ago

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

benjie commented 3 years ago

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.