# packito

> clean your package before publishing it !

Latest version **0.5.0** (published 2020-02-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install packito
pnpm add packito
yarn add packito
bun add packito
```

Provides the command `packito`.

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.0 |
| Published | 2020-02-10 |
| First published | 2019-12-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 3 |
| Unpacked size | 69.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 15 |
| Author | Mik |
| Maintainers | mikbry |

## Links

- npm: https://www.npmjs.com/package/packito
- Repository: https://github.com/mikbry/packito
- Issues: https://github.com/mikbry/packito/issues
- npm.io page: https://npm.io/package/packito

## Dependencies (3)

- [chalk](https://npm.io/package/chalk.md) ^3.0.0
- [minimist](https://npm.io/package/minimist.md) ^1.2.0
- [node-emoji](https://npm.io/package/node-emoji.md) ^1.10.0

## Recent versions

- 0.5.0 (latest) — 2020-02-10
- 0.1.0 (beta) — 2019-12-18
- 0.4.0 — 2020-01-09
- 0.3.0 — 2019-12-20
- 0.2.0 — 2019-12-19

## README

# 📦 Packito

[![Build Status][travis-image]][travis-url]
[![codecov][codecov-image]][codecov-url]
[![NPM version][npm-image]][npm-url]
[![License][license-image]][license-url]

[travis-image]: https://travis-ci.com/mikbry/packito.svg?branch=master
[travis-url]: https://travis-ci.com/mikbry/packito
[codecov-image]: https://codecov.io/gh/mikbry/packito/branch/master/graph/badge.svg?token=K4P0vnM5fh
[codecov-url]: https://codecov.io/gh/mikbry/packito
[npm-image]: https://img.shields.io/npm/v/packito.svg
[npm-url]: https://npmjs.org/package/packito
[license-image]: https://img.shields.io/npm/l/packito.svg
[License-url]:./LICENSE

> Packito is a cli tool to clean package before publishing it.


### Purpose
Before publishing to npm, did you take care of your package.json ?

* devDependencies, some scripts and other entries("husky", ...) could be removed.
* add some new or change entries, like "main" source file name
* use a dist file and copy some extra files/directories in it (README.md, LICENSE, ...).
* and finally publish your package using npm, np or lerna.

***Simple using one command:***
```bash
$ packito
```
By default it will remove "scripts" and "devDependencies", copy README.md and LICENSE if they exist to './dist' folder.

### Install
```bash
$ yarn add --dev packito
```

Or using npm
```bash
$ npm add --dev packito
```

### Usage
```bash
$ packito [options] [bin-to-publisher]
```

***Options***

| name | alias | description |
| ----------- | --- | ----------- |
| --dist     | -d | Path to publish from |
| --nopublish     | -n | Skips publishing step |
| --help     | -h | Displays help informations |

***Bin to publisher***

| name | description |
| -----------  | ----------- |
| npm     | Publish using npm |
| lerna     | Publish using npm |
| np     | Publish using np |


***.packito.json***

It is the configuration file.
This json should be at root of the project, a sample:
```json
{
  "remove": {
    "devDependencies": "*",
    "scripts": "*",
    "type": true,
    "esm": true,
    "husky": true,
    "commitlint": true
  },
  "replace": {
    "main": "index.js",
    "module": "index.mjs"
  },
  "publisher":  "np"
}
```

| name | type | description |
| ----------- | --- | ----------- |
| remove     | object | all keys to remove from packages.json (if =true or ='*' replace all) |
| replace     | object | all keys+values to replace in packages.json |
| copy     | object | all files to copy in dist |
| output     | string | folder to publish to |
| publisher     | string\|object | The publisher to use (npm, np, lerna) |

***Other command examples***
> Publish to path 'publish'
```bash
$ packito -d ./publish
```
> Publish to path 'publish' and use `np patch`to publish
```bash
$ packito -d ./publish np patch
```

### Coded using state of the art and simplicity in mind
- Simple to use
- Modern ES6+ syntax (import instead of require, await/async, ...)
- Follows [Node best practices](https://github.com/goldbergyoni/nodebestpractices)

### Requirements
- Node >= 10

## Contribution

Read [Contributing Guide](CONTRIBUTING.md) for development setup instructions.

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