Site | NPM Module | GitHub Repo
Prepare Package is a helpful NPM module that prepares your package before distribution.
Install with npm if you plan to use Prepare Package in a Node.js project.
npm install prepare-package --save-dev
- Copy files from
src
todist
- Replace tags in your main file,
index.js
{version}
=>package.version
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.
# Run once
npm run prepare
# Run and watch for changes
npm run prepare:watch
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!)