Lesson 7 / 28

package.json & Semantic Versioning

The manifest for every Node project, and how version numbers communicate change.

The manifest file

package.json records your project's name, entry point, dependencies, and scripts.

{
  "name": "my-app",
  "version": "1.0.0",
  "type": "module",
  "main": "index.js",
  "dependencies": {
    "express": "^4.19.2"
  }
}

MAJOR.MINOR.PATCH

Semantic versioning is MAJOR.MINOR.PATCH: major for breaking changes, minor for new backward-compatible features, patch for bug fixes.

^ and ~ ranges

^4.19.2 allows minor/patch updates (up to <5.0.0); ~4.19.2 allows only patch updates (up to <4.20.0).