Skip to content

sheerun/npm-packer

Repository files navigation

npm-packer

A tool for producing zero-dependencies node modules.

Features:

  • Doesn't move around any files. It ensures backward-compatibility of packaged modules
  • Doesn't package optional dependencies, you can use them for native modules
  • Doesn't package devDependencies
  • Can use Yarn instead of npm for reliable builds
  • Can package dependencies directy from npm
  • Properly handles bin paths
  • Easy to use 🌹

Installation

$ npm install -g npm-packer

Usage

npm-packer <source> <target> [--yarn]
  • <source> can be either existing directory or npm package prefixed with npm:
  • <target> must be non-existing directory
  • if --yarn is used, packer uses yarn instead of npm for bundling
npm-packer . dist
npm-packer npm:jquery jquery-packed
npm-packer npm:jquery jquery-packed --yarn

How it works?

  1. Runs "npm pack" on module and copies result to
  2. Performs "npm install --production" on
  3. Copies installed modules to "/vendor/node_modules"
  4. Rewrites all require(...) calls
  5. Removes "dependencies" from package.json

The bundle in <target> should be ready for publication with npm publish

License

MIT © Adam Stankiewicz

About

🏆 Produces zero-dependencies node modules

Resources

License

Stars

Watchers

Forks

Packages

No packages published