Skip to content

Commit

Permalink
upgrade angular to >=12 <=16
Browse files Browse the repository at this point in the history
  • Loading branch information
petrhavel2 committed Oct 17, 2023
1 parent fb0452a commit f195de1
Show file tree
Hide file tree
Showing 200 changed files with 14,098 additions and 14,912 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/dist
/generated
31 changes: 31 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module.exports = {
"env": {
"browser": true,
"es2021": true
},
"extends": [
"plugin:@typescript-eslint/recommended",
],
"overrides": [
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
],
"rules": {
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/no-unused-vars": 0,
"@typescript-eslint/no-empty-function": 0,
"prefer-const": 0,
"no-async-promise-executor": 0,
"@typescript-eslint/no-inferrable-types": 0,
"@typescript-eslint/no-extra-semi": 0,
"@typescript-eslint/ban-types": 0,
"@typescript-eslint/prefer-as-const": 0,
"@typescript-eslint/no-empty-interface": 0,
}
}
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Run tests

on:
workflow_dispatch:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Use Node.js 18.0.0
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: |
npm ci
- name: Run tests
run: npm run test:ci
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ src/api/

# build dir
dist/

# angular cache from demo
.angular
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

19 changes: 0 additions & 19 deletions Dockerfile

This file was deleted.

35 changes: 13 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Generate minimalistic TypeScript API layer for Angular with full type reflection
- so that the server responses can be reached in the redux store
- requests can be triggered by dispatching an action

##### Have a look at the [demo-app generated files](demo-app/client/generated) to get better understanding what is being generated.
##### Have a look at the [demo generated files](demo/generated) to get better understanding what is being generated.

## Install
`npm i swagger-angular-generator`
Expand Down Expand Up @@ -125,9 +125,9 @@ export class MyComponent implements OnInit {
- there's a helper method `safeSetValue()` that sets the shape and data of all `AbstractControl`'s ancestors and never fails (compatible data form the shape and are set, the rest is ignored).
- use it in the template the following way
- check the details in the generated test files, e.g.
- [generated form](demo-app/client/generated/store/structures/map/map.service.ts),
- [array tests](demo-app/client/src/tests/form/array.spec.ts),
- [map tests](demo-app/client/src/tests/form/map.spec.ts).
- [generated form](demo/generated/store/structures/map/map.service.ts),
- [array tests](demo/src/tests/form/array.spec.ts),
- [map tests](demo/src/tests/form/map.spec.ts).

```html
<form [formGroup]="exampleFormService.form" (ngSubmit)="sendForm()" class="full-width">
Expand Down Expand Up @@ -235,16 +235,16 @@ export class ExampleComponent implements OnDestroy {
```typescript
@Injectable()
export class ExampleEffects {
@Effect()
CreateProductCategory = this.storeActions.ofType<actions.Start>(actions.Actions.START).pipe(
CreateProductCategory = createEffect(() => this.storeActions.pipe(
ofType<actions.Start>(actions.Actions.START),
switchMap((action: actions.Start) => this.exampleService.exampleEndpointMethod(action.payload)
.pipe(
map(result => new actions.Success(result)),
catchError((error: HttpErrorResponse) => of(new actions.Error(error.message))),
),
),
);
));
constructor(
private storeActions: Actions,
private adminproductService: AdminProductService,
Expand Down Expand Up @@ -311,30 +311,21 @@ generated inside Order.ts

## Development

* at least Node.js 8 is needed

### Docker image

1. `docker build . -t swagger-angular-generator`
1. `docker run -u $(id -u) -it -v "$PWD":/code swagger-angular-generator bash`
1. `npm i`
1. `npm run install:demo`
* at least Node.js 10 is needed

### Testing

#### How the testing works

* tests are written in the demo-app
* the test swagger files can be found in demo-app/client/test-swaggers
* tests are written in the tests folder
* the test swagger file can be found in demo/swagger-files
* upon these swagger files, interfaces and services are generated
* the generated services are manually imported to the app.module.ts
* unit tests can be found in demo-app/client/src/tests
* unit tests are located in `tests` folder

#### Running the tests

To run client tests in interactive mode:

1. `cd demo-app/client`
1. `npm test`

---
Expand All @@ -353,4 +344,4 @@ Please do the following before making a PR:

1. Build the app and regenerate testing files via `npm run build`.
1. Check test pass via `npm test`.
1. Check files lint via `npm run lint`.
1. Check files lint via `npm run eslint`.
41 changes: 41 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"client": {
"root": "",
"sourceRoot": "tests",
"projectType": "application",
"architect": {
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": [
"zone.js",
"zone.js/testing"
],
"tsConfig": "tests/tsconfig.spec.json",
"scripts": [],
"styles": [],
"assets": [
"tests/assets",
"tests/favicon.ico"
]
}
}
}
}
},
"schematics": {
"@schematics/angular:component": {
"prefix": "app"
},
"@schematics/angular:directive": {
"prefix": "app"
}
},
"cli": {
"analytics": false
}
}
38 changes: 0 additions & 38 deletions demo-app/client/.gitignore

This file was deleted.

103 changes: 0 additions & 103 deletions demo-app/client/angular.json

This file was deleted.

Loading

0 comments on commit f195de1

Please sign in to comment.