pkg-okchecks paths and scripts defined inpackage.jsonbefore you publish 👌
- Ensures paths defined in
main,bin,module,types,typings,es2015,browser, andexportsexist - Ensures paths defined in
main,bin, andbrowserare relative - Ensures
binscripts use cross-platform line endings
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 blockedCheck the package.json in the current directory.
pkg-okCheck the package.json in a specific directory.
pkg-ok some/directoryCheck additional package.json fields or bin files.
pkg-ok --field someField --bin script.shconstpkgDirectory=__dirname;pkgOk(pkgDirectory,{fields: ['someAdditonalField'],bin: ['someAdditionalScript.sh'],});MIT