Interview Prep/CI/CD/Build Tools and Artifact Repositories

How do semver ranges in `package.json` (`^`, `~`) behave and why do lockfiles matter?

IntermediateConceptBuild Tools and Artifact Repositories
Answer

^1.4.2 allows any 1.x.x at or above 1.4.2, ~1.4.2 allows 1.4.x patches only. Without a lockfile, two builds on different days can resolve different transitive versions. The committed package-lock.json pins every version and integrity hash (SHA-512), making installs reproducible and giving a defence against tampered registry packages.

All CI/CD questions Roadmap: CI/CD fundamentals

More on Build Tools and Artifact Repositories