Skip to content

Commit 553182f

Browse files
62 update readme of npm package, added LLM reference, optimized code for ng 22 (#72)
1 parent 7a73311 commit 553182f

42 files changed

Lines changed: 6431 additions & 4250 deletions

Some content is hidden

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

‎.github/workflows/deploy-docs.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Install Node
2525
uses: actions/setup-node@v4
2626
with:
27-
node-version: 22.x
27+
node-version: 26.x
2828

2929
# Restore dependencies
3030
- name: Restore dependencies for lib

‎AGENTS.md‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ How tests are written (libs/ngrx-hateoas)
1212
- Location: `libs/ngrx-hateoas/src/lib/**/*.spec.ts`.
1313
- Framework / runner: Angular unit tests using Jasmine (see `tsconfig.spec.json` types: `jasmine`) and Angular TestBed utilities.
1414
- Common patterns:
15-
- Use `TestBed.configureTestingModule(...)` with providers such as `provideZonelessChangeDetection()`, `provideHttpClient()` and `provideHttpClientTesting()` where needed.
15+
- Use `TestBed.configureTestingModule(...)` with providers such as `provideHttpClient()` and `provideHttpClientTesting()` where needed.
1616
- Services that call HTTP use `HttpTestingController` and `expectOne(...).flush(...)` to simulate server responses and assert request properties (method, body, headers).
17-
- Many tests assert metastate signals (e.g., `isLoading`, `isLoaded`, `isAvailable`) and verify reactive behavior (cancellation of previous requests, reactive reloads when a `Signal` changes) via `signalStore`, `signal()` and `TestBed.flushEffects()` where applicable.
17+
- Many tests assert metastate signals (e.g., `isLoading`, `isLoaded`, `isAvailable`) and verify reactive behavior (cancellation of previous requests, reactive reloads when a `Signal` changes) via `signalStore`, `signal()` and `TestBed.tick()` where applicable.
1818
- Tests use `async/await` or `expectAsync` for promise-based operations and standard Jasmine matchers (`toBeTrue`, `toBeFalse`, `toEqual`, `toBe`, `toBeDefined`, etc.).
1919
- Tests cover pipes, services (request/hateoas), and store-features (loading, writable copies, actions), focusing on isolated unit behavior.
2020

@@ -24,7 +24,6 @@ Playground / local demo
2424
Rules for agents (editing / extending)
2525
- When changing features, update matching docs in `doc/docs/guide/*` and add/adjust unit tests under `libs/ngrx-hateoas/src/lib/**`.
2626
- For HTTP-related behavior, follow existing test patterns using `provideHttpClientTesting()` and `HttpTestingController`.
27-
- Use `provideZonelessChangeDetection()` in TestBed providers to match existing test environment.
2827

2928
References
3029
- See `doc/docs/guide/01-getting-started.md` and `doc/docs/guide/02-concept.md` for conceptual details and examples.

‎README.md‎

Lines changed: 89 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,98 @@
1-
# NGRX Hateoas
1+
# ngrx-hateoas
22

3-
A library to bring hypermedia json into the ngrx signal store following the HATEOAS approach to make it easily useable within Angular.
3+
`ngrx-hateoas` is an Angular library for loading hypermedia JSON into the NgRx Signal Store, following related-resource links, editing state, and executing actions described by the backend.
44

5-
## Repo Usage
5+
This repository contains the published library, an interactive playground with a local demo API, and the documentation website.
66

7-
The repository provides the library itself, a playground app and a dummy backend which provides some Hypermedia Web APIs.``
7+
## Project Links
88

9-
To run the playground app clone the repository and run an `npm install`. Then start the backend with `npm run server` and the playground app with `npm start`.
9+
- [npm package](https://www.npmjs.com/package/@angular-architects/ngrx-hateoas)
10+
- [Library quick start](./libs/ngrx-hateoas/README.md)
11+
- [Documentation](https://angular-architects.github.io/ngrx-hateoas/)
12+
- [Getting Started guide](https://angular-architects.github.io/ngrx-hateoas/docs/guide/getting-started)
13+
- [Issues and feature requests](https://github.com/angular-architects/ngrx-hateoas/issues)
1014

11-
## Playground applicaiton
15+
## Repository Structure
1216

13-
Use and review the playground application inside the repository to understand how to use the library. Also you can review the http responses and requests in the browser network tab to get an impression of how hypermedia json can look like.
17+
| Path | Purpose |
18+
| --- | --- |
19+
| [`libs/ngrx-hateoas`](./libs/ngrx-hateoas) | Angular library source, public API, and unit tests |
20+
| [`apps/playground`](./apps/playground) | Angular application demonstrating the library |
21+
| [`apps/playground/server.js`](./apps/playground/server.js) | Local demo API |
22+
| [`apps/playground/db.json`](./apps/playground/db.json) | Data used by the local demo API |
23+
| [`doc`](./doc) | Docusaurus documentation website |
1424

15-
## Lib Usage
16-
The library is available as npm package here: https://www.npmjs.com/package/@angular-architects/ngrx-hateoas
25+
## Install Dependencies
1726

18-
## Documentation
19-
Find the documentation here: https://angular-architects.github.io/ngrx-hateoas/
27+
Clone the repository and install the root workspace dependencies:
2028

21-
## Real World Sample Application
22-
There is a sample application [Fancy.ResourceLinker.Sample](https://github.com/fancyDevelopment/Fancy.ResourceLinker.Sample) which demonstrates end to end real world usage of hypermedia in Angular and also some other aspects of a real wold system.
29+
```bash
30+
npm i
31+
```
32+
33+
## Run the Playground
34+
35+
Start the demo API in one terminal:
36+
37+
```bash
38+
npm run server
39+
```
40+
41+
The API listens on `http://localhost:5100`.
42+
43+
Start the Angular playground in another terminal:
44+
45+
```bash
46+
npm start
47+
```
48+
49+
Open `http://localhost:4200` and use the browser network tools to inspect the hypermedia responses and the requests derived from their links and actions.
50+
51+
## Build and Verify the Library
52+
53+
Build the Angular library:
54+
55+
```bash
56+
npm run build
57+
```
58+
59+
Run the complete headless test suite with coverage:
60+
61+
```bash
62+
npm run test
63+
```
64+
65+
Run linting:
66+
67+
```bash
68+
npm run lint
69+
```
70+
71+
## Work on the Documentation
72+
73+
The documentation website has its own dependencies. Install and start it from the `doc` directory:
74+
75+
```bash
76+
cd doc
77+
npm i
78+
npm start
79+
```
80+
81+
Create a production documentation build with:
82+
83+
```bash
84+
cd doc
85+
npm run build
86+
```
87+
88+
## Real-World Sample
89+
90+
The [Fancy.ResourceLinker.Sample](https://github.com/fancyDevelopment/Fancy.ResourceLinker.Sample) project demonstrates end-to-end hypermedia usage with Angular and a .NET backend.
91+
92+
## Contributing
93+
94+
Bug reports, feature proposals, documentation improvements, and pull requests are welcome. Before opening a pull request, run the headless tests, library build, and lint checks described above.
95+
96+
## License
97+
98+
This project is licensed under the terms of the [repository license](./LICENSE).

‎apps/playground/src/app/app.config.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
import { ApplicationConfig, provideZonelessChangeDetection } from '@angular/core';
1+
import { ApplicationConfig } from '@angular/core';
22
import { provideRouter } from '@angular/router';
33

44
import { routes } from './app.routes';
5-
import { provideHttpClient, withXhr } from '@angular/common/http';
65
import { provideHateoas } from '@angular-architects/ngrx-hateoas';
76

87
export const appConfig: ApplicationConfig = {
98
providers: [
10-
provideZonelessChangeDetection(),
119
provideRouter(routes),
1210
provideHateoas()
1311
]

‎apps/playground/src/app/flight/flight.routes.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const FLIHGT_ROUTES: Routes = [{
2020
}, {
2121
path: "search/:url",
2222
component: FlightSearchComponent,
23-
canActivate: [(routeSnapshot: ActivatedRouteSnapshot) => inject(FlightSearchStore).loadFlightSearchVmFromUrl(routeSnapshot.paramMap.get('url'), true)]
23+
canActivate: [(routeSnapshot: ActivatedRouteSnapshot) => inject(FlightSearchStore).loadFlightSearchVmFromUrl(routeSnapshot.paramMap.get('url'))]
2424
}, {
2525
path: "edit/:url",
2626
component: FlightEditComponent,

‎apps/playground/src/app/flight/shared/flight-connection-form/flight-connection-form.component.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Component, input } from '@angular/core';
22
import { FlightConnection } from '../../flight.entities';
3-
import { FormField, FieldTree } from '@angular/forms/signals';
3+
import { FieldTree, FormField } from '@angular/forms/signals';
44

55
@Component({
66
selector: 'app-flight-connection-form',

‎apps/playground/src/app/flight/shared/flight-operator-form/flight-operator-form.component.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component, input } from '@angular/core';
2-
import { FormField, FieldTree } from '@angular/forms/signals';
2+
import { FieldTree, FormField } from '@angular/forms/signals';
33
import { Aircraft, FlightOperator } from '../../flight.entities';
44

55
@Component({

‎apps/playground/src/app/flight/shared/flight-price-form/flight-price-form.component.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component, input } from '@angular/core';
2-
import { FormField, FieldTree } from '@angular/forms/signals';
2+
import { FieldTree, FormField } from '@angular/forms/signals';
33
import { FlightPrice } from '../../flight.entities';
44

55
@Component({

‎apps/playground/src/app/flight/shared/flight-times-form/flight-times-form.component.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component, input } from '@angular/core';
2-
import { FormField, FieldTree } from '@angular/forms/signals';
2+
import { FieldTree, FormField } from '@angular/forms/signals';
33
import { FlightTimes } from '../../flight.entities';
44

55
@Component({

‎doc/docs/guide/01-getting-started.md‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,11 @@ To install the **ngrx-hateoas** library run
3737
npm i @angular-architects/ngrx-hateoas
3838
``
3939

40-
Finally you have to add the **ngrx-hateoas** services to your application by using the `provideHateoas()` function. Since **ngrx-hateoas** uses the Angular HTTP client to make its requests to the backend you should also add `provideHttpClient()`.
40+
Finally you have to add the **ngrx-hateoas** services to your application by using the `provideHateoas()` function.
4141

4242
```ts
4343
export const appConfig: ApplicationConfig = {
4444
providers: [
45-
provideHttpClient(),
4645
provideHateoas()
4746
]
4847
};

0 commit comments

Comments
 (0)