When preparing a package release, you may want to preview the upcoming release locally. The NPM CLI has a handy command to create a tarball locally:
NPM Series Overview
- Create a Local Release Package Before Publishing to the Registry
Create a Local Release Package
npm pack command in a directory containing a
package.json file will create a
The NPM CLI follows the package configuration and loads the package into the local cache. It copies the resulting tarball to the current directory.
When Is This Helpful?
We recently configured the
files attribute in
package.json to publish a reduced set of files in the repository. A release tarball should be as small as possible. To reduce the file size of a release, we only include the required source file for the package and removed tests, images, and ESLint configurations.
Enjoy local packaging!