-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #376 from secretarium/chore/pda-front-dev
feat: Adding PDA base implementation
- Loading branch information
Showing
137 changed files
with
4,689 additions
and
559 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
{ | ||
"recommendations": [ | ||
"nrwl.angular-console", | ||
"esbenp.prettier-vscode", | ||
"dbaeumer.vscode-eslint", | ||
"firsttris.vscode-jest-runner" | ||
"firsttris.vscode-jest-runner", | ||
"ms-playwright.playwright" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
import { StrictMode } from 'react'; | ||
import * as ReactDOM from 'react-dom'; | ||
import { createRoot } from 'react-dom/client'; | ||
import { BrowserRouter } from 'react-router-dom'; | ||
|
||
import { DevtoolMainPanel } from './app/DevtoolMainPanel'; | ||
|
||
const containerElement = document.getElementById('root'); | ||
const applicationElement = ( | ||
<StrictMode> | ||
<BrowserRouter> | ||
<DevtoolMainPanel /> | ||
</BrowserRouter> | ||
</StrictMode> | ||
); | ||
|
||
const container = (ReactDOM as any).createRoot(containerElement); | ||
container.render(applicationElement); | ||
const rootElement = document.getElementById('root'); | ||
if (rootElement && !rootElement?.innerHTML) { | ||
const root = createRoot(rootElement); | ||
root.render( | ||
<StrictMode> | ||
<BrowserRouter> | ||
<DevtoolMainPanel /> | ||
</BrowserRouter> | ||
</StrictMode> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"extends": [ | ||
"../../.eslintrc.cjs" | ||
], | ||
"ignorePatterns": [ | ||
"!**/*" | ||
], | ||
"overrides": [ | ||
{ | ||
"files": [ | ||
"*.ts", | ||
"*.tsx", | ||
"*.js", | ||
"*.jsx" | ||
], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": [ | ||
"*.ts", | ||
"*.tsx" | ||
], | ||
"parserOptions": { | ||
"project": [ | ||
"apps/pda-back-e2e/tsconfig.*?.json" | ||
] | ||
}, | ||
"rules": {} | ||
}, | ||
{ | ||
"files": [ | ||
"*.js", | ||
"*.jsx" | ||
], | ||
"rules": {} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* eslint-disable */ | ||
export default { | ||
displayName: 'pda-back-e2e', | ||
preset: '../../jest.preset.cjs', | ||
globalSetup: '<rootDir>/src/support/global-setup.ts', | ||
globalTeardown: '<rootDir>/src/support/global-teardown.ts', | ||
setupFiles: ['<rootDir>/src/support/test-setup.ts'], | ||
testEnvironment: 'node', | ||
transform: { | ||
'^.+\\.[tj]s$': [ | ||
'ts-jest', | ||
{ | ||
tsconfig: '<rootDir>/tsconfig.e2e.json', | ||
}, | ||
], | ||
}, | ||
moduleFileExtensions: ['ts', 'js', 'html'], | ||
coverageDirectory: '../../coverage/pda-back-e2e', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "pda-back-e2e", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"projectType": "application", | ||
"implicitDependencies": [ | ||
"pda-back" | ||
], | ||
"targets": { | ||
"e2e": { | ||
"executor": "@nx/jest:jest", | ||
"outputs": [ | ||
"{workspaceRoot}/coverage/{e2eProjectRoot}" | ||
], | ||
"options": { | ||
"jestConfig": "apps/pda-back-e2e/jest.config.ts", | ||
"passWithNoTests": true | ||
} | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
apps/pda-back-e2e/src/secretarium-fido/secretarium-fido.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import axios from 'axios'; | ||
|
||
describe('GET /', () => { | ||
it('should return a message', async () => { | ||
const res = await axios.get('/ping').catch((err) => { | ||
console.error(err); | ||
}); | ||
|
||
if (!res) { | ||
throw new Error('No response'); | ||
} | ||
|
||
expect(res.status).toBe(200); | ||
expect(res.data).toEqual({ pong: true }); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import axios from 'axios'; | ||
import { exec, ChildProcess } from 'node:child_process'; | ||
// import axios from 'axios'; | ||
|
||
declare global { | ||
// eslint-disable-next-line no-var | ||
var __RUNNING_BACKEND__: ChildProcess | undefined; | ||
} | ||
|
||
export default async function () { | ||
// Start services that that the app needs to run (e.g. database, docker-compose, etc.). | ||
console.log('\nStarting up the backend...\n'); | ||
console.log(process.cwd()); | ||
|
||
let shouldPrintProcessOutput = true; | ||
globalThis.__RUNNING_BACKEND__ = exec('yarn nx serve pda-back --configuration=production --watch=false'); | ||
globalThis.__RUNNING_BACKEND__.on('error', (err) => { | ||
console.error(err); | ||
}); | ||
globalThis.__RUNNING_BACKEND__.stdout?.on('data', (data) => { | ||
if (data.includes('listening at')) | ||
shouldPrintProcessOutput = false; | ||
if (shouldPrintProcessOutput) | ||
console.log(data); | ||
}); | ||
|
||
// Start the webserver and wait until it responds | ||
await new Promise<void>((resolve, reject) => { | ||
(async () => { | ||
const sleep = async () => new Promise(r => setTimeout(r, 5000)); | ||
let count = 0; | ||
while (count < 10) { | ||
await sleep(); | ||
try { | ||
await axios.get('http://localhost:3000/ping').then((result) => { | ||
axios.defaults.baseURL = 'http://localhost:3000'; | ||
console.log('Backend is up and running'); | ||
console.log(result.data); | ||
if (result.status === 200) | ||
resolve(); | ||
}); | ||
} catch (e) { | ||
if (e instanceof Error) | ||
e.message.substring(0, 0); | ||
if (count === 5) | ||
console.log('Waiting for the backend to start...'); | ||
} | ||
count++; | ||
} | ||
reject('Backend did not start in time'); | ||
})().catch(reject); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export default async function () { | ||
// Put clean up logic here (e.g. stopping services, docker-compose, etc.). | ||
// Hint: `globalThis` is shared between setup and teardown. | ||
globalThis.__RUNNING_BACKEND__?.kill(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import axios from 'axios'; | ||
|
||
const host = process.env.HOST ?? 'localhost'; | ||
const port = process.env.PORT ?? '3000'; | ||
axios.defaults.baseURL = `http://${host}:${port}`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../dist/out-tsc", | ||
"types": [ | ||
"jest", | ||
"node" | ||
] | ||
}, | ||
"include": [ | ||
"jest.config.ts", | ||
"src/**/*.ts" | ||
] | ||
} |
Oops, something went wrong.