Skip to content

Validate your package.json exports actually exist, have valid syntax, and can be imported or required without issues.

License

Notifications You must be signed in to change notification settings

webdeveric/validate-package-exports

Repository files navigation

validate-package-exports

Node.js CI

Validate your package.json exports actually exist, have valid syntax, and can be imported or required without issues.

Install

pnpm add validate-package-exports -D
npm i validate-package-exports -D
yarn add validate-package-exports -D

Options

Flag Description Default value
--check / -s Check syntax of JS files false
--verify / -v Verify a module can be imported or required false
--concurrency / -c Concurrency availableParallelism()
--bail / -b Stop after the first error process.env.CI === 'true'
--no-bail Turn off --bail false
--info / -i Show info messages.
The default behavior is to only show error.
process.env.RUNNER_DEBUG === '1'
--no-info Turn off --info false
--json / -j Use JSON output false

Usage

validate-package-exports [FILE]... [options]

ℹ️ If you do not provide a path to a package.json, it will try to find one in the current directory.

Package scripts examples

{
  "scripts": {
    "build": "YOUR-BUILD-SCRIPT",
    "postbuild": "validate-package-exports --check --verify"
  }
}

OR

{
  "scripts": {
    "prepublishOnly": "validate-package-exports --check --verify"
  }
}

Using npx

npx --yes validate-package-exports ./path/to/package.json --check --verify

Local development

fnm use
corepack enable
pnpm install
pnpm build

About

Validate your package.json exports actually exist, have valid syntax, and can be imported or required without issues.

Resources

License

Security policy

Stars

Watchers

Forks

Sponsor this project