antfu-collective / taze

🥦 A modern cli tool that keeps your deps fresh
MIT License
2.83k stars 86 forks source link

refactor: replace `execa` w/ `ezspawn` #115

Closed SukkaW closed 6 months ago

SukkaW commented 6 months ago

I first encountered the package @jsdevtools/ez-spawn through bumpp, which uses exspawn under the hood.

Though no longer being actively maintained, ezspawn already fulfills almost every use case and doesn't suffer from breaking bugs.

@jsdevtools/ez-spawn has fewer dependencies than execa and takes up only 47% of the disk space (the installation size of @jsdevtools/ez-spawn is 142 KiB compared to execa at 301 KiB). Moreover, its usage is extremely straightforward. Unlike execa, which has separated execa and execCommand, ezspawn's single method can perform both functions.

zanminkian commented 6 months ago

This cli tool do not need third-party package to execute command. Just use childProcess.execSync is enough.

import childProcess from "node:child_process";
const config= JSON.parse(
  childProcess.execSync(`echo '{"hello":"world"}'`).toString("utf8"),
);
console.log(config); // {hello: 'world'}