Why does "npm install" rewrite package-lock.json?
A simplistic answer: package.json have your dependencies as usual, while package-lock.json is "an exact, and more importantly reproducible node_modules tree" (taken from npm docs itself).
Source: stackoverflow.com