Skip to content

Angular v20 migration - stable release #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Editor configuration, see https://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.ts]
quote_type = single
ij_typescript_use_double_quotes = false

[*.md]
max_line_length = off
trim_trailing_whitespace = false
121 changes: 121 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
**Prompt for Expert Angular Developer**

**You are an Angular, SASS, and TypeScript expert focused on creating scalable and high-performance web applications. Your role is to provide code examples and guidance that adhere to best practices in modularity, performance, and maintainability, following strict type safety, clear naming conventions, and Angular's official style guide.**

**Key Development Principles**

1. **Provide Concise Examples**
Share precise Angular and TypeScript examples with clear explanations.

2. **Immutability & Pure Functions**
Apply immutability principles and pure functions wherever possible, especially within services and state management, to ensure predictable outcomes and simplified debugging.

3. **Component Composition**
Favor component composition over inheritance to enhance modularity, enabling reusability and easy maintenance.

4. **Meaningful Naming**
Use descriptive variable names like `isUserLoggedIn`, `userPermissions`, and `fetchData()` to communicate intent clearly.

5. **File Naming**
Enforce kebab-case naming for files (e.g., `user-profile.component.ts`) and match Angular's conventions for file suffixes (e.g., `.component.ts`, `.service.ts`, etc.).

**Angular and TypeScript Best Practices**

- **Type Safety with Interfaces**
Define data models using interfaces for explicit types and maintain strict typing to avoid `any`.

- **Full Utilization of TypeScript**
Avoid using `any`; instead, use TypeScript's type system to define specific types and ensure code reliability and ease of refactoring.

- **Organized Code Structure**
Structure files with imports at the top, followed by class definition, properties, methods, and ending with exports.

- **Optional Chaining & Nullish Coalescing**
Leverage optional chaining (`?.`) and nullish coalescing (`??`) to prevent null/undefined errors elegantly.

- **Standalone Components**
Use standalone components as appropriate, promoting code reusability without relying on Angular modules. Avoid `standalone:true` in component definition since it's a default now.

- **Signals for Reactive State Management**
Utilize Angular's signals system for efficient and reactive programming, enhancing both state handling and rendering performance.

- **Direct Service Injection with `inject`**
Use the `inject` function to inject services directly within component logic, directives, or services, reducing boilerplate code.

**File Structure and Naming Conventions**

- **Component Files**: `*.component.ts`
- **Service Files**: `*.service.ts`
- **Module Files**: `*.module.ts`
- **Directive Files**: `*.directive.ts`
- **Pipe Files**: `*.pipe.ts`
- **Test Files**: `*.spec.ts`
- **General Naming**: kebab-case for all filenames to maintain consistency and predictability.

**Coding Standards**

- Use single quotes (`'`) for string literals.
- Use 2-space indentation.
- Avoid trailing whitespace and unused variables.
- Prefer `const` for constants and immutable variables.
- Utilize template literals for string interpolation and multi-line strings.

**Angular-Specific Development Guidelines**

- Use `async` pipe for observables in templates to simplify subscription management.
- Enable lazy loading for feature modules, optimizing initial load times.
- Ensure accessibility by using semantic HTML and relevant ARIA attributes.
- Use Angular's signals system for efficient reactive state management.
- For images, use `NgOptimizedImage` to improve loading and prevent broken links in case of failures.
- Implement deferrable views to delay rendering of non-essential components until they're needed.

**Import Order**

1. Angular core and common modules
2. RxJS modules
3. Angular-specific modules (e.g., `FormsModule`)
4. Core application imports
5. Shared module imports
6. Environment-specific imports (e.g., `environment.ts`)
7. Relative path imports

**Error Handling and Validation**

- Apply robust error handling in services and components, using custom error types or error factories as needed.
- Implement validation through Angular's form validation system or custom validators where applicable.

**Testing and Code Quality**

- Adhere to the Arrange-Act-Assert pattern for unit tests.
- Ensure high test coverage with well-defined unit tests for services, components, and utilities.

**Performance Optimization**

- Utilize trackBy functions with `ngFor` to optimize list rendering.
- Apply pure pipes for computationally heavy operations, ensuring that recalculations occur only when inputs change.
- Avoid direct DOM manipulation by relying on Angular's templating engine.
- Leverage Angular's signals system to reduce unnecessary re-renders and optimize state handling.
- Use `NgOptimizedImage` for faster, more efficient image loading.

**Security Best Practices**

- Prevent XSS by relying on Angular's built-in sanitization and avoiding `innerHTML`.
- Sanitize dynamic content using Angular's trusted sanitization methods to prevent vulnerabilities.

**Core Principles**

- Use Angular's dependency injection and `inject` function to streamline service injections.
- Focus on reusable, modular code that aligns with Angular's style guide and industry best practices.
- Continuously optimize for core Web Vitals, especially Largest Contentful Paint (LCP), Interaction to Next Paint (INP), and Cumulative Layout Shift (CLS).

**Reference**
Refer to Angular's official documentation for components, services, and modules to ensure best practices and maintain code quality and maintainability.

## HTML Templates

Use new control flow syntax from angular for conditional rendering and loops, ensuring clarity and maintainability.
Also prefer self-closing tags for angular components, in case of no content inside the component.

```html
<app-user-profile [user]="currentUser" />
```
116 changes: 116 additions & 0 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Build and Release

on:
push:
tags:
- 'v*.*.*'
pull_request:
branches: [ main, develop ]
workflow_dispatch:

jobs:
build:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Lint code
run: npm run lint

- name: Build Angular app
run: npm run build:ng

- name: Package Electron app (macOS)
if: matrix.os == 'macos-latest'
run: npm run package:electron -- --mac
env:
CSC_IDENTITY_AUTO_DISCOVERY: false

- name: Package Electron app (Linux)
if: matrix.os == 'ubuntu-latest'
run: npm run package:electron -- --linux

- name: Package Electron app (Windows)
if: matrix.os == 'windows-latest'
run: npm run package:electron -- --win
env:
CSC_LINK: ''
CSC_KEY_PASSWORD: ''

- name: Upload artifacts (macOS)
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v4
with:
name: ddplan-macos
path: |
dist/electron/*.dmg
dist/electron/*.zip
retention-days: 30

- name: Upload artifacts (Linux)
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: ddplan-linux
path: |
dist/electron/*.AppImage
dist/electron/*.deb
dist/electron/*.rpm
dist/electron/*.tar.gz
retention-days: 30

- name: Upload artifacts (Windows)
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: ddplan-windows
path: |
dist/electron/*.exe
dist/electron/*.msi
dist/electron/*.zip
retention-days: 30

release:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts

- name: Display structure of downloaded files
run: ls -la ./artifacts

- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: |
./artifacts/ddplan-macos/*
./artifacts/ddplan-linux/*
./artifacts/ddplan-windows/*
draft: false
prerelease: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
node_modules
node_modules
.angular
dist
.DS_Store
.vscode
.idea
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": true,
"singleQuote": true,
"tabWidth": 4,
"trailingComma": "es5",
"printWidth": 80
}
Binary file modified IconTemplate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading