👌 Checks paths and scripts defined in package.json before you publish
MIT License
pkg-ok
checks paths and scripts defined inpackage.json
before you publish 👌
main
, bin
, module
, types
, typings
, es2015
, browser
, and exports
existmain
, bin
, and browser
are relativebin
scripts use cross-platform line endingsnpm 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
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
const pkgDirectory = __dirname;
pkgOk(pkgDirectory, {
fields: ['someAdditonalField'],
bin: ['someAdditionalScript.sh'],
});
MIT