-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
50 changed files
with
3,472 additions
and
270 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"extends": ["plugin:cypress/recommended", "../../.eslintrc.json"], | ||
"ignorePatterns": ["!**/*"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["src/plugins/index.js"], | ||
"rules": { | ||
"@typescript-eslint/no-var-requires": "off", | ||
"no-undef": "off" | ||
} | ||
} | ||
] | ||
} |
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,8 @@ | ||
import { defineConfig } from 'cypress' | ||
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset' | ||
|
||
export default defineConfig({ | ||
e2e: nxE2EPreset(__dirname, { | ||
bundler: 'vite', | ||
}), | ||
}) |
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,30 @@ | ||
{ | ||
"name": "my-app-e2e", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "apps/my-app-e2e/src", | ||
"projectType": "application", | ||
"targets": { | ||
"e2e": { | ||
"executor": "@nrwl/cypress:cypress", | ||
"options": { | ||
"cypressConfig": "apps/my-app-e2e/cypress.config.ts", | ||
"devServerTarget": "my-app:serve:development", | ||
"testingType": "e2e" | ||
}, | ||
"configurations": { | ||
"production": { | ||
"devServerTarget": "my-app:serve:production" | ||
} | ||
} | ||
}, | ||
"lint": { | ||
"executor": "@nrwl/linter:eslint", | ||
"outputs": ["{options.outputFile}"], | ||
"options": { | ||
"lintFilePatterns": ["apps/my-app-e2e/**/*.{js,ts}"] | ||
} | ||
} | ||
}, | ||
"tags": [], | ||
"implicitDependencies": ["my-app"] | ||
} |
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,13 @@ | ||
import { getGreeting } from '../support/app.po' | ||
|
||
describe('my-app', () => { | ||
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 my-app') | ||
}) | ||
}) |
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,4 @@ | ||
{ | ||
"name": "Using fixtures to represent data", | ||
"email": "[email protected]" | ||
} |
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 @@ | ||
export const getGreeting = () => cy.get('h1') |
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,33 @@ | ||
// *********************************************** | ||
// This example commands.js 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) => { ... }) |
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,17 @@ | ||
// *********************************************************** | ||
// This example support/index.js 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.js using ES2015 syntax: | ||
import './commands' |
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,10 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"sourceMap": false, | ||
"outDir": "../../dist/out-tsc", | ||
"allowJs": true, | ||
"types": ["cypress", "node"] | ||
}, | ||
"include": ["src/**/*.ts", "src/**/*.js", "cypress.config.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,18 @@ | ||
{ | ||
"extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], | ||
"ignorePatterns": ["!**/*"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"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,15 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>MyApp</title> | ||
<base href="/" /> | ||
|
||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<link rel="icon" type="image/x-icon" href="/favicon.ico" /> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/main.tsx"></script> | ||
</body> | ||
</html> |
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,123 @@ | ||
{ | ||
"name": "my-app", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "apps/my-app/src", | ||
"projectType": "application", | ||
"targets": { | ||
"build": { | ||
"executor": "@nrwl/vite:build", | ||
"outputs": ["{options.outputPath}"], | ||
"defaultConfiguration": "production", | ||
"options": { | ||
"outputPath": "dist/apps/my-app/browser" | ||
}, | ||
"configurations": { | ||
"development": { | ||
"mode": "development" | ||
}, | ||
"production": { | ||
"mode": "production" | ||
} | ||
} | ||
}, | ||
"serve": { | ||
"executor": "@nrwl/webpack:ssr-dev-server", | ||
"defaultConfiguration": "development", | ||
"options": { | ||
"browserTarget": "my-app:build:development", | ||
"serverTarget": "my-app:serve-server:development", | ||
"port": 4200, | ||
"browserTargetOptions": { | ||
"watch": true | ||
} | ||
}, | ||
"configurations": { | ||
"development": {}, | ||
"production": { | ||
"browserTarget": "my-app:build:production", | ||
"serverTarget": "my-app:serve-server:production" | ||
} | ||
} | ||
}, | ||
"test": { | ||
"executor": "@nrwl/vite:test", | ||
"outputs": ["coverage/apps/my-app"], | ||
"options": { | ||
"passWithNoTests": true, | ||
"reportsDirectory": "../../coverage/apps/my-app" | ||
} | ||
}, | ||
"lint": { | ||
"executor": "@nrwl/linter:eslint", | ||
"outputs": ["{options.outputFile}"], | ||
"options": { | ||
"lintFilePatterns": ["apps/my-app/**/*.{ts,tsx,js,jsx}"] | ||
} | ||
}, | ||
"server": { | ||
"dependsOn": ["build"], | ||
"executor": "@nrwl/webpack:webpack", | ||
"outputs": ["{options.outputPath}"], | ||
"defaultConfiguration": "production", | ||
"options": { | ||
"target": "node", | ||
"main": "apps/my-app/server.ts", | ||
"outputPath": "dist/apps/my-app/server", | ||
"tsConfig": "apps/my-app/tsconfig.server.json", | ||
"compiler": "babel", | ||
"externalDependencies": "all", | ||
"outputHashing": "none", | ||
"webpackConfig": "apps/my-app/webpack.config.js" | ||
}, | ||
"configurations": { | ||
"development": { | ||
"optimization": false, | ||
"sourceMap": true | ||
}, | ||
"production": { | ||
"fileReplacements": [ | ||
{ | ||
"replace": "apps/my-app/src/environments/environment.ts", | ||
"with": "apps/my-app/src/environments/environment.prod.ts" | ||
} | ||
], | ||
"sourceMap": false | ||
} | ||
} | ||
}, | ||
"serve-browser": { | ||
"executor": "@nrwl/vite:dev-server", | ||
"defaultConfiguration": "development", | ||
"options": { | ||
"buildTarget": "my-app:build" | ||
}, | ||
"configurations": { | ||
"development": { | ||
"buildTarget": "my-app:build:development", | ||
"hmr": true | ||
}, | ||
"production": { | ||
"buildTarget": "my-app:build:production", | ||
"hmr": false | ||
} | ||
} | ||
}, | ||
"serve-server": { | ||
"executor": "@nrwl/js:node", | ||
"defaultConfiguration": "development", | ||
"options": { | ||
"buildTarget": "my-app:server:development", | ||
"buildTargetOptions": { | ||
"watch": true | ||
} | ||
}, | ||
"configurations": { | ||
"development": {}, | ||
"production": { | ||
"buildTarget": "my-app:server:production" | ||
} | ||
} | ||
} | ||
}, | ||
"tags": [] | ||
} |
Binary file not shown.
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,29 @@ | ||
import * as path from 'path' | ||
|
||
import cors from 'cors' | ||
import express from 'express' | ||
|
||
import { handleRequest } from './src/main.server' | ||
|
||
const port = process.env['PORT'] || 4200 | ||
const app = express() | ||
|
||
const browserDist = path.join(process.cwd(), 'dist/apps/my-app/browser') | ||
const indexPath = path.join(browserDist, 'index.html') | ||
|
||
app.use(cors()) | ||
|
||
app.get( | ||
'*.*', | ||
express.static(browserDist, { | ||
maxAge: '1y', | ||
}), | ||
) | ||
|
||
app.use('*', handleRequest(indexPath)) | ||
|
||
const server = app.listen(port, () => { | ||
// Server has started | ||
}) | ||
|
||
server.on('error', console.error) |
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,15 @@ | ||
import { render } from '@testing-library/react' | ||
|
||
import App from './app' | ||
|
||
describe('App', () => { | ||
it('should render successfully', () => { | ||
const { baseElement } = render(<App />) | ||
expect(baseElement).toBeTruthy() | ||
}) | ||
|
||
it('should have a greeting as the title', () => { | ||
const { getByText } = render(<App />) | ||
expect(getByText(/Welcome my-app/gi)).toBeTruthy() | ||
}) | ||
}) |
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,12 @@ | ||
import NxWelcome from './nx-welcome' | ||
|
||
export function App() { | ||
return ( | ||
<> | ||
<NxWelcome title="my-app" /> | ||
<div /> | ||
</> | ||
) | ||
} | ||
|
||
export default App |
Oops, something went wrong.