diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml index 04b88b97..ee4ac567 100644 --- a/.github/workflows/deploy-staging.yml +++ b/.github/workflows/deploy-staging.yml @@ -33,3 +33,19 @@ jobs: - name: Deploy app run: | npm ci --force && npx nx deploy:staging envited.ascs.digital + DeployOIDCClient: + runs-on: ubuntu-latest + environment: staging + if: contains(github.ref, 'oidc-client') + steps: + - name: Git clone the repository + uses: actions/checkout@v3 + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: arn:aws:iam::597778497612:role/GitHub-Actions + role-duration-seconds: 900 + aws-region: eu-central-1 + - name: Deploy OIDC client + run: | + npm ci --force && npx nx deploy:staging oidc-client.ascs.digital diff --git a/apps/oidc-client/.eslintrc.js b/apps/oidc-client/.eslintrc.js deleted file mode 100644 index 12a3204e..00000000 --- a/apps/oidc-client/.eslintrc.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - parser: '@typescript-eslint/parser', - plugins: ['preact', '@typescript-eslint'], - extends: ['../../.eslintrc.json'], - ignorePatterns: ['!**/*', 'vite.config.ts'], - overrides: [ - { - files: ['*.ts', '*.js', '*.tsx'], - parserOptions: { - project: ['apps/oidc-client/tsconfig.*?.json'], - }, - rules: {}, - }, - { - files: ['*.ts', '*.tsx'], - rules: {}, - }, - { - files: ['*.js', '*.jsx'], - rules: {}, - }, - ], -} diff --git a/apps/oidc-client/.eslintrc.json b/apps/oidc-client/.eslintrc.json new file mode 100644 index 00000000..9d9c0db5 --- /dev/null +++ b/apps/oidc-client/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "extends": ["../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + } + ] +} diff --git a/apps/oidc-client/.gitignore b/apps/oidc-client/.gitignore new file mode 100644 index 00000000..37b9471a --- /dev/null +++ b/apps/oidc-client/.gitignore @@ -0,0 +1,15 @@ +# dependencies +node_modules + +# sst +.sst +.build + +# opennext +.open-next + +# misc +.DS_Store + +# local env files +.env*.local diff --git a/apps/oidc-client/.vscode/launch.json b/apps/oidc-client/.vscode/launch.json new file mode 100644 index 00000000..58b32d11 --- /dev/null +++ b/apps/oidc-client/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Debug SST Start", + "type": "node", + "request": "launch", + "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/sst", + "runtimeArgs": ["start", "--increase-timeout"], + "console": "integratedTerminal", + "skipFiles": ["/**"], + "env": {} + } + ] +} diff --git a/apps/oidc-client/.vscode/settings.json b/apps/oidc-client/.vscode/settings.json new file mode 100644 index 00000000..3b42f010 --- /dev/null +++ b/apps/oidc-client/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "search.exclude": { + "**/.sst": true + } +} diff --git a/apps/oidc-client/package.json b/apps/oidc-client/package.json index 54b6854a..d1b5f820 100644 --- a/apps/oidc-client/package.json +++ b/apps/oidc-client/package.json @@ -1,5 +1,5 @@ { "name": "oidc-client", - "version": "0.0.1", - "description": "Nx Preact oidc-client app" + "version": "0.0.0", + "private": true } diff --git a/apps/oidc-client/pnpm-workspace.yaml b/apps/oidc-client/pnpm-workspace.yaml new file mode 100644 index 00000000..5858666e --- /dev/null +++ b/apps/oidc-client/pnpm-workspace.yaml @@ -0,0 +1,2 @@ +packages: + - 'packages/**/*' diff --git a/apps/oidc-client/project.json b/apps/oidc-client/project.json index 0723ad56..e8b30f4e 100644 --- a/apps/oidc-client/project.json +++ b/apps/oidc-client/project.json @@ -63,6 +63,14 @@ "passWithNoTests": true, "reportsDirectory": "../../coverage/apps/oidc-client" } + }, + "deploy:staging": { + "executor": "nx:run-commands", + "options": { + "cwd": "apps/oidc-client", + "commands": ["sst deploy OIDCClient --stage staging"], + "parallel": false + } } } } diff --git a/apps/oidc-client/src/utils/utils.test.ts b/apps/oidc-client/src/utils/utils.test.ts index cacac80e..73c32daa 100644 --- a/apps/oidc-client/src/utils/utils.test.ts +++ b/apps/oidc-client/src/utils/utils.test.ts @@ -26,7 +26,7 @@ describe('src/utils', () => { const result = () => SUT.getOpenIdConnectUrl(params) - expect(result).toThrowError('Missing required parameters') + expect(result).toThrow('Missing required parameters') }) }) }) diff --git a/apps/oidc-client/sst.config.ts b/apps/oidc-client/sst.config.ts new file mode 100644 index 00000000..6fa346d5 --- /dev/null +++ b/apps/oidc-client/sst.config.ts @@ -0,0 +1,15 @@ +import { SSTConfig } from 'sst' + +import { OIDCClient } from './stacks/OIDCClient' + +export default { + config() { + return { + name: 'oidc-client', + region: 'eu-central-1', + } + }, + stacks(app) { + app.stack(OIDCClient) + }, +} satisfies SSTConfig diff --git a/apps/oidc-client/stacks/OIDCClient.ts b/apps/oidc-client/stacks/OIDCClient.ts new file mode 100644 index 00000000..1e1c2963 --- /dev/null +++ b/apps/oidc-client/stacks/OIDCClient.ts @@ -0,0 +1,10 @@ +import { StackContext, StaticSite } from 'sst/constructs' + +export function OIDCClient({ stack }: StackContext) { + new StaticSite(stack, 'oidc-client', { + path: './', + buildOutput: '../../dist/apps/oidc-client', + buildCommand: 'cd ../../ && npx nx build oidc-client --prod', + environment: {}, + }) +} diff --git a/apps/oidc-client/tsconfig.app.json b/apps/oidc-client/tsconfig.app.json index 6aefc15d..ed1b9945 100644 --- a/apps/oidc-client/tsconfig.app.json +++ b/apps/oidc-client/tsconfig.app.json @@ -1,10 +1,10 @@ { "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../dist/out-tsc" + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["node"] }, - - "include": ["src/**/*"], - "exclude": ["**/*.spec.ts", "**/*_spec.ts", "**/*.spec.tsx", "**/*_spec.tsx", "public/*"] + "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"], + "include": ["src/**/*.ts", "stacks/**/*.ts"] } diff --git a/apps/oidc-client/tsconfig.json b/apps/oidc-client/tsconfig.json index 80c535f9..91a86406 100644 --- a/apps/oidc-client/tsconfig.json +++ b/apps/oidc-client/tsconfig.json @@ -1,26 +1,8 @@ { "extends": "../../tsconfig.base.json", + "exclude": ["packages"], "compilerOptions": { - "strict": true, - "target": "ESNext", - "module": "ESNext", - "moduleResolution": "node", - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "jsx": "preserve", - "jsxFactory": "h", - "jsxFragmentFactory": "Fragment", - "jsxImportSource": "preact", - "types": ["vite/client"] - }, - "files": [], - "include": [], - "references": [ - { - "path": "./tsconfig.app.json" - }, - { - "path": "./tsconfig.spec.json" - } - ] + "module": "esnext", + "moduleResolution": "node" + } } diff --git a/apps/oidc-client/vite.config.ts b/apps/oidc-client/vite.config.ts index 93b71d92..161d85f6 100644 --- a/apps/oidc-client/vite.config.ts +++ b/apps/oidc-client/vite.config.ts @@ -1,7 +1,7 @@ /// import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin' import preact from '@preact/preset-vite' -import { defineConfig, searchForWorkspaceRoot } from 'vite' +import { defineConfig } from 'vite' export default defineConfig({ cacheDir: '../../node_modules/.vite/oidc-client',