prepare-package

1.0.3 • Public • Published




Site | NPM Module | GitHub Repo

Prepare Package is a helpful NPM module that prepares your package before distribution.

Install Prepare Package

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 to dist
  • 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!)

Package Sidebar

Install

npm i prepare-package

Weekly Downloads

17

Version

1.0.3

License

ISC

Unpacked Size

10.4 kB

Total Files

5

Last publish

Collaborators

  • itwcw2000