-
-
Notifications
You must be signed in to change notification settings - Fork 221
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
npm cli install without postinstall #1360
Comments
This issue has gone three weeks without activity. In another week, I will close it. But! If you comment or otherwise update it, I will reset the clock, and if you label it "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |
Given the size of the sentry-cli binary, in poor network conditions this can be a substantial issue on CI. Currently this breaks the Yarn caching & install model (https://yarnpkg.com/advanced/lifecycle-scripts#a-note-about-postinstall), leading to the cache being bypassed and the entire binary being downloaded on every run. Would definitely be good to not have postinstall used to download a large binary |
Plan of action:
|
postinstall
creates a whole host of issues which it would be nice to not have to deal with.I've seen a similar issues when distributing native node binaries and wonder whether some of the solutions I've seen in use there might be an improvement here.
Firstly, you publish an npm package per platform/arch combo (
@sentry/cli-{platform}-{arch}
) and include the cli binary in there.package.json
setmain
as the path to the binary and then it can be found later by simplyrequire.resolve('@sentry/cli-${process.platform}-${process.arch}')
package.json
correctly defineos
andcpu
properties which ensures that they will only install on the correct platform/archbin
in these packages if you want them to be directly accessible.Then in
@sentry/cli
you list all the above asoptionalDependencies
. After this, when installing@sentry/cli
, npm/yarn will attempt to install all the optional dependencies and only succeed on those where theos
andcpu
match.Bonus: If your JavaScript code used to find the binary uses complicated enough dynamic paths construction,
@vercel/nft
gives up and wont include them.This approach is already used by Parcel, Next.js and plenty of others.
Downsides?
optionalDependencies
but everyone appears to be on this train now so maybe it wont crash?os
andcpu
? 🤔The text was updated successfully, but these errors were encountered: