node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

npm-packer

npm-packer

Produces zero-dependencies node modules

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