Preview package archive contents

Read-only
What do risk levels mean?
Read-only
Inspects state without changing anything.
Low risk
Reversible with a routine follow-up command.
Medium risk
Changes state; undo path documented.
Destructive
Deletes or overwrites; confirmation required.

Shows which files npm would include in a published package archive without creating a tarball, publishing anything, or running package lifecycle scripts.

nodenpmpackage-preview

Commands

Preview the files and metadata that npm would place in the package archive

npm pack --dry-run --ignore-scripts

Verification

npm pack --dry-run --ignore-scripts

npm lists package files, archive metadata, and size without creating a .tgz file.

Undo

Not undoable

Dry-run mode with lifecycle scripts disabled only reads package contents and changes nothing.

Pitfalls

  • Removing --ignore-scripts can run prepack, prepare, and postpack commands even in dry-run mode.
  • Review files for credentials, local configuration, source maps, and other unintended content before publishing.
  • The files field and .npmignore rules can make the archive differ from the Git working tree.

Related