Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use tinyexec #11845

Merged
merged 3 commits into from
Aug 28, 2024
Merged

Use tinyexec #11845

merged 3 commits into from
Aug 28, 2024

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented Aug 27, 2024

Changes

This switches to use tinyexec instead of execa for the places where we execute scripts:

  1. astro add
  2. astro docs
  3. pnpm benchmark (our internal benchmark scripts)
  4. smoke tests

Our test-utils still use execa as I find it harder to migrate. We use some execa specific features to read the output. I don't think it's a big deal for now so left it as is. The rest are easier to migrate as we only execute things and not read its output much.

Testing

I tested the first 3 manually locally, which works (including if I try to ctrl-c the process, or cut off the internet connection and regain connection again). The smoke tests should be covered and passing in CI.

Docs

Added a changeset in case this breaks something

Copy link

changeset-bot bot commented Aug 27, 2024

🦋 Changeset detected

Latest commit: a85eedb

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Aug 27, 2024
Copy link
Member

@Fryuni Fryuni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the advantage of tinyexec over execa?

From the code changes I expect that it would fix problems in case astroBin is a path containing spaces, but is there some other reason for the change?

@bluwy
Copy link
Member Author

bluwy commented Aug 27, 2024

The main reason (which I forgot to mention) is that it's much lighter and does what we only need. With execa, it provides a lot of features by default but that also brings in a lot of dependencies, which most we don't really utilise.

So with this PR, we switch to a smaller library to only execute commands (which is a nicer wrapper API over child_process that's awkward to use in practice). That way users don't have to pay for installing more dependencies that aren't really used in practice. You can check execa's dependencies at https://npmgraph.js.org/?q=execa%408 (we're using v8, but v9 is much larger if we upgrade)

@bluwy bluwy merged commit 440a4be into main Aug 28, 2024
14 checks passed
@bluwy bluwy deleted the use-tinyexec branch August 28, 2024 14:52
@astrobot-houston astrobot-houston mentioned this pull request Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants