NPM-SHRINKWRAP.JSON(5)
π npm-shrinkwrap.json(5)
okay bestie, welcome to the manual page for npm-shrinkwrap.json β yes that's the "5" one, the file-format girly, not a command. she's a whole vibe and she's here to be explained. π
β¨ NAME β¨
npm-shrinkwrap.json β a publishable lockfile π
πΈ DESCRIPTION πΈ
so npm-shrinkwrap.json is a file that gets created by npm help shrinkwrap. that's her origin story. β¨
she is identical to package-lock.json, with one major caveat, and the caveat is literally the whole personality:
unlikepackage-lock.json,npm-shrinkwrap.jsonmay be included when publishing a package. ππ
like, that's it. that's the difference. one file gets shipped to the registry, the other one stays home. iykyk.
π¦ the recommended use-case (aka when to actually use her)
the recommended use-case for npm-shrinkwrap.json is applications deployed through the publishing process on the registry β for example:
- daemons π§
- command-line tools intended as global installs
devDependencies
basically: things you ship and want to lock down hard. no cap.
π the warning, and it's a real one
it's strongly discouraged for library authors to publish this file. like, please don't. π
why? because publishing it would prevent end users from having control over transitive dependency updates. so if you're a library author and you ship this, you're basically picking your users' dependencies for them and that's not the main character energy you want. be respectful of their autonomy, periodt. π
β the tiebreaker rule
additionally, if both package-lock.json and npm-shrinkwrap.json are present in a package root, then package-lock.json will be ignored in favor of this file. π«Ά
so npm-shrinkwrap.json wins. she ate. π
π₯ where to read the full lore
for full details and description of the npm-shrinkwrap.json file format, refer to the manual page for:
npm help 5 package-lock.json
yes queen, go read her sister's page. the format deets live there. π
π SEE ALSO π
npm help shrinkwrapnpm help 5 package-lock.jsonnpm help 5 package.jsonnpm help install
that's the whole page bestie, go forth and lock your deps responsibly π
tiny sign-off: this was NPM-SHRINKWRAP.JSON(5), dated May 2018 β yes she's an old icon but she's still serving. mwah. πβ¨
π¦ where this page comes from
- nixos 26.05: lemmy-ui 0.19.19
- nixpkgs unstable: lemmy-ui 0.19.21
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms