prepare-package
v1.1.13
Published
Prepare a Node.js package before being published
Downloads
83
Maintainers
Readme
📦 Install Prepare Package
Option 1: Install via npm
Install with npm if you plan to use Prepare Package in a Node.js project.
npm install prepare-package --save-dev
🦄 Features
- Copy files from
src
todist
- Replace tags in your main file,
index.js
{version}
=>package.version
📘 Example Setup
After installing via npm, simply put this in your package.json
...
"main": "dist/index.js",
"scripts": {
"prepare": "node -e 'require(`prepare-package`)()'",
"prepare:watch": "nodemon -w ./src -e '*' --exec 'npm run prepare'"
},
"preparePackage": {
"input": "src",
"output": "dist",
"replace": {}
},
...
preparePackage
is not required but you can provide it to customize the process.preparePackage.input
: The dir to copy from.preparePackage.out
: The dir to copy to.main
: The file to copy and use as your main file. Tags like{version}
are replaced in this file.
⚡️ Usage
Run Prepare Package
# Run once
npm run prepare
# Run and watch for changes
npm run prepare:watch
🗨️ Final Words
If you are still having difficulty, we would love for you to post a question to the Prepare Package issues page. It is much easier to answer questions that include your code and relevant files! So if you can provide them, we'd be extremely grateful (and more likely to help you find the answer!)