packito
v0.5.0
Published
clean your package before publishing it !
Downloads
1,873
Readme
📦 Packito
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:
$ packito
By default it will remove "scripts" and "devDependencies", copy README.md and LICENSE if they exist to './dist' folder.
Install
$ yarn add --dev packito
Or using npm
$ npm add --dev packito
Usage
$ 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:
{
"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'
$ packito -d ./publish
Publish to path 'publish' and use
np patch
to publish
$ 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
Requirements
- Node >= 10
Contribution
Read Contributing Guide for development setup instructions.