Detalhes do pacote

napi-postinstall

un-ts10.6mMIT0.2.4

The postinstall script helper for handling native bindings in legacy npm versions

readme (leia-me)

napi-postinstall

GitHub Actions Workflow Status Codecov type-coverage CodeRabbit Pull Request Reviews npm GitHub Release

Conventional Commits Renovate enabled JavaScript Style Guide Code Style: Prettier changesets

The postinstall script helper for handling native bindings in legacy npm versions, this is a reimplementation of the node-install functionality from esbuild for napi-rs ecosystem packages like rollup, @swc/core and unrs-resolver.

For more details, please refer to the following issues:

TOC

Usage

Install

# pnpm
pnpm add napi-postinstall

# yarn
yarn add napi-postinstall

# npm
npm i napi-postinstall

# bun
bun add napi-postinstall

CLI

napi-postinstall unrs-resolver #<napi-package-name>

You can put it into scripts#postinstall of your package.json:

{
  "scripts": {
    "postinstall": "napi-postinstall unrs-resolver"
  }
}

This will check and prepare the napi binding packages for you automatically.

API

Types

export interface PackageJson {
  name: string
  version: string
}

export declare function checkAndPreparePackage(
  packageNameOrPackageJson: PackageJson | string,
  checkVersion?: boolean,
): Promise<void>

Example

import { checkAndPreparePackage, isNpm } from 'napi-postinstall'

if (isNpm()) {
  checkAndPreparePackage('unrs-resolver' /* <napi-package-name> */)
}

Sponsors and Backers

Sponsors

Sponsors

1stG RxTS UnTS
1stG Open Collective sponsors RxTS Open Collective sponsors UnTS Open Collective sponsors

Backers

1stG RxTS UnTS
1stG Open Collective backers RxTS Open Collective backers UnTS Open Collective backers

Changelog

Detailed changes for each release are documented in CHANGELOG.md.

License

MIT © JounQin@1stG.me

changelog (log de mudanças)

Change Log

0.2.4

Patch Changes

0.2.3

Patch Changes

  • #27 f52b3e9 Thanks @JounQin! - fix: newPath dir could be unavailable, make sure it's already there

0.2.2

Patch Changes

0.2.1

Patch Changes

0.2.0

Minor Changes

0.1.6

Patch Changes

  • #18 8a887ee Thanks @JounQin! - fix: support install wasm32-wasi correctly with --cpu=wasm32

0.1.5

Patch Changes

0.1.4

Patch Changes

0.1.3

Patch Changes

0.1.2

Patch Changes

0.1.1

Patch Changes

  • #6 c56e93a Thanks @JounQin! - fix: allow optional optionalDependencies for development

0.1.0

Minor Changes