Skip to content

napi-rs prebuilds are not detected/downloaded using rebuild arch #1163

Description

@tmm1

napi-rs uses a custom scheme for prebuilds:

The other problem is how to deliver prebuild binary to users. Downloading it in postinstall script is a common way that most packages do it right now. The problem with this solution is it introduced many other packages to download binary that has not been used by runtime codes. The other problem is some users may not easily download the binary from GitHub/CDN if they are behind a private network (But in most cases, they have a private NPM mirror).

In this package, we choose a better way to solve this problem. We release different npm packages for different platforms. And add it to optionalDependencies before releasing the Major package to npm.

NPM will choose which native package should download from registry automatically. You can see npm dir for details. And you can also run yarn add @napi-rs/package-template to see how it works.


currently @electron/rebuild has support for prebuildify-based layouts:

export class Prebuildify extends NativeModule {
async usesTool(): Promise<boolean> {
const packageName = await this.findPackageInDependencies('prebuildify', 'devDependencies');

const prebuildsDir = path.join(this.modulePath, 'prebuilds');

could something similar be added for napi-rs?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions