Skip to content

Commit

Permalink
Merge pull request #2 from getlarge/feat-add-angular-app
Browse files Browse the repository at this point in the history
feat: create CatFostering frontend
  • Loading branch information
getlarge authored Jun 27, 2024
2 parents e177066 + 90fc5b6 commit ea7f8ac
Show file tree
Hide file tree
Showing 182 changed files with 15,816 additions and 3,172 deletions.
11 changes: 8 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
# example@v0
BACKEND_DOCKER_HOST="http://host.docker.internal:3000"
BACKEND_HOST="http://127.0.0.1:3000"
FRONTEND_HOST="http://127.0.0.1:4200"
KRATOS_PUBLIC_HOST="http://127.0.0.1:4433"
SELF_SERVICE_UI_HOST="http://127.0.0.1:4455"
ORY_ACTION_API_KEY="unsecure_api_key"
ORY_COOKIE_DOMAIN="127.0.0.1"
KRATOS_BROWSER_URL="${KRATOS_PUBLIC_HOST}"

kratos_log_level="trace"
kratos_dsn="memory"
kratos_cookies_domain="${ORY_COOKIE_DOMAIN}"
kratos_identity_schemas_default="file:///etc/config/kratos/identity.schema.json"
kratos_selfservice_default_browser_return_url="${BACKEND_HOST}/"
kratos_selfservice_allowed_return_urls="${BACKEND_HOST}, ${SELF_SERVICE_UI_HOST}"
kratos_selfservice_default_browser_return_url="${FRONTEND_HOST}/"
kratos_selfservice_allowed_return_urls="${FRONTEND_HOST}, ${BACKEND_HOST}, ${SELF_SERVICE_UI_HOST}"
kratos_selfservice_flows_errors_ui_url="${SELF_SERVICE_UI_HOST}/error"
kratos_selfservice_flows_settings_ui_url="${SELF_SERVICE_UI_HOST}/settings"
kratos_selfservice_flows_login_ui_url="${SELF_SERVICE_UI_HOST}/login"
kratos_selfservice_flows_registration_ui_url="${SELF_SERVICE_UI_HOST}/register"
kratos_selfservice_flows_recovery_ui_url="${SELF_SERVICE_UI_HOST}/recovery"
kratos_selfservice_flows_verification_ui_url="${SELF_SERVICE_UI_HOST}/verification"
kratos_selfservice_flows_login_default_browser_return_url="${FRONTEND_HOST}/"
kratos_selfservice_flows_login_after_hook_config_url="${BACKEND_DOCKER_HOST}/api/users/on-sign-in"
kratos_selfservice_flows_login_after_hook_config_auth_config_value="${ORY_ACTION_API_KEY}"
kratos_selfservice_flows_login_after_hook_config_body="file:///etc/config/kratos/after-webhook.jsonnet"
kratos_selfservice_flows_login_after_hook_config_can_interrupt="true"
kratos_selfservice_flows_login_after_hook_config_response_ignore="false"
kratos_selfservice_flows_login_after_hook_config_response_parse="false"
kratos_selfservice_flows_logout_default_browser_return_url="${FRONTEND_HOST}/"
kratos_selfservice_flows_registration_after_hook_config_url="${BACKEND_DOCKER_HOST}/api/users/on-sign-up"
kratos_selfservice_flows_registration_after_hook_config_auth_config_value="${ORY_ACTION_API_KEY}"
kratos_selfservice_flows_registration_after_hook_config_body="file:///etc/config/kratos/after-webhook.jsonnet"
Expand All @@ -39,7 +44,7 @@ kratos_secrets_cipher="32-LONG-SECRET-NOT-SECURE-AT-ALL"
kratos_serve_admin_base_url="http://kratos:4434/"
kratos_serve_public_base_url="${KRATOS_PUBLIC_HOST}/"
kratos_serve_public_cors_enabled="true"
kratos_serve_public_cors_allowed_origins="${KRATOS_PUBLIC_HOST}, ${SELF_SERVICE_UI_HOST}, ${BACKEND_HOST}"
kratos_serve_public_cors_allowed_origins="${KRATOS_PUBLIC_HOST}, ${SELF_SERVICE_UI_HOST}, ${FRONTEND_HOST}, ${BACKEND_HOST}"
kratos_session_cookie_domain="${ORY_COOKIE_DOMAIN}"
keto_dsn="memory"
Keto_log_level="trace"
Expand Down
68 changes: 62 additions & 6 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"type:api",
"type:const",
"type:core",
"type:data-access",
"type:env",
"type:ui",
"type:utils",
"type:testing"
]
Expand Down Expand Up @@ -46,6 +48,16 @@
"sourceTag": "type:const",
"onlyDependOnLibsWithTags": ["type:const"]
},
{
"sourceTag": "type:data-access",
"onlyDependOnLibsWithTags": [
"type:const",
"type:core",
"type:data-access",
"type:env",
"type:utils"
]
},
{
"sourceTag": "type:env",
"onlyDependOnLibsWithTags": ["type:const", "type:env"]
Expand All @@ -58,6 +70,16 @@
"type:utils"
]
},
{
"sourceTag": "type:ui",
"onlyDependOnLibsWithTags": [
"type:const",
"type:core",
"type:data-access",
"type:env",
"type:utils"
]
},
{
"sourceTag": "type:utils",
"onlyDependOnLibsWithTags": [
Expand All @@ -68,11 +90,19 @@
},
{
"sourceTag": "scope:catprofile",
"onlyDependOnLibsWithTags": ["scope:shared", "scope:catprofile"]
"onlyDependOnLibsWithTags": [
"scope:shared",
"scope:catprofile",
"scope:user"
]
},
{
"sourceTag": "scope:fostering",
"onlyDependOnLibsWithTags": ["scope:shared", "scope:fostering"]
"onlyDependOnLibsWithTags": [
"scope:shared",
"scope:fostering",
"scope:user"
]
},
{
"sourceTag": "scope:user",
Expand All @@ -84,12 +114,20 @@
"platform:node",
"platform:shared"
],
"bannedExternalImports": []
"bannedExternalImports": ["*angular*"]
},
{
"sourceTag": "platform:angular",
"onlyDependOnLibsWithTags": [
"platform:angular",
"platform:shared"
],
"bannedExternalImports": ["*nestjs*"]
},
{
"sourceTag": "platform:shared",
"onlyDependOnLibsWithTags": ["platform:shared"],
"bannedExternalImports": ["*nestjs*"]
"bannedExternalImports": ["*angular*", "*nestjs*"]
},
{
"sourceTag": "platform:cli",
Expand Down Expand Up @@ -119,7 +157,16 @@
"simple-import-sort/imports": [
"error",
{
"groups": [["^\\u0000"], ["^@?\\w"], ["^"], ["^\\."]]
"groups": [
// Side effects.
["^\\u0000"],
// 3rd party.
["^@?\\w"],
// Anything not fitting group above.
["^"],
// Relative imports.
["^\\."]
]
}
],
"simple-import-sort/exports": "error",
Expand All @@ -146,7 +193,16 @@
"simple-import-sort/imports": [
"error",
{
"groups": [["^\\u0000"], ["^@?\\w"], ["^"], ["^\\."]]
"groups": [
// Side effects.
["^\\u0000"],
// 3rd party.
["^@?\\w"],
// Anything not fitting group above.
["^"],
// Relative imports.
["^\\."]
]
}
],
"simple-import-sort/exports": "error",
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,9 @@ jobs:
with:
fetch-depth: 0

# TODO: ensure vars are shared with agents --with-env-vars="auto"

# --require-explicit-completion because Nx agents might not receive tasks for more than 30 seconds when preparing the e2e test environment
# @see https://nx.dev/ci/troubleshooting/ci-execution-failed#the-nx-cloud-heartbeat-process-failed-to-report-its-status-in-time
- run: npx nx-cloud start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="e2e-ci" --require-explicit-completion
- run: npx nx-cloud start-ci-run --distribute-on="3 linux-small-js" --stop-agents-after="e2e-ci" --require-explicit-completion --with-env-vars="DOTENV_PRIVATE_KEY_CI,POSTGRES_DB,POSTGRES_URL"
if: ${{ env.NX_CLOUD_DISTRIBUTED_EXECUTION == 'true' }}

- uses: actions/setup-node@v4
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ node_modules
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/thunder-tests
.vscode/thunder-tests/environments

# misc
/.sass-cache
Expand All @@ -49,3 +50,5 @@ Thumbs.db
!.env.project
!.env.vault
!.env.ci

.angular
50 changes: 50 additions & 0 deletions .nx/workflows/agents.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
launch-templates:
custom-linux-small-js:
resource-class: 'docker_linux_amd64/small'
image: 'ubuntu22.04-node20.11-v7'
init-steps:
- name: Checkout
uses: 'nrwl/nx-cloud-workflows/v4/workflow-steps/checkout/main.yaml'

- name: Restore Node Modules Cache
uses: 'nrwl/nx-cloud-workflows/v4/workflow-steps/cache/main.yaml'
inputs:
key: 'package-lock.json|yarn.lock|pnpm-lock.yaml'
paths: 'node_modules'
base-branch: 'main'

- name: Restore Browser Binary Cache
uses: 'nrwl/nx-cloud-workflows/v4/workflow-steps/cache/main.yaml'
inputs:
key: 'package-lock.json|yarn.lock|pnpm-lock.yaml|"browsers"'
paths: |
'../.cache/Cypress'
'../.cache/ms-playwright'
base-branch: 'main'

- name: Install Node Modules
uses: 'nrwl/nx-cloud-workflows/v4/workflow-steps/install-node-modules/main.yaml'

- name: Install Browsers (if needed)
uses: 'nrwl/nx-cloud-workflows/v4/workflow-steps/install-browsers/main.yaml'

- name: Generate Ory Configuration
script: |
npm run ory:generate:kratos -- -e .env.ci
npm run ory:generate:keto -- -e .env.ci
- name: Build Docker Image
script: npx nx run cat-fostering-api:docker-build --no-agents

# !BLOCKER: it is not possible to install Docker in Nx agents at the moment, see https://github.com/nrwl/nx-cloud-workflows/issues/52

# can't use --wait --wait-timeout N options since Keto and Kratos migrate containers will exit before the Keto and Kratos services are ready
- name: Start Docker Compose
script: npx @dotenvx/dotenvx run -- docker compose --profile ci -p cat-fostering up -d

- script: sleep 10

# - script: |
# npx nx-cloud record -- docker ps
# npx nx-cloud record -- docker compose -p cat-fostering logs keto -n 500
# npx nx-cloud record -- docker compose -p cat-fostering logs kratos -n 500
5 changes: 4 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
/dist
/coverage
/.nx/cache
/.nx/workspace-data
/.nx/workspace-data
.angular
infra/ory-kratos/kratos-template.yaml
infra/ory-keto/keto-template.yaml
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"recommendations": [
"nrwl.angular-console",
"esbenp.prettier-vscode",
"firsttris.vscode-jest-runner"
"firsttris.vscode-jest-runner",
"ms-playwright.playwright"
]
}
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"yaml.schemas": {
"https://raw.githubusercontent.com/ory/kratos/master/.schema/version.schema.json": [
".kratos.yaml"
]
}
}
Loading

0 comments on commit ea7f8ac

Please sign in to comment.