Problem
The azureauth package downloads its binary via a postinstall script. This doesn't work with:
- pnpm 10+ - blocks lifecycle scripts by default for security
- yarn PnP - not recommended due to unplugging behavior
- --ignore-scripts - when lifecycle scripts are disabled for security
- Network issues - downloads outside the package fetch stage miss retry mechanisms, caching, and mirrors
Proposed Solution
Use npm's optionalDependencies with os and cpu fields - the same pattern used by esbuild, SWC, and sharp.
- Create platform-specific packages (
@azureauth/darwin-arm64, etc.)
- List them as
optionalDependencies in the main package
- Package managers automatically install only the matching platform
- Postinstall becomes a fallback for unsupported platforms
References