Library for normalizing package.json files using a schema-based approach. Version 0.5.0 (last released 2019) is stable but in maintenance mode. It standardizes fields like repository, author, license, and bin, and can infer missing values from the filesystem. Unlike simple validation tools, it transforms and completes package.json objects according to configurable schema rules. Suitable for CLI tools, scaffolding, or build processes that need consistent package metadata.
npm install normalize-pkgNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates importing normalize-pkg, creating an instance, and normalizing a package.json object. Note: uses import assertions for JSON modules.
Pass options to the constructor: new NormalizePkg({ knownOnly: true })Use structuredClone or Object.assign: normalizer.normalize({...pkg})Use npm only: npm install --save normalize-pkg
Ensure process.cwd() contains the expected files or use options to disable filesystem checks.
Use import NormalizePkg from 'normalize-pkg' (default import)
Use new NormalizePkg() and then call .normalize()
Install peer dependencies: npm install map-schema