-
-
Notifications
You must be signed in to change notification settings - Fork 481
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
chore(npm): use bin.sh
for execute
#3550
Conversation
This should solve few issues related to bun and it has a `bunx`/`npx` support compared to biomejs#2359 This approach does not work on `pnpm` and does not reduce startup time. For `npx` it is faster but not much, for `bunx` it is marginally faster
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels like a risky change to me. My first questions would be, how does this affect Windows support and has it been tested with Yarn PnP?
|
# Test if calling via `npx` or `bunx` | ||
if "$(echo pwd)" | grep -q ".bun/install/cache"; then | ||
IS_X_CALL=true | ||
CACHE_DIR=$(bun pm cache ls) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CACHE_DIR=$(bun pm cache ls) | |
CACHE_DIR="$(bun pm cache ls)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than formatting, it does not change nothing at code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it does if $(bun pm cache ls)
returns a string that includes spaces. Basically all $()
should be enclosed by double quotes.
ESbuild uses only a postinstal script. I wonder if we could use it as an inspiration. |
@Conaclos Yes, that way could reduce startup time |
Not, not tested yet with Windows and Yarn PnP |
Not yet
Not yet
I mean #2359 which did not worked |
It is not @biomejs bug. It is just reference to issue which (previously) i'm made PR for reduce startup time attempt bug that not worked with |
Closing for now, as this wasn't tested on other OS and with other package managers. Also, the bash code is more convoluted than the Node.js code, and I risk it could introduce more friction in terms of contributions. Feel free to open a discussion to discuss this alternative, if you want, and why we should accept this change. |
Summary
Reduce execution startup time
This should solve few issues related to bun and it has a bunx/npx support compared to #2359
This script, bin.sh executes only as later it will be replaced to actual binary file
This approach does not work on pnpm and does not reduce startup time. For npx it is faster but not much, for bunx it is marginally faster
Test Plan
Faster startup time, saving CPU-time and power for small and medium projects
Benchmark
bunx dalisoft/biome-rs-npm#v1.8.3
bunx @biomejs/biome