package JavaScript path bin test Command line interface
Need help with pkg-ok?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.
typicode

Description

👌 Checks paths and scripts defined in package.json before you publish

217 Stars 9 Forks MIT License 56 Commits 13 Opened issues

Services available

Need anything else?

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
    and
    browser
    exist
  • 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 

Options

pkg-ok
can be configured to check additional
package.json
fields or bin files
pkgOk --field someField --bin script.sh

API

const pkgDirectory = __dirname

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

License

MIT

Patreon - Supporters

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.