Prepare library for NPM distribution
npm install npm-prepare-dist




> Clean and prepare dist folder and all files before publishing your NPM library
>
> - Potentially smaller build and faster installation of your library
> - TypeScript, JavaScript, CLI version
> - Useful options
via yarn
``bash`
yarn add npm-prepare-dist --dev
via npm
`bash`
npm install npm-prepare-dist --save-dev
`bash`
npm-prepare-dist
- Main package.json file will be copied into your dist folderREADME.md
- devDependencies will be removed
- More _useless_ options will be removed
- (and other files) will be copied into _dist_ folder as you wish
`javascript
import { prepareDist } from 'npm-prepare-dist';
prepareDist('build', ['README.md', 'LICENSE', 'icon.svg'], './src/');
`
Highly recommended to use as postbuild hook in you package.json
`json`
{
"name": "my-project",
"scripts": {
"build": "tsc",
"postbuild": "npm-prepare-dist"
}
}
| Option | Description | default | example |
| ------------------- | ------------------------------------------------- | ----------- | ------------------------- |
| -h, --help | Display this usage info | - | - |
| -v, --version | Show version | - | - |
| -d, --dist | Dist folder path | dist | -d build |README.md
| -f, --files | Array of files to copy into dist folder as well | | -f README.md -f LICENSE |./
| -m, --main | Main folder where. Usually where is your index.js | | -m ./src/ |-s postinstall -s test
| -s, --remove-script | Remove script in package.json | - | |--remove-deps
| --remove-deps | Remove all dependencies from package.json | - | |
I welcome you to customize this according to your needs ;)
Pull requests for any improvements would be great!
`bash`
git clone git@github.com:bartholomej/npm-prepare-dist.git
cd npm-prepare-dist
yarn
yarn start
#### Run demo locally
You can find and modify it in ./demo.ts file
`bash``
yarn demo
If this project have helped you save time please consider making a donation for some 🍺 or 🍵 ;)
I DO NOT STORE ANY DATA. PERIOD.
I physically can't. I have nowhere to store it. I don't even have a server database to store it. So even if Justin Bieber asked nicely to see your data, I wouldn't have anything to show him.
That's why, with this library, what happens on your device stays on your device till disappear.
Copyright © 2021 Lukas Bartak
Proudly powered by nature 🗻, wind 💨, tea 🍵 and beer 🍺 ;)
All contents are licensed under the [MIT license].
[mit license]: LICENSE