npm Scripts
Add scripts
Store common commands in package.json so teammates run the same steps.
{
"scripts": {
"build": "tsc",
"watch": "tsc --watch",
"start": "node dist/app.js"
}
}
Run them
Use npm to invoke the named scripts.
npm run build
npm run watch
npm start
Local TypeScript binary
Project installs expose tsc via npm scripts or npx tsc without a global install.
npx tsc --version
Workflow tips
- Commit
package.jsonandpackage-lock.json - Put sources in
src/and emit todist/ - Add a clean script that removes
distwhen builds get messy - Keep learning scripts small before adding bundlers
Comments
One comment per signed-in account. Comments are saved with this page’s URL.