Giter Club home page Giter Club logo

pkg-ok's Introduction

pkg-ok Build Status npm

Whether you're publishing a Node, React, Vue, or any kind of module on npm, pkg-ok will do some last minute checks before you publish

  • Ensures paths declared in main, bin, module, typings and es2015 exists
  • Ensures bin scripts use cross-platform line endings

Also pkg-ok being a devDependency, it won't add to your published module size.

Getting started

Install pkg-ok using npm

npm install pkg-ok --save-dev

or via yarn

yarn add pkg-ok --dev

Then simply add pkg-ok CLI at the end of your prepublishOnly script

// package.json
{
  "scripts": {
    "prepublishOnly": "... && pkg-ok"
  }
}

Give it a try

If you want to give a try to pkg-ok without publishing, you can change your main path

// package.json
{
  "main": "this/path/doesnt/exist.js",
}

And run prepublishOnly manually

npm run prepublishOnly
# pkg-ok will give you an error since main path doesn't exist

Options

You can also configure pkg-ok to check additional package.json fields or bin files

pkgOk --field someField --bin script.sh

Module

You can use pkg-ok as a module

const pkgOk = require('pkg-ok')
const opts = {
  fields: ['someField'],
  bin: ['script.sh']
}

// Assuming this file is at the same level as package.json
pkgOk(__dirname, opts)

License

MIT - Typicode ๐ŸŒต - Patreon

pkg-ok's People

Contributors

typicode avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.