Skip to content
/ pkg-ok Public

πŸ‘Œ Checks paths and scripts defined in package.json before you publish

License

Notifications You must be signed in to change notification settings

abraham/pkg-ok

Folders and files

NameName
Last commit message
Last commit date
Sep 21, 2024
Feb 19, 2022
Sep 22, 2024
Mar 12, 2022
Mar 11, 2022
Mar 11, 2022
Mar 11, 2022
Mar 11, 2022
Feb 19, 2022
Sep 21, 2024
Feb 20, 2017
Mar 21, 2022
Feb 20, 2022
Mar 1, 2025
Mar 11, 2022

Repository files navigation

pkg-ok Build status npm

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

npm install pkg-ok --save-dev
// package.json
{
  "main": "oops_this_file_doesnt_exist.js",
  "scripts": {
    "prepublishOnly": "... && pkg-ok"
  }
}
npm publish
# Error!
# Since main file doesn't exist, publish is blocked

CLI

Check the package.json in the current directory.

pkg-ok

Check the package.json in a specific directory.

pkg-ok some/directory

Check additional package.json fields or bin files.

pkg-ok --field someField --bin script.sh

API

const pkgDirectory = __dirname;

pkgOk(pkgDirectory, {
  fields: ['someAdditonalField'],
  bin: ['someAdditionalScript.sh'],
});

License

MIT