Available npm Scripts
Air Tracker includes several npm scripts for common development tasks. These are defined inpackage.json:
Development Server
Starting the Server
To start the development server:http://localhost:4200/.
Development Features
When running in development mode, you get:- Hot Module Replacement (HMR) - Automatically reloads when you save changes
- Source Maps - Debug TypeScript code directly in the browser
- Detailed Error Messages - Comprehensive error information
- No Optimization - Faster builds for quicker feedback
angular.json:
Custom Port
Run on a different port:Open Browser Automatically
Building the Application
Production Build
Create an optimized production build:dist/ directory.
Production Build Features
- Optimization - Minified and tree-shaken code
- AOT Compilation - Ahead-of-time compilation for better performance
- Output Hashing - Cache-busting filenames
- Bundle Budgets - Enforced size limits
angular.json:
Development Build
Create a development build without optimization:Watch Mode
Watch mode rebuilds your application whenever files change:- Testing builds without running a server
- Integrating with external tools
- Debugging build issues
Debugging
Browser DevTools
- Open Chrome/Firefox DevTools (F12)
- Navigate to the Sources tab
- Find your TypeScript files under
webpack://→.→src - Set breakpoints directly in TypeScript code
VS Code Debugging
Create.vscode/launch.json:
- Start the dev server:
npm start - Press F5 in VS Code to launch Chrome with debugging
- Set breakpoints in your TypeScript files
Console Logging
The application uses structured logging. Example from the codebase:Running Tests
Run unit tests while developing:Linting
Lint your code to catch errors and maintain consistency:Environment Configuration
Air Tracker uses environment files for configuration:src/environments/environment.ts- Development environmentsrc/environments/environment.production.ts- Production environment
environment.ts is replaced with environment.production.ts:
Common Development Tasks
Generate New Components
Clear Build Cache
If you encounter build issues:Update Dependencies
Check for outdated packages:Performance Tips
Faster Rebuilds
- Close unnecessary applications to free up system resources
- Use watch mode instead of restarting the server
- Increase Node.js memory:
NODE_OPTIONS=--max-old-space-size=4096 npm start
Faster Tests
Run tests for specific files:Troubleshooting
Build Errors
If you see TypeScript errors:- Ensure your IDE is using the workspace TypeScript version
- Check
tsconfig.jsonfor strict mode settings - Clear the Angular cache:
rm -rf .angular/cache
Module Not Found
If imports fail:- Verify the file path is correct
- Check that the module is properly exported
- Restart the TypeScript language server
Hot Reload Not Working
If changes don’t auto-reload:- Check that you’re saving files properly
- Restart the dev server
- Clear browser cache (Ctrl+Shift+R)
Next Steps
- Learn about testing
- Review code style guidelines
- Explore component development guidelines
