Skip to content

Commit

Permalink
chore: setup Angular services and models generator
Browse files Browse the repository at this point in the history
  • Loading branch information
getlarge committed Jun 9, 2024
1 parent 9a5016c commit ef5eb49
Show file tree
Hide file tree
Showing 39 changed files with 3,279 additions and 96 deletions.
129 changes: 40 additions & 89 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
{
"root": true,
"ignorePatterns": [
"**/*"
],
"plugins": [
"@nx"
],
"ignorePatterns": ["**/*"],
"plugins": ["@nx"],
"overrides": [
{
"files": [
"*.ts",
"*.tsx",
"*.js",
"*.jsx"
],
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nx/enforce-module-boundaries": [
"error",
Expand Down Expand Up @@ -53,17 +44,21 @@
},
{
"sourceTag": "type:const",
"onlyDependOnLibsWithTags": [
"type:const"
]
"onlyDependOnLibsWithTags": ["type:const"]
},
{
"sourceTag": "type:env",
"sourceTag": "type:data-access",
"onlyDependOnLibsWithTags": [
"type:const",
"type:env"
"type:core",
"type:env",
"type:utils"
]
},
{
"sourceTag": "type:env",
"onlyDependOnLibsWithTags": ["type:const", "type:env"]
},
{
"sourceTag": "type:testing",
"onlyDependOnLibsWithTags": [
Expand All @@ -82,65 +77,50 @@
},
{
"sourceTag": "scope:catprofile",
"onlyDependOnLibsWithTags": [
"scope:shared",
"scope:catprofile"
]
"onlyDependOnLibsWithTags": ["scope:shared", "scope:catprofile"]
},
{
"sourceTag": "scope:fostering",
"onlyDependOnLibsWithTags": [
"scope:shared",
"scope:fostering"
]
"onlyDependOnLibsWithTags": ["scope:shared", "scope:fostering"]
},
{
"sourceTag": "scope:user",
"onlyDependOnLibsWithTags": [
"scope:shared",
"scope:user"
]
"onlyDependOnLibsWithTags": ["scope:shared", "scope:user"]
},
{
"sourceTag": "platform:node",
"onlyDependOnLibsWithTags": [
"platform:node",
"platform:shared"
],
"bannedExternalImports": []
"bannedExternalImports": ["*angular*"]
},
{
"sourceTag": "platform:shared",
"sourceTag": "platform:angular",
"onlyDependOnLibsWithTags": [
"platform:angular",
"platform:shared"
],
"bannedExternalImports": [
"*nestjs*"
]
"bannedExternalImports": ["*nestjs*"]
},
{
"sourceTag": "platform:shared",
"onlyDependOnLibsWithTags": ["platform:shared"],
"bannedExternalImports": ["*angular*", "*nestjs*"]
},
{
"sourceTag": "platform:cli",
"onlyDependOnLibsWithTags": [
"*"
]
"onlyDependOnLibsWithTags": ["*"]
}
]
}
]
}
},
{
"files": [
"*.ts",
"*.tsx"
],
"extends": [
"plugin:@nx/typescript"
],
"plugins": [
"import",
"simple-import-sort"
],
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nx/typescript"],
"plugins": ["import", "simple-import-sort"],
"rules": {
"no-duplicate-imports": "error",
"no-empty": "error",
Expand All @@ -158,39 +138,23 @@
{
"groups": [
// Side effects.
[
"^\\u0000"
],
["^\\u0000"],
// 3rd party.
[
"^@?\\w"
],
["^@?\\w"],
// Anything not fitting group above.
[
"^"
],
["^"],
// Relative imports.
[
"^\\."
]
["^\\."]
]
}
],
"simple-import-sort/exports": "error"
}
},
{
"files": [
"*.js",
"*.jsx"
],
"extends": [
"plugin:@nx/javascript"
],
"plugins": [
"import",
"simple-import-sort"
],
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nx/javascript"],
"plugins": ["import", "simple-import-sort"],
"rules": {
"no-duplicate-imports": "error",
"no-empty": "error",
Expand All @@ -208,34 +172,21 @@
{
"groups": [
// Side effects.
[
"^\\u0000"
],
["^\\u0000"],
// 3rd party.
[
"^@?\\w"
],
["^@?\\w"],
// Anything not fitting group above.
[
"^"
],
["^"],
// Relative imports.
[
"^\\."
]
["^\\."]
]
}
],
"simple-import-sort/exports": "error"
}
},
{
"files": [
"*.spec.ts",
"*.spec.tsx",
"*.spec.js",
"*.spec.jsx"
],
"files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"],
"env": {
"jest": true
},
Expand Down
2 changes: 1 addition & 1 deletion apps/cat-fostering-api-e2e/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "cat-fostering-api-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"implicitDependencies": ["cat-fostering-api"],
"tags": ["type:test", "platform:node"],
"implicitDependencies": ["cat-fostering-api"],
"targets": {
"e2e": {
"executor": "@nx/jest:jest",
Expand Down
14 changes: 10 additions & 4 deletions apps/cat-fostering-web/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"projectType": "application",
"prefix": "app",
"sourceRoot": "apps/cat-fostering-web/src",
"tags": [],
"tags": ["type:app", "platform:angular"],
"targets": {
"build": {
"executor": "@angular-devkit/build-angular:browser",
Expand Down Expand Up @@ -78,9 +78,15 @@
}
},
"extract-openapi-spec": {
"inputs": ["apps/cat-fostering-api/openapi.json"],
"outputs": ["libs/ng/data-access/src/lib/**/*.ts"],
"command": "npx openapi-generator-cli generate -i apps/cat-fostering-api/openapi.json -g typescript-angular -o libs/data-access/src/lib"
"executor": "nx:run-commands",
"options": {
"commands": [
"npx openapi-generator-cli generate -i apps/cat-fostering-api/openapi.json -g typescript-angular -o libs/ng-shared/data-access/src/lib --skip-validate-spec",
"nx run ng-data-access:lint --fix",
"nx format --projects ng-data-access"
],
"parallel": false
}
}
}
}
28 changes: 28 additions & 0 deletions libs/ng-shared/data-access/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"extends": ["../../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-unused-vars": "off",
"no-control-regex": "off",
"no-empty": "off",
"no-param-reassign": "off",
"no-useless-escape": "off",
"prefer-const": "off"
}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
3 changes: 3 additions & 0 deletions libs/ng-shared/data-access/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# ng-data-access

