Intermediate Reading #json #package-json #typescript #semver

📦 Reading JSON Config

5 exercises — read real package.json and tsconfig.json files. Understand scripts, dependencies vs devDependencies, semver ranges (^/~) and compilerOptions.

JSON config quick reference
  • scripts → command shortcuts run via npm run <name>
  • dependencies = runtime · devDependencies = build/test only
  • ^1.2.3 → minor + patch · ~1.2.3 → patch only · 1.2.3 → exact
  • compilerOptions → how TypeScript type-checks and emits
  • && in a script → run next command only if the first succeeds
0 / 5 completed
1 / 5
📦 package.json
{
  "name": "checkout-service",
  "version": "2.1.0",
  "scripts": {
    "dev": "vite",
    "build": "tsc && vite build",
    "test": "vitest run",
    "lint": "eslint ."
  },
  "dependencies": {
    "react": "^18.2.0",
    "zod": "~3.22.4"
  },
  "devDependencies": {
    "typescript": "5.4.5",
    "vitest": "^1.5.0",
    "eslint": "^8.57.0"
  }
}
In the scripts block, what does "build": "tsc && vite build" do when you run npm run build?