Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/typescript-5.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
vygandas authored Oct 25, 2023
2 parents 4bbc32c + 22da7fc commit 67d7b03
Show file tree
Hide file tree
Showing 30 changed files with 2,703 additions and 89 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pr_affected_code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 19.x, 20.x]
node-version: [18.x, 20.x]
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -25,4 +25,4 @@ jobs:

- name: Run Affected Tests
shell: bash
run: npx nx affected --target=test --base=remotes/origin/main --head=HEAD
run: npx nx affected --target=test --base=remotes/origin/main --head=HEAD
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,9 @@ Thumbs.db

.env
.env.*
!.env.example
!.env.example

# Next.js
.next

documentation
17 changes: 9 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
args = `arg="$(filter-out $@,$(MAKECMDGOALS))" && echo $${arg:-${1}}`
ARGS = `arg="$(filter-out $@,$(MAKECMDGOALS))" && echo $${arg:-${1}}`
DOCKER_RUN_CMD = docker run -it --rm -u $(shell id -u):$(shell id -g) -v ./:/app --workdir="/app" --network="host"

# --- Initialization ---

Expand All @@ -8,24 +9,24 @@ devinit:
# --- Commands ---

npm:
docker run -it --rm -u $(shell id -u):$(shell id -g) -v ./:/app --workdir="/app" --entrypoint="npm" node-dev-env:latest $(call args,defaultstring)
$(call DOCKER_RUN_CMD) --entrypoint="npm" node-dev-env:latest $(call ARGS, defaultstring)

yarn:
docker run -it --rm -u $(shell id -u):$(shell id -g) -v ./:/app --workdir="/app" --entrypoint="yarn" node-dev-env:latest $(call args,defaultstring)
$(call DOCKER_RUN_CMD) --entrypoint="yarn" node-dev-env:latest $(call ARGS, defaultstring)

npx:
docker run -it --rm -u $(shell id -u):$(shell id -g) -v ./:/app --workdir="/app" --entrypoint="npx" node-dev-env:latest $(call args,defaultstring)
$(call DOCKER_RUN_CMD) --entrypoint="npx" node-dev-env:latest $(call ARGS, defaultstring)


nx:
docker run -it --rm -u $(shell id -u):$(shell id -g) -v ./:/app --workdir="/app" --entrypoint="nx" node-dev-env:latest $(call args,defaultstring)
$(call DOCKER_RUN_CMD) --entrypoint="nx" node-dev-env:latest $(call ARGS, defaultstring)

node:
docker run -it --rm -u $(shell id -u):$(shell id -g) -v ./:/app --workdir="/app" --entrypoint="node" node-dev-env:latest $(call args,defaultstring)
$(call DOCKER_RUN_CMD) --entrypoint="node" node-dev-env:latest $(call ARGS, defaultstring)

# --- Server stuff ---
serve-api:
docker run -it --rm -u $(shell id -u):$(shell id -g) --network="host" -v ./:/app --workdir="/app" --entrypoint="nx" node-dev-env:latest serve api
$(call DOCKER_RUN_CMD) --entrypoint="nx" node-dev-env:latest serve api

serve-platform:
docker run -it --rm -u $(shell id -u):$(shell id -g) --network="host" -v ./:/app --workdir="/app" --entrypoint="nx" node-dev-env:latest serve platform --verbose
$(call DOCKER_RUN_CMD) --entrypoint="nx" node-dev-env:latest serve platform --verbose
10 changes: 10 additions & 0 deletions apps/landing-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": {}
}
]
}
6 changes: 6 additions & 0 deletions apps/landing-e2e/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';

export default defineConfig({
e2e: nxE2EPreset(__dirname),
});
30 changes: 30 additions & 0 deletions apps/landing-e2e/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "landing-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/landing-e2e/src",
"projectType": "application",
"targets": {
"e2e": {
"executor": "@nx/cypress:cypress",
"options": {
"cypressConfig": "apps/landing-e2e/cypress.config.ts",
"devServerTarget": "landing:serve:development",
"testingType": "e2e"
},
"configurations": {
"production": {
"devServerTarget": "landing:serve:production"
}
}
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/landing-e2e/**/*.{js,ts}"]
}
}
},
"tags": [],
"implicitDependencies": ["landing"]
}
13 changes: 13 additions & 0 deletions apps/landing-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('landing', () => {
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 landing');
});
});
4 changes: 4 additions & 0 deletions apps/landing-e2e/src/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "Using fixtures to represent data",
"email": "[email protected]"
}
1 change: 1 addition & 0 deletions apps/landing-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');
33 changes: 33 additions & 0 deletions apps/landing-e2e/src/support/commands.ts
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) => { ... })
17 changes: 17 additions & 0 deletions apps/landing-e2e/src/support/e2e.ts
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';
10 changes: 10 additions & 0 deletions apps/landing-e2e/tsconfig.json
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"]
}
37 changes: 37 additions & 0 deletions apps/landing/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"extends": [
"plugin:@nx/react-typescript",
"next",
"next/core-web-vitals",
"../../.eslintrc.json"
],
"ignorePatterns": ["!**/*", ".next/**/*"],
"overrides": [
{
"files": ["*.*"],
"rules": {
"@next/next/no-html-link-for-pages": "off"
}
},
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@next/next/no-html-link-for-pages": ["error", "apps/landing/pages"]
}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"],
"env": {
"jest": true
}
}
]
}
3 changes: 3 additions & 0 deletions apps/landing/app/api/hello/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export async function GET(request: Request) {
return new Response('Hello, from API!');
}
Loading

0 comments on commit 67d7b03

Please sign in to comment.