Reading package.json and simulating npm run
The > name@version script lines copy what npm itself prints before running each script. A real prebuild that runs npm run lint would also print the lint script's own two lines.
npm is the package manager that comes with Node.js: package.json lists your project's name, scripts and the packages it depends on (with version ranges), node_modules holds the installed code, and the lockfile pins the exact versions so every install is identical.
Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.
Ready for more? This phase has 6 hands-on exercises with automatic checks.
Practice questions
Write the code in the editor, run it, then open the model answer to compare.
Write a function bumpType(oldVersion, newVersion) that returns "major", "minor", "patch" or "same".
Write the package.json scripts for a project that runs Vite in development, builds with vite build, lints with eslint . and runs the linter automatically before every build.
For each change, say which version number you bump: (a) fix a rounding bug; (b) add a new optional currency option; (c) rename the function format to formatPrice.
Explain it without notes
What is the difference between dependencies and devDependencies?
Explain semver and what ^, ~ and an exact version mean in package.json.
Why should you commit package-lock.json, and when do you use npm ci instead of npm install?
How do npm scripts find tools like vite and eslint?
Preview
Console
Nothing logged yet.Expected console output
Shipped to users: [ 'date-fns' ]
Only for building: [ 'vite', 'eslint' ]
> my-shop@1.0.0 prebuild
> npm run lint
> my-shop@1.0.0 build
> vite build
> my-shop@1.0.0 postbuild
> node scripts/report-size.js
npm error Missing script: "deploy"