Skip to content

Commit

Permalink
add init struct
Browse files Browse the repository at this point in the history
  • Loading branch information
YvannPONCE committed Sep 16, 2024
1 parent e02a034 commit bc47224
Show file tree
Hide file tree
Showing 52 changed files with 2,486 additions and 0 deletions.
10 changes: 10 additions & 0 deletions apps/frontend-bff-e2e/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": ["plugin:cypress/recommended", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
}
]
}
19 changes: 19 additions & 0 deletions apps/frontend-bff-e2e/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';

import { defineConfig } from 'cypress';

export default defineConfig({
e2e: {
...nxE2EPreset(__filename, {
cypressDir: 'src',
bundler: 'vite',
webServerCommands: {
default: 'npx nx run frontend-bff:serve',
production: 'npx nx run frontend-bff:preview',
},
ciWebServerCommand: 'npx nx run frontend-bff:preview',
ciBaseUrl: 'http://localhost:4300',
}),
baseUrl: 'http://localhost:4200',
},
});
10 changes: 10 additions & 0 deletions apps/frontend-bff-e2e/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "frontend-bff-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"sourceRoot": "apps/frontend-bff-e2e/src",
"tags": [],
"implicitDependencies": ["frontend-bff"],
"// targets": "to see all targets run: nx show project frontend-bff-e2e --web",
"targets": {}
}
13 changes: 13 additions & 0 deletions apps/frontend-bff-e2e/src/e2e/app.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { getGreeting } from '../support/app.po';

describe('frontend-bff-e2e', () => {
beforeEach(() => cy.visit('/'));

it('should display welcome message', () => {
// Custom command example, see `../support/commands.ts` file
cy.login('[email protected]', 'myPassword');

// Function helper example, see `../support/app.po.ts` file
getGreeting().contains(/Welcome/);
});
});
5 changes: 5 additions & 0 deletions apps/frontend-bff-e2e/src/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "[email protected]",
"body": "Fixtures are a great way to mock data for responses to routes"
}
1 change: 1 addition & 0 deletions apps/frontend-bff-e2e/src/support/app.po.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const getGreeting = () => cy.get('h1');
35 changes: 35 additions & 0 deletions apps/frontend-bff-e2e/src/support/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/// <reference types="cypress" />

// ***********************************************
// This example commands.ts shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************

// eslint-disable-next-line @typescript-eslint/no-namespace
declare namespace Cypress {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
interface Chainable<Subject> {
login(email: string, password: string): void;
}
}

// -- This is a parent command --
Cypress.Commands.add('login', (email, password) => {
console.log('Custom command example: Login', email, password);
});
//
// -- This is a child command --
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
17 changes: 17 additions & 0 deletions apps/frontend-bff-e2e/src/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// ***********************************************************
// This example support/e2e.ts is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.ts using ES2015 syntax:
import './commands';
20 changes: 20 additions & 0 deletions apps/frontend-bff-e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"allowJs": true,
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["cypress", "node"],
"sourceMap": false
},
"include": [
"**/*.ts",
"**/*.js",
"cypress.config.ts",
"**/*.cy.ts",
"**/*.cy.tsx",
"**/*.cy.js",
"**/*.cy.jsx",
"**/*.d.ts"
]
}
18 changes: 18 additions & 0 deletions apps/frontend-bff/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["plugin:@nx/react", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
File renamed without changes.
16 changes: 16 additions & 0 deletions apps/frontend-bff/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>FrontendBff</title>
<base href="/" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<link rel="stylesheet" href="/src/styles.css" />
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
11 changes: 11 additions & 0 deletions apps/frontend-bff/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* eslint-disable */
export default {
displayName: 'frontend-bff',
preset: '../../jest.preset.js',
transform: {
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }],
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/apps/frontend-bff',
};
9 changes: 9 additions & 0 deletions apps/frontend-bff/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "frontend-bff",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/frontend-bff/src",
"projectType": "application",
"tags": [],
"// targets": "to see all targets run: nx show project frontend-bff --web",
"targets": {}
}
Binary file added apps/frontend-bff/public/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions apps/frontend-bff/src/app/app.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* Your styles goes here. */
25 changes: 25 additions & 0 deletions apps/frontend-bff/src/app/app.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { render } from '@testing-library/react';

import { BrowserRouter } from 'react-router-dom';

import App from './app';

describe('App', () => {
it('should render successfully', () => {
const { baseElement } = render(
<BrowserRouter>
<App />
</BrowserRouter>
);
expect(baseElement).toBeTruthy();
});

it('should have a greeting as the title', () => {
const { getByText } = render(
<BrowserRouter>
<App />
</BrowserRouter>
);
expect(getByText(/Welcome frontend-bff/gi)).toBeTruthy();
});
});
53 changes: 53 additions & 0 deletions apps/frontend-bff/src/app/app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import styles from './app.module.css';

import NxWelcome from './nx-welcome';

import { Route, Routes, Link } from 'react-router-dom';

export function App() {
return (
<div>
<NxWelcome title="frontend-bff" />

{/* START: routes */}
{/* These routes and navigation have been generated for you */}
{/* Feel free to move and update them to fit your needs */}
<br />
<hr />
<br />
<div role="navigation">
<ul>
<li>
<Link to="/">Home</Link>
</li>
<li>
<Link to="/page-2">Page 2</Link>
</li>
</ul>
</div>
<Routes>
<Route
path="/"
element={
<div>
This is the generated root route.{' '}
<Link to="/page-2">Click here for page 2.</Link>
</div>
}
/>
<Route
path="/page-2"
element={
<div>
<Link to="/">Click here to go back to root page.</Link>
</div>
}
/>
</Routes>
{/* END: routes */}
</div>
);
}

export default App;
Loading

0 comments on commit bc47224

Please sign in to comment.