Package Exports
- napi-postinstall
- napi-postinstall/package.json
Readme
napi-postinstall
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:
- npm/cli#4828 -- root cause
- napi-rs/napi-rs#2569
- unrs/unrs-resolver#56
TOC
Usage
Install
# pnpm
pnpm add napi-postinstall
# yarn
yarn add napi-postinstall
# npm
npm i napi-postinstall
# bun
bun add napi-postinstallCLI
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 } from 'napi-postinstall'
checkAndPreparePackage('unrs-resolver' /* <napi-package-name> */)Sponsors and Backers
Sponsors
| 1stG | RxTS | UnTS |
|---|---|---|
Backers
| 1stG | RxTS | UnTS |
|---|---|---|
Changelog
Detailed changes for each release are documented in CHANGELOG.md.