https://github.com/webdeveric/validate-package-exports
Validate your package.json exports actually exist, have valid syntax, and can be imported or required without issues.
https://github.com/webdeveric/validate-package-exports
Last synced: 8 days ago
JSON representation
Validate your package.json exports actually exist, have valid syntax, and can be imported or required without issues.
- Host: GitHub
- URL: https://github.com/webdeveric/validate-package-exports
- Owner: webdeveric
- License: mit
- Created: 2023-11-26T03:28:29.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-09-26T21:53:08.000Z (8 months ago)
- Last Synced: 2024-10-29T20:56:31.800Z (6 months ago)
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/validate-package-exports
- Size: 952 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
# validate-package-exports
[](https://github.com/webdeveric/validate-package-exports/actions/workflows/node.js.yml)
Validate your `package.json` exports actually exist, have valid syntax, and can be imported or required without issues.
## Install
```shell
pnpm add validate-package-exports -D
``````shell
npm i validate-package-exports -D
``````shell
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
```sh
validate-package-exports [FILE]... [options]
```:information_source: If you do not provide a path to a `package.json`, it will try to find one in the current directory.
### Package scripts examples
```json
{
"scripts": {
"build": "YOUR-BUILD-SCRIPT",
"postbuild": "validate-package-exports --check --verify"
}
}
```OR
```json
{
"scripts": {
"prepublishOnly": "validate-package-exports --check --verify"
}
}
```### Using `npx`
```shell
npx --yes validate-package-exports ./path/to/package.json --check --verify
```## Local development
```
fnm use
corepack enable
pnpm install
pnpm build
```