-
Notifications
You must be signed in to change notification settings - Fork 7
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
Include all builds as normal dependencies #449
Conversation
Instead of using optional dependencies, make the `@NomicFoundation/edr` package have all the NAPI-RS builds as dependencies. This is a way to prevent npm/cli#4828 from affecting users.
🦋 Changeset detectedLatest commit: 306594d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
@@ -17,11 +17,15 @@ | |||
"napi": { | |||
"name": "edr", | |||
"triples": { | |||
"defaults": false, |
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.
This change isn't strictly necessary for this PR, but while working on this I noticed that slang does it and I think it makes sense. This way we don't rely on napi-rs's defaults that might change without us noticing it.
Also: I tested this in the |
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.
Thanks, LGTM! I tested out @nomicfoundation/[email protected]
on MacOS ARM with a fresh install and it worked well 🎉
Hardhat users are frequently running into npm/cli#4828. As a blunt workaround, we are going to turn all the builds into dependencies of the entry-point package
@nomicfoundation/edr
, instead of being optional dependencies. For this to work, two things have to happen:package.json
of EDR has to use them as plaindependencies
instead ofoptionalDependencies
package.json
s of the builds don't have to include things likeos
andarch
, because the package manager might check them and complain if they don't match.Since the
optionalDependencies
field of the entry-point package.json are added/modified by the NAPI-RS CLI, the only way to deal with 1 is to modify thepackage.json
after runningnapi prepublish
. This is done withjq
andsponge
(sponge is needed because you can't dojq '...' package.json > package.json
andjq
doesn't have a "modify in place" flag like sed's-i
).sponge
doesn't come pre-installed, so we need to installmoreutils
in the publish job.For 2, it's enough to just modify the
package.json
s we already have undercrates/edr_napi/npm
. Thearch
,os
andlibc
fields are not re-added bynapi
.