This library was generated with [Nx](https://nx.dev).
9 changes: 9 additions & 0 deletions libs/ng-shared/data-access/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "ng-data-access",
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/ng-shared/data-access/src",
"projectType": "library",
"tags": ["scope:shared", "type:data-access", "platform:angular"],
"// targets": "to see all targets run: nx show project ng-data-access --web",
"targets": {}
}
1 change: 1 addition & 0 deletions libs/ng-shared/data-access/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib';
4 changes: 4 additions & 0 deletions libs/ng-shared/data-access/src/lib/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
wwwroot/*.js
node_modules
typings
dist
23 changes: 23 additions & 0 deletions libs/ng-shared/data-access/src/lib/.openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
26 changes: 26 additions & 0 deletions libs/ng-shared/data-access/src/lib/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.gitignore
README.md
api.module.ts
api/api.ts
api/catProfiles.service.ts
api/default.service.ts
api/fostering.service.ts
api/users.service.ts
configuration.ts
encoder.ts
git_push.sh
index.ts
model/catProfile.ts
model/createCatProfile.ts
model/fostering.ts
model/models.ts
model/onOrySignInDto.ts
model/onOrySignUpDto.ts
model/oryIdentityDto.ts
model/oryIdentityDtoMetadataPublic.ts
model/oryIdentityTraitDto.ts
model/requestFostering.ts
model/updateCatProfile.ts
model/user.ts
param.ts
variables.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.6.0
Loading

0 comments on commit ef5eb49

Please sign in to comment.