# can-npm-publish

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

Latest version **1.3.6** (published 2021-09-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install can-npm-publish
pnpm add can-npm-publish
yarn add can-npm-publish
bun add can-npm-publish
```

Provides the command `can-npm-publish`.

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.3.6 |
| Published | 2021-09-02 |
| First published | 2018-01-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 13.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 73 |
| Author | azu |
| Maintainers | azu |
| Keywords | cli, npm, publish |

## Links

- npm: https://www.npmjs.com/package/can-npm-publish
- Repository: https://github.com/azu/can-npm-publish
- Issues: https://github.com/azu/can-npm-publish/issues
- npm.io page: https://npm.io/package/can-npm-publish

## Dependencies (5)

- [meow](https://npm.io/package/meow.md) ^9.0.0
- [read-pkg](https://npm.io/package/read-pkg.md) ^5.0.0
- [cross-spawn](https://npm.io/package/cross-spawn.md) ^7.0.3
- [extract-first-json](https://npm.io/package/extract-first-json.md) ^1.0.1
- [validate-npm-package-name](https://npm.io/package/validate-npm-package-name.md) ^3.0.0

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 1.3.6 (latest) — 2021-09-02
- 1.3.5 — 2021-06-24
- 1.3.4 — 2021-06-11
- 1.3.3 — 2020-12-07
- 1.3.2 — 2019-10-03
- 1.3.1 — 2018-07-09
- 1.3.0 — 2018-07-09
- 1.2.1 — 2018-07-09
- 1.2.0 — 2018-06-20
- 1.1.1 — 2018-06-20
- 1.1.0 — 2018-04-12
- 1.0.2 — 2018-01-26
- 1.0.1 — 2018-01-24

## README

# can-npm-publish [![Actions Status: test](https://github.com/azu/can-npm-publish/workflows/test/badge.svg)](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](https://github.com/npm/validate-npm-package-name "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](https://www.npmjs.com/):

    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

You can use it for publishing without choice.

For example, it is useful for using with [lerna](https://github.com/lerna/lerna "lerna").

Publish all packages if it is possible.

    lerna exec --bail=false -- "can-npm-publish && npm publish"

In this use-case, you should use [@monorepo-utils/publish](https://github.com/azu/monorepo-utils/blob/master/packages/@monorepo-utils/publish) instead of `can-npm-publish`.
Because, [@monorepo-utils/publish](https://github.com/azu/monorepo-utils/blob/master/packages/@monorepo-utils/publish) wrapped `can-npm-publish`.

## Changelog

See [Releases page](https://github.com/azu/can-npm-publish/releases).

## Running tests

Install devDependencies and Run `npm test`:

    npm i -d && npm test

## Contributing

Pull requests and stars are always welcome.

For bugs and feature requests, [please create an issue](https://github.com/azu/can-npm-publish/issues).

1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D

## Author

- [github/azu](https://github.com/azu)
- [twitter/azu_re](https://twitter.com/azu_re)

## License

MIT © azu

---
_Source: https://npm.io/package/can-npm-publish · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
