Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/abraham/pkg-ok
👌 Checks paths and scripts defined in package.json before you publish
https://github.com/abraham/pkg-ok
bin cli crlf hacktoberfest lf line-endings main package path publish test
Last synced: 5 days ago
JSON representation
👌 Checks paths and scripts defined in package.json before you publish
- Host: GitHub
- URL: https://github.com/abraham/pkg-ok
- Owner: abraham
- License: mit
- Created: 2017-02-20T19:25:41.000Z (almost 8 years ago)
- Default Branch: main
- Last Pushed: 2025-01-01T17:05:04.000Z (29 days ago)
- Last Synced: 2025-01-18T09:05:57.885Z (12 days ago)
- Topics: bin, cli, crlf, hacktoberfest, lf, line-endings, main, package, path, publish, test
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/pkg-ok
- Size: 267 KB
- Stars: 237
- Watchers: 1
- Forks: 12
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# pkg-ok [![Build status](https://github.com/abraham/pkg-ok/actions/workflows/index.yaml/badge.svg)](https://github.com/abraham/pkg-ok/actions/workflows/index.yaml) [![npm](https://img.shields.io/npm/v/pkg-ok.svg)](https://www.npmjs.com/package/pkg-ok)
> `pkg-ok` checks paths and scripts defined in `package.json` before you publish 👌
- Ensures paths defined in `main`, `bin`, `module`, `types`, `typings`, `es2015`, `browser`, and `exports` exist
- Ensures paths defined in `main`, `bin`, and `browser` are relative
- Ensures `bin` scripts use cross-platform line endings## Usage
```sh
npm install pkg-ok --save-dev
``````js
// package.json
{
"main": "oops_this_file_doesnt_exist.js",
"scripts": {
"prepublishOnly": "... && pkg-ok"
}
}
``````sh
npm publish
# Error!
# Since main file doesn't exist, publish is blocked
```## CLI
Check the `package.json` in the current directory.
```sh
pkg-ok
```Check the `package.json` in a specific directory.
```sh
pkg-ok some/directory
```Check additional `package.json` fields or bin files.
```sh
pkg-ok --field someField --bin script.sh
```## API
```js
const pkgDirectory = __dirname;pkgOk(pkgDirectory, {
fields: ['someAdditonalField'],
bin: ['someAdditionalScript.sh'],
});
```## License
MIT