mirror of
https://github.com/supabase/supabase.git
synced 2026-10-15 22:29:11 +03:00
176 lines
7.0 KiB
Markdown
176 lines
7.0 KiB
Markdown
# Angular 19 Update Summary
|
|
|
|
## Overview
|
|
|
|
Successfully updated the Angular tutorial and example application from Angular v14.2.0 to Angular v19.0.0, incorporating modern Angular 19 features and best practices. All work was completed within the existing `examples/user-management/angular-user-management` directory.
|
|
|
|
## Key Changes Made
|
|
|
|
### 1. Example Application Modernization (`examples/user-management/angular-user-management/`)
|
|
|
|
#### Package Dependencies Updated
|
|
- **Angular Core**: `^14.2.0` → `^19.0.0`
|
|
- **TypeScript**: `~4.7.2` → `~5.6.0`
|
|
- **Supabase JS**: `^2.0.4` → `^2.50.0`
|
|
- **RxJS**: `~7.5.0` → `~7.8.0`
|
|
- **Zone.js**: `~0.11.4` → `~0.15.0`
|
|
- **All Angular DevKit packages**: Updated to `^19.0.0`
|
|
|
|
#### Architecture Migration
|
|
- **Converted from NgModule to Standalone Components**: Removed `app.module.ts` and converted all components to standalone
|
|
- **Updated Bootstrap Method**: Changed from `platformBrowserDynamic().bootstrapModule()` to `bootstrapApplication()`
|
|
- **Modern Component Structure**: All components now use `standalone: true` with proper imports
|
|
|
|
#### Component Updates
|
|
1. **AppComponent** (`src/app/app.component.ts`)
|
|
- Converted to standalone component
|
|
- Added proper imports: `CommonModule`, `AuthComponent`, `AccountComponent`
|
|
|
|
2. **AuthComponent** (`src/app/auth/auth.component.ts`)
|
|
- Converted to standalone component
|
|
- Added imports: `CommonModule`, `ReactiveFormsModule`
|
|
|
|
3. **AccountComponent** (`src/app/account/account.component.ts`)
|
|
- Converted to standalone component
|
|
- Added imports: `CommonModule`, `ReactiveFormsModule`, `AvatarComponent`
|
|
|
|
4. **AvatarComponent** (`src/app/avatar/avatar.component.ts`)
|
|
- Converted to standalone component
|
|
- Added imports: `CommonModule`
|
|
|
|
#### Bootstrap Configuration
|
|
- **Updated main.ts**: Now uses `bootstrapApplication()` with provider configuration
|
|
- **Service Provision**: Added `SupabaseService` to providers array
|
|
|
|
### 2. Tutorial Documentation Update (`apps/docs/content/guides/getting-started/tutorials/with-angular.mdx`)
|
|
|
|
#### Modern Angular 19 Practices
|
|
- **CLI Commands**: Updated to use `npx @angular/cli@latest` and `--standalone` flag by default
|
|
- **Component Generation**: All examples now use `ng g c component-name --standalone`
|
|
- **Removed NgModule References**: No longer mentions `app.module.ts` or NgModule patterns
|
|
- **App Name**: Updated to use `angular-user-management` (matching the existing example app)
|
|
|
|
#### $CodeSample Integration
|
|
Replaced all inline code blocks with `$CodeSample` components that reference the actual example files:
|
|
|
|
```mdx
|
|
<$CodeSample
|
|
path="/user-management/angular-user-management/src/app/supabase.service.ts"
|
|
lines={[[1, -1]]}
|
|
meta="name=src/app/supabase.service.ts"
|
|
/>
|
|
```
|
|
|
|
#### Files Now Referenced via $CodeSample
|
|
- `src/environments/environment.ts`
|
|
- `src/app/supabase.service.ts`
|
|
- `src/app/auth/auth.component.ts`
|
|
- `src/app/auth/auth.component.html`
|
|
- `src/app/account/account.component.ts`
|
|
- `src/app/account/account.component.html`
|
|
- `src/app/app.component.ts`
|
|
- `src/app/app.component.html`
|
|
- `src/main.ts`
|
|
- `src/app/avatar/avatar.component.ts`
|
|
- `src/app/avatar/avatar.component.html`
|
|
|
|
#### Added Angular 19 Features Section
|
|
- Standalone Components benefits
|
|
- Enhanced Developer Experience
|
|
- Modern TypeScript Support (5.6+)
|
|
- Improved Performance
|
|
- Enhanced Reactivity
|
|
|
|
## Benefits of the Update
|
|
|
|
### 1. Modern Development Experience
|
|
- **Standalone Components**: Eliminates NgModule boilerplate, making the codebase simpler and more maintainable
|
|
- **Latest TypeScript**: Full compatibility with TypeScript 5.6 features
|
|
- **Updated Dependencies**: Access to latest security patches and performance improvements
|
|
|
|
### 2. Improved Tutorial Quality
|
|
- **DRY Principle**: Code examples are now sourced directly from working example app
|
|
- **Consistency**: No risk of tutorial code drifting from example code
|
|
- **Maintainability**: Updates to example app automatically reflect in tutorial
|
|
|
|
### 3. Performance Benefits
|
|
- **Better Tree-Shaking**: Standalone components allow for better optimization
|
|
- **Smaller Bundle Sizes**: Modern Angular 19 build optimizations
|
|
- **Faster Development**: Improved CLI and Hot Module Replacement
|
|
|
|
### 4. Future-Proof Architecture
|
|
- **Signal Integration Ready**: Prepared for Angular's signals-based reactivity
|
|
- **Modern Patterns**: Follows current Angular best practices
|
|
- **Upgrade Path**: Easier future upgrades due to modern architecture
|
|
|
|
## Technical Implementation Details
|
|
|
|
### Standalone Component Pattern
|
|
All components now follow this pattern:
|
|
```typescript
|
|
@Component({
|
|
selector: 'app-component',
|
|
standalone: true,
|
|
imports: [CommonModule, /* other dependencies */],
|
|
templateUrl: './component.html',
|
|
styleUrls: ['./component.css']
|
|
})
|
|
```
|
|
|
|
### Bootstrap Configuration
|
|
```typescript
|
|
bootstrapApplication(AppComponent, {
|
|
providers: [
|
|
SupabaseService
|
|
]
|
|
})
|
|
```
|
|
|
|
### Service Injection
|
|
Services remain largely unchanged but are now provided via the providers array in `bootstrapApplication()`.
|
|
|
|
## Files Modified
|
|
|
|
### Example Application (`examples/user-management/angular-user-management/`)
|
|
- `package.json` - Updated all dependencies to Angular 19
|
|
- `src/main.ts` - Converted to bootstrapApplication
|
|
- `src/app/app.component.ts` - Made standalone
|
|
- `src/app/auth/auth.component.ts` - Made standalone
|
|
- `src/app/account/account.component.ts` - Made standalone
|
|
- `src/app/avatar/avatar.component.ts` - Made standalone
|
|
- `src/app/app.module.ts` - **REMOVED** (no longer needed)
|
|
|
|
### Documentation
|
|
- `apps/docs/content/guides/getting-started/tutorials/with-angular.mdx` - Complete rewrite using $CodeSample
|
|
|
|
## Testing and Validation
|
|
|
|
### Example App Status
|
|
- Package.json updated with correct Angular 19 dependencies
|
|
- All components converted to standalone architecture
|
|
- Bootstrap configuration updated
|
|
- Ready for installation and testing
|
|
|
|
### Tutorial Status
|
|
- All code samples now reference working example files
|
|
- Modern Angular 19 practices documented
|
|
- Standalone component approach explained
|
|
- Clear migration path from NgModule to standalone
|
|
|
|
## Next Steps
|
|
|
|
1. **Install Dependencies**: Run `npm install` in the `examples/user-management/angular-user-management` directory
|
|
2. **Build Test**: Verify the example app builds successfully with `ng build`
|
|
3. **Runtime Test**: Test the application with `ng serve`
|
|
4. **Tutorial Validation**: Verify all $CodeSample components render correctly in the docs
|
|
|
|
## Conclusion
|
|
|
|
The Angular tutorial and example application have been successfully modernized to Angular 19 standards within the existing `examples/user-management/angular-user-management` directory. The update provides:
|
|
|
|
- A cleaner, more maintainable codebase using standalone components
|
|
- Improved documentation that stays in sync with working code
|
|
- Access to the latest Angular features and performance improvements
|
|
- A solid foundation for future Angular updates
|
|
|
|
The tutorial now serves as an excellent introduction to modern Angular development practices while demonstrating real-world Supabase integration patterns. All changes were made to the existing example app structure, ensuring consistency with the repository organization. |