Skip to content

Commit 6b8763b

Browse files
authored
AUI-51 / Feat: Upgrade to Angular 21, Vitest, standalone, oxfmt (#1420)
* feat!: update packages to 21, make standalone, switch from jest to vite - Upgrade all @angular/* packages from v20 to v21 - Replace @angular-builders/jest with @angular/build:unit-test (Vitest runner) - Upgrade RxJS from v6 to v7, add npm overrides for @hypertrace/hyperdash peer dep - Make all library and app components/directives/pipes standalone - Remove deprecated APIs: ComponentFactoryResolver, HttpClientTestingModule, *ngIf/*ngFor - Replace zone-dependent test utilities (fakeAsync/tick) with Vitest fake timers - Remove @ngneat/spectator, zone.js, and all Jest-related dependencies BREAKING CHANGE: Update Angular to v21, RxJS to v7, make components standalone, switch from Jest to Vitest * chore: change from prettier to oxfmt * fix: fix broken test under node 20 * docs: update README for Vitest and fix commit command * chore: remove check overrides * test: replace istanbul comments with v8 comments * test: make test components standalone * fix: restore RxJS 6 compatibility for Angular 21 Revert the branch to RxJS 6 and align published peer constraints with upstream hyperdash requirements. Add a shared Vitest runner config so Angular 21 tests resolve correctly when RxJS 6 is installed. * chore: remove redundant standalone directive * chore: remove redundant standlone metadata * chore: remove Codecov * chore: clean up stale tooling artifacts and review findings - Remove eslint-config-prettier and its ESLint extends entry (replaced by oxfmt) - Remove ts-node devDependency (no longer needed after Jest→Vitest) - Remove stale .vscode/launch.json (referenced deleted Jest config) - Remove emitDecoratorMetadata from tsconfig (unnecessary for Angular) - Remove duplicate deserialization-manager.service export in public_api - Remove vestigial standalone param from mockDirective test utility - Widen rxjs peer dependency to ^6.5.5 || ^7.0.0 - Enable @angular-eslint/prefer-standalone lint rule - Add non-standalone renderer backward compatibility test - Add util/ to coverage exclusions (types-only files) - Update README with Angular 21 prerequisites and RxJS 6+7 support * fix: filter pre-commit hook to formattable file types * chore: change to node 22 * chore: migrate from npm to pnpm Replace npm with pnpm as the package manager across the repo: - Add packageManager field and pnpm config to package.json - Add ci script for frozen-lockfile installs - Update CI workflows to use pnpm with node_modules caching - Align publish workflow to Node 22 - Replace package-lock.json with pnpm-lock.yaml - Update CLAUDE.md command references * fix: approve lmdb and msgpackr-extract build scripts for pnpm These native addons are transitive dependencies of @parcel/watcher used by the Angular build toolchain. Without their build scripts running, native bindings aren't compiled, causing AOT compilation issues in CI.
1 parent b8a57e5 commit 6b8763b

File tree

58 files changed

+13467
-32627
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+13467
-32627
lines changed

.eslintrc.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
"extends": [
1212
"plugin:@typescript-eslint/recommended",
1313
"plugin:@angular-eslint/recommended",
14-
"plugin:@angular-eslint/template/process-inline-templates",
15-
"prettier"
14+
"plugin:@angular-eslint/template/process-inline-templates"
1615
],
1716
"plugins": ["eslint-plugin-no-null", "eslint-plugin-unicorn"],
1817
"rules": {
@@ -28,7 +27,7 @@
2827
"@angular-eslint/no-pipe-impure": "error",
2928
"@angular-eslint/no-queries-metadata-property": "error",
3029
"@angular-eslint/prefer-output-readonly": "error",
31-
"@angular-eslint/prefer-standalone": "off",
30+
"@angular-eslint/prefer-standalone": "error",
3231
"@angular-eslint/use-component-selector": "error",
3332
"@angular-eslint/use-component-view-encapsulation": "error",
3433
"@angular-eslint/prefer-inject": "off",

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
## Description
2+
23
Please include a summary of the change, motivation and context.
34

45
<!--
@@ -7,16 +8,18 @@ Please include a summary of the change, motivation and context.
78
- **on a bugfix**: link relevant information about the bug (github issue or slack thread) and how this change solves it e.g. this change fixes #99999 by adding a lock on read/write to avoid data races.
89
-->
910

10-
1111
### Testing
12-
Please describe the tests that you ran to verify your changes. Please summarize what did you test and what needs to be tested e.g. deployed and tested helm chart locally.
12+
13+
Please describe the tests that you ran to verify your changes. Please summarize what did you test and what needs to be tested e.g. deployed and tested helm chart locally.
1314

1415
### Checklist:
16+
1517
- [ ] My changes generate no new warnings
1618
- [ ] I have added tests that prove my fix is effective or that my feature works
1719
- [ ] Any dependent changes have been merged and published in downstream modules
1820

1921
### Documentation
22+
2023
Make sure that you have documented corresponding changes in this repository or [hypertrace docs repo](https://github.com/hypertrace/hypertrace-docs-website) if required.
2124

2225
<!--

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ updates:
33
- package-ecosystem: 'npm'
44
directory: '/'
55
commit-message:
6-
prefix: "chore"
6+
prefix: 'chore'
77
schedule:
88
interval: 'weekly'

.github/workflows/build-and-test.yml

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,25 @@ jobs:
1111
- name: Check out code
1212
uses: actions/checkout@v4
1313

14-
- name: Set up Node 20
14+
- name: Set up pnpm
15+
uses: pnpm/action-setup@v4
16+
17+
- name: Set up Node 22
1518
uses: actions/setup-node@v4
1619
with:
17-
node-version: '20'
18-
cache: 'npm'
20+
node-version: '22'
21+
22+
- name: Cache node_modules
23+
uses: actions/cache@v4
24+
with:
25+
path: node_modules
26+
key: node-modules-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
1927

20-
- name: NPM Install
21-
run: npm ci
28+
- name: Install
29+
run: pnpm run ci
2230

2331
- name: Build
24-
run: npm run build:ci
32+
run: pnpm run build:ci
2533
test:
2634
runs-on: ubuntu-24.04
2735
steps:
@@ -30,23 +38,25 @@ jobs:
3038
with:
3139
fetch-depth: 0
3240

33-
- name: Set up Node 20
41+
- name: Set up pnpm
42+
uses: pnpm/action-setup@v4
43+
44+
- name: Set up Node 22
3445
uses: actions/setup-node@v4
3546
with:
36-
node-version: '20'
37-
cache: 'npm'
47+
node-version: '22'
3848

39-
- name: NPM Install
40-
run: npm ci
49+
- name: Cache node_modules
50+
uses: actions/cache@v4
51+
with:
52+
path: node_modules
53+
key: node-modules-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
4154

42-
- name: Test
43-
run: npm run test:ci
55+
- name: Install
56+
run: pnpm run ci
4457

45-
- name: Upload coverage to Codecov
46-
uses: codecov/codecov-action@v4
47-
with:
48-
fail_ci_if_error: true
49-
token: ${{ secrets.CODECOV_TOKEN }}
58+
- name: Test
59+
run: pnpm run test:ci
5060

5161
- name: Publish Unit Test Results
5262
uses: EnricoMi/publish-unit-test-result-action@v2

.github/workflows/publish.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,25 @@ jobs:
1515
- name: Check out code
1616
uses: actions/checkout@v4
1717

18-
- name: Set up Node 20
18+
- name: Set up pnpm
19+
uses: pnpm/action-setup@v4
20+
21+
- name: Set up Node 22
1922
uses: actions/setup-node@v4
2023
with:
21-
node-version: '20'
22-
cache: 'npm'
24+
node-version: '22'
25+
26+
- name: Cache node_modules
27+
uses: actions/cache@v4
28+
with:
29+
path: node_modules
30+
key: node-modules-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
2331

24-
- name: NPM Install
25-
run: npm ci
32+
- name: Install
33+
run: pnpm run ci
2634

2735
- name: Build
28-
run: npm run build:ci
36+
run: pnpm run build:ci
2937

3038
- uses: google-github-actions/auth@v2
3139
id: auth
@@ -36,10 +44,10 @@ jobs:
3644
# Ref https://github.com/semantic-release/npm/pull/844
3745
- name: Update npmrc for publish
3846
shell: bash
39-
run: npm config set -L project @hypertrace:registry ${{ secrets.GAR_NPM_PUBLISH_REGISTRY }}
47+
run: echo "@hypertrace:registry=${{ secrets.GAR_NPM_PUBLISH_REGISTRY }}" >> .npmrc
4048

4149
- name: Publish
42-
run: npm run semantic-release
50+
run: pnpm run semantic-release
4351
env:
4452
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4553
NPM_TOKEN: ${{ steps.auth.outputs.access_token }}

.husky/pre-commit

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
npx --no-install pretty-quick --staged
1+
FILES=$(git diff --cached --name-only --diff-filter=ACMR | grep -E '\.(ts|js|json|html|css|scss)$' || true)
2+
[ -z "$FILES" ] && exit 0
3+
echo "$FILES" | xargs npx --no-install oxfmt
4+
echo "$FILES" | xargs git add

.oxfmtrc.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
3+
"singleQuote": true,
4+
"printWidth": 120,
5+
"trailingComma": "none",
6+
"arrowParens": "avoid",
7+
"sortPackageJson": false,
8+
"ignorePatterns": []
9+
}

.prettierrc

Lines changed: 0 additions & 6 deletions
This file was deleted.

.vscode/launch.json

Lines changed: 0 additions & 15 deletions
This file was deleted.

CLAUDE.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@ Hyperdash Angular (`@hypertrace/hyperdash-angular`) is an Angular library provid
1212

1313
```bash
1414
# Development
15-
npm start # Dev server at localhost:4200
16-
npm run build # Build app and library
15+
pnpm start # Dev server at localhost:4200
16+
pnpm run build # Build app and library
1717

1818
# Testing
19-
npm test # Run tests (watch mode)
20-
npm run test:ci:lib # Library tests only (CI mode)
21-
npm run test:ci:app # App tests only (CI mode)
22-
npm run test:ci # Full CI suite (lint + all tests)
19+
pnpm test # Run tests (watch mode)
20+
pnpm run test:ci:lib # Library tests only (CI mode)
21+
pnpm run test:ci:app # App tests only (CI mode)
22+
pnpm run test:ci # Full CI suite (lint + all tests)
2323

2424
# Code Quality
25-
npm run lint # Run ESLint
26-
npm run commit # Interactive conventional commit (commitizen)
25+
pnpm run lint # Run ESLint
26+
pnpm run commit # Interactive conventional commit (commitizen)
2727
```
2828

2929
## Architecture
@@ -37,9 +37,10 @@ Core `@hypertrace/hyperdash` classes are wrapped as Angular injectable services
3737

3838
### Module System
3939

40-
- `DashboardCoreModule`: Main runtime module with default property types and deserializers
40+
- All library components, directives, and pipes are **standalone**
41+
- `DashboardCoreModule`: Re-exports standalone declarables with default property types and deserializers
4142
- `DashboardCoreModule.with(metadata)`: Extend with custom types, models, renderers, editors, deserializers
42-
- `DashboardEditorModule`: Separate module for editing capabilities
43+
- `DashboardEditorModule`: Re-exports standalone editor components
4344

4445
### Key Injection Tokens
4546

@@ -69,15 +70,16 @@ Core `@hypertrace/hyperdash` classes are wrapped as Angular injectable services
6970

7071
### Testing
7172

72-
- Jest with `@ngneat/spectator` for component testing
73+
- Vitest via `@angular/build:unit-test` (zoneless, AOT)
7374
- Test files: `*.test.ts` or `*.spec.ts`
7475
- Coverage excludes: `*.module.ts`, `public_api.ts`, `test/` directory
76+
- Zoneless requires `fixture.changeDetectorRef.markForCheck()` before `fixture.detectChanges()` when mutating component properties between change detection cycles
7577

7678
### Commits
7779

7880
- Conventional commits required (enforced via commitlint)
79-
- Use `npm run commit` for interactive commit wizard
80-
- Pre-commit hook runs Prettier on staged files
81+
- Use `pnpm run commit` for interactive commit wizard
82+
- Pre-commit hook runs oxfmt on staged files
8183

8284
## ESLint Rules of Note
8385

0 commit comments

Comments
 (0)