Skip to content

Commit 52c4ba5

Browse files
committed
refactor(home): generate new home app and align settings with datahub app
1 parent 5ac9b22 commit 52c4ba5

29 files changed

+1342
-0
lines changed

apps/home-e2e/.eslintrc.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": ["plugin:cypress/recommended", "../../.eslintrc.json"],
3+
"ignorePatterns": ["!**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7+
"rules": {}
8+
}
9+
]
10+
}

apps/home-e2e/cypress.config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset'
2+
3+
import { defineConfig } from 'cypress'
4+
5+
export default defineConfig({
6+
e2e: {
7+
...nxE2EPreset(__filename, { cypressDir: 'src' }),
8+
baseUrl: 'http://localhost:4200',
9+
},
10+
})

apps/home-e2e/project.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "home-e2e",
3+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
4+
"projectType": "application",
5+
"sourceRoot": "apps/home-e2e/src",
6+
"targets": {
7+
"e2e": {
8+
"executor": "@nx/cypress:cypress",
9+
"options": {
10+
"cypressConfig": "apps/home-e2e/cypress.config.ts",
11+
"testingType": "e2e",
12+
"devServerTarget": "home:serve:development"
13+
},
14+
"configurations": {
15+
"production": {
16+
"devServerTarget": "home:serve:production"
17+
},
18+
"ci": {
19+
"devServerTarget": "home:serve-static"
20+
}
21+
}
22+
},
23+
"lint": {
24+
"executor": "@nx/eslint:lint",
25+
"outputs": ["{options.outputFile}"]
26+
}
27+
},
28+
"tags": [],
29+
"implicitDependencies": ["home"]
30+
}

apps/home-e2e/src/e2e/app.cy.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { getGreeting } from '../support/app.po'
2+
3+
describe('home-e2e', () => {
4+
beforeEach(() => cy.visit('/'))
5+
6+
it('should display welcome message', () => {
7+
// Custom command example, see `../support/commands.ts` file
8+
cy.login('[email protected]', 'myPassword')
9+
10+
// Function helper example, see `../support/app.po.ts` file
11+
getGreeting().contains(/Welcome/)
12+
})
13+
})
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "Using fixtures to represent data",
3+
"email": "[email protected]",
4+
"body": "Fixtures are a great way to mock data for responses to routes"
5+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const getGreeting = () => cy.get('h1')
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/// <reference types="cypress" />
2+
3+
// ***********************************************
4+
// This example commands.ts shows you how to
5+
// create various custom commands and overwrite
6+
// existing commands.
7+
//
8+
// For more comprehensive examples of custom
9+
// commands please read more here:
10+
// https://on.cypress.io/custom-commands
11+
// ***********************************************
12+
13+
// eslint-disable-next-line @typescript-eslint/no-namespace
14+
declare namespace Cypress {
15+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
16+
interface Chainable<Subject> {
17+
login(email: string, password: string): void
18+
}
19+
}
20+
21+
// -- This is a parent command --
22+
Cypress.Commands.add('login', (email, password) => {
23+
console.log('Custom command example: Login', email, password)
24+
})
25+
//
26+
// -- This is a child command --
27+
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
28+
//
29+
//
30+
// -- This is a dual command --
31+
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
32+
//
33+
//
34+
// -- This will overwrite an existing command --
35+
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })

apps/home-e2e/src/support/e2e.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// ***********************************************************
2+
// This example support/e2e.ts is processed and
3+
// loaded automatically before your test files.
4+
//
5+
// This is a great place to put global configuration and
6+
// behavior that modifies Cypress.
7+
//
8+
// You can change the location of this file or turn off
9+
// automatically serving support files with the
10+
// 'supportFile' configuration option.
11+
//
12+
// You can read more here:
13+
// https://on.cypress.io/configuration
14+
// ***********************************************************
15+
16+
// Import commands.ts using ES2015 syntax:
17+
import './commands'

apps/home-e2e/tsconfig.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"extends": "../../tsconfig.base.json",
3+
"compilerOptions": {
4+
"allowJs": true,
5+
"outDir": "../../dist/out-tsc",
6+
"module": "commonjs",
7+
"types": ["cypress", "node"],
8+
"sourceMap": false,
9+
"forceConsistentCasingInFileNames": true,
10+
"strict": true,
11+
"noImplicitOverride": true,
12+
"noPropertyAccessFromIndexSignature": true,
13+
"noImplicitReturns": true,
14+
"noFallthroughCasesInSwitch": true
15+
},
16+
"include": [
17+
"**/*.ts",
18+
"**/*.js",
19+
"cypress.config.ts",
20+
"**/*.cy.ts",
21+
"**/*.cy.js",
22+
"**/*.d.ts"
23+
]
24+
}

apps/home/.eslintrc.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"extends": ["../../.eslintrc.json"],
3+
"ignorePatterns": ["!**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts"],
7+
"extends": [
8+
"plugin:@nx/angular",
9+
"plugin:@angular-eslint/template/process-inline-templates"
10+
],
11+
"rules": {
12+
"@angular-eslint/directive-selector": [
13+
"error",
14+
{
15+
"type": "attribute",
16+
"prefix": "melDataplatform",
17+
"style": "camelCase"
18+
}
19+
],
20+
"@angular-eslint/component-selector": [
21+
"error",
22+
{
23+
"type": "element",
24+
"prefix": "mel-datahub",
25+
"style": "kebab-case"
26+
}
27+
]
28+
}
29+
},
30+
{
31+
"files": ["*.html"],
32+
"extends": ["plugin:@nx/angular-template"],
33+
"rules": {}
34+
}
35+
]
36+
}

0 commit comments

Comments
 (0)