← 全部工具

can-npm-publish

热度 65 更新于 开发与构建

A command line tool that check to see if `npm publish` is possible.

npmauto-collected

安装

npm
npm install -g can-npm-publish

通过 npm 安装。

can-npm-publish [](https://github.com/azu/can-npm-publish/actions?query=workflow%3A"test")

A command line tool that check to see if npm publish is possible.

Check list

All check list is passed, exit status will be 0.

  • [x] Check that the package's name is valid
  • validate-npm-package-name
  • [x] Check that the package is not private:true
  • [x] Check that package@version is already published in npm registry

Install

Install with npm:

npm install can-npm-publish

Usage

Usage $ can-npm-publish [directory|package.json path]

Options --verbose show detail of errors

Examples $ can-npm-publish $ echo $? # 0 or 1

All check list is passed, exit status will be 0. If has any error, exit status will be 1.

If you want to know details of the error, you can use --verbose flag.

$ can-npm-publish --verbose almin@0.13.10 is already published $ echo $? 1

UseCase

Run can-npm-publish before npm publish:

can-npm-publish && npm publish