Skip to content

Commit 2027d94

Browse files
feat: merge increment A - CI/CD and development infrastructure
- Update GitHub workflows with retry mechanisms and cache optimizations - Add cypress configuration for Next.js app router testing - Update project configurations for app router apps - Enhance cursor IDE rules and ignore patterns - Update root package.json with latest dependencies - Add enhanced package cursor rules 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 99f70ad commit 2027d94

File tree

10 files changed

+316
-49
lines changed

10 files changed

+316
-49
lines changed

.cursor/rules/running-tests.mdc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
description:
3+
globs: packages/enhanced/*
4+
alwaysApply: false
5+
---
6+
use pnpm enhanced:jest to test this

.cursorignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
**/.cache/
33
**/.temp/
44
**/coverage/
5-
**/dist/
5+
!**/dist/
66

77
# Explicitly ignore specific packages
88
packages/typescript/

.github/workflows/build-and-test.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,12 @@ jobs:
5555
- name: Print Number of CPU Cores
5656
run: nproc
5757

58-
- name: Warm Nx Cache
59-
run: npx nx run-many --targets=build --projects=tag:type:pkg --parallel=4
60-
6158
- name: Run Build for All
62-
run: npx nx run-many --targets=build --projects=tag:type:pkg --parallel=4 --skip-nx-cache
59+
uses: nick-fields/retry@v3
60+
with:
61+
max_attempts: 3
62+
timeout_minutes: 15
63+
command: npx nx run-many --targets=build --projects=tag:type:pkg --parallel=4
6364

6465
- name: Check Package Publishing Compatibility
6566
run: |
@@ -69,6 +70,7 @@ jobs:
6970
[ "$pkg" != "packages/chrome-devtools" ] && \
7071
[ "$pkg" != "packages/core" ] && \
7172
[ "$pkg" != "packages/esbuild" ] && \
73+
[ "$pkg" != "packages/modernjs" ] && \
7274
[ "$pkg" != "packages/utilities" ]; then
7375
echo "Checking $pkg..."
7476
npx publint "$pkg"

.github/workflows/release.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,18 @@ jobs:
4242
node-version: '18'
4343
cache: 'pnpm'
4444

45+
- name: Cache Browsers
46+
uses: actions/cache@v3
47+
id: browsers-cache
48+
with:
49+
path: |
50+
~/.cache/ms-playwright
51+
~/.cache/Cypress
52+
key: ${{ runner.os }}-browsers-${{ hashFiles('**/pnpm-lock.yaml') }}
53+
54+
- name: Set Nx SHA
55+
uses: nrwl/nx-set-shas@v3
56+
4557
- name: Install deps
4658
run: pnpm install
4759

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
2+
import { defineConfig } from 'cypress';
3+
import { execSync } from 'child_process';
4+
5+
export default defineConfig({
6+
projectId: 'next-app-router-4000',
7+
e2e: {
8+
...nxE2EPreset(__filename, { cypressDir: 'cypress' }),
9+
// Please ensure you use `cy.origin()` when navigating between domains and remove this option.
10+
// See https://docs.cypress.io/app/references/migration-guide#Changes-to-cyorigin
11+
injectDocumentDomain: true,
12+
setupNodeEvents(on, config) {
13+
// Kill servers when ALL tests are done (not after each test file)
14+
on('after:run', (results) => {
15+
console.log('🧹 All tests completed, cleaning up servers...');
16+
console.log(
17+
`📊 Test results: ${results.totalPassed} passed, ${results.totalFailed} failed`,
18+
);
19+
20+
try {
21+
console.log('🔪 Killing servers on ports 4000 and 4001...');
22+
execSync('npx kill-port 4000 4001', { stdio: 'inherit' });
23+
console.log('✅ Server cleanup completed successfully');
24+
} catch (error) {
25+
console.log(
26+
'⚠️ Error during server cleanup (servers may already be closed):',
27+
error.message,
28+
);
29+
}
30+
});
31+
32+
// Log when each spec starts (but don't kill servers)
33+
on('before:spec', (spec) => {
34+
console.log(`🚀 Starting spec: ${spec.name}`);
35+
});
36+
37+
// Log when each spec ends (but don't kill servers)
38+
on('after:spec', (spec, results) => {
39+
console.log(
40+
`✨ Completed spec: ${spec.name} - ${results.stats.passes} passed, ${results.stats.failures} failed`,
41+
);
42+
});
43+
},
44+
},
45+
defaultCommandTimeout: 20000,
46+
retries: {
47+
runMode: 2,
48+
openMode: 1,
49+
},
50+
});

apps/next-app-router/next-app-router-4000/project.json

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,10 @@
66
"tags": [],
77
"targets": {
88
"build": {
9-
"executor": "@nx/next:build",
10-
"defaultConfiguration": "production",
9+
"executor": "nx:run-commands",
1110
"options": {
12-
"outputPath": "apps/next-app-router-4000"
13-
},
14-
"configurations": {
15-
"development": {
16-
"outputPath": "apps/next-app-router-4000"
17-
},
18-
"production": {}
11+
"command": "npm run build",
12+
"cwd": "apps/next-app-router/next-app-router-4000"
1913
},
2014
"dependsOn": [
2115
{
@@ -27,8 +21,8 @@
2721
"serve": {
2822
"executor": "nx:run-commands",
2923
"options": {
30-
"command": "pnpm dev",
31-
"cwd": "apps/next-app-router-4000"
24+
"command": "npm run dev",
25+
"cwd": "apps/next-app-router/next-app-router-4000"
3226
},
3327
"dependsOn": [
3428
{
@@ -38,9 +32,10 @@
3832
]
3933
},
4034
"export": {
41-
"executor": "@nx/next:export",
35+
"executor": "nx:run-commands",
4236
"options": {
43-
"buildTarget": "next-app-router-4000:build:production"
37+
"command": "npm run export",
38+
"cwd": "apps/next-app-router/next-app-router-4000"
4439
}
4540
},
4641
"lint": {
@@ -53,28 +48,43 @@
5348
"e2e": {
5449
"executor": "@nx/cypress:cypress",
5550
"options": {
56-
"cypressConfig": "apps/next-app-router-4000/cypress.config.ts",
51+
"cypressConfig": "apps/next-app-router/next-app-router-4000/cypress.config.ts",
5752
"testingType": "e2e",
58-
"baseUrl": "http://localhost:4000",
59-
"key": "27e40c91-5ac3-4433-8a87-651d10f51cf6"
53+
"baseUrl": "http://localhost:4000"
6054
},
6155
"configurations": {
6256
"production": {
63-
"devServerTarget": "next-app-router-4000:serve:production"
57+
"baseUrl": "http://localhost:4000"
6458
}
6559
}
6660
},
6761
"test:e2e": {
6862
"executor": "nx:run-commands",
6963
"options": {
70-
"parallel": true,
64+
"parallel": false,
7165
"commands": [
7266
{
73-
"command": "lsof -i :4000 || nx run next-app-router-4000:serve",
67+
"command": "echo 'Starting both Next.js servers in parallel...'",
68+
"forwardAllArgs": false
69+
},
70+
{
71+
"command": "pnpm app:next-router:dev &",
72+
"forwardAllArgs": false
73+
},
74+
{
75+
"command": "echo 'Waiting for servers to start...'",
76+
"forwardAllArgs": false
77+
},
78+
{
79+
"command": "sleep 25",
80+
"forwardAllArgs": false
81+
},
82+
{
83+
"command": "echo 'Running e2e tests...'",
7484
"forwardAllArgs": false
7585
},
7686
{
77-
"command": "sleep 4 && nx run next-app-router-4000:e2e",
87+
"command": "nx run next-app-router-4000:e2e",
7888
"forwardAllArgs": true
7989
}
8090
]

apps/next-app-router/next-app-router-4001/project.json

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
{
22
"name": "next-app-router-4001",
33
"$schema": "../../node_modules/nx/schemas/project-schema.json",
4-
"sourceRoot": "apps/next-app-router-4001",
4+
"sourceRoot": "apps/next-app-router/next-app-router-4001",
55
"projectType": "application",
66
"tags": [],
77
"targets": {
88
"build": {
9-
"executor": "@nx/next:build",
10-
"defaultConfiguration": "production",
9+
"executor": "nx:run-commands",
1110
"options": {
12-
"outputPath": "apps/next-app-router-4001"
13-
},
14-
"configurations": {
15-
"development": {
16-
"outputPath": "apps/next-app-router-4001"
17-
},
18-
"production": {}
11+
"command": "npm run build",
12+
"cwd": "apps/next-app-router/next-app-router-4001"
1913
},
2014
"dependsOn": [
2115
{
@@ -27,8 +21,8 @@
2721
"serve": {
2822
"executor": "nx:run-commands",
2923
"options": {
30-
"command": "pnpm dev",
31-
"cwd": "apps/next-app-router-4001"
24+
"command": "npm run dev",
25+
"cwd": "apps/next-app-router/next-app-router-4001"
3226
},
3327
"dependsOn": [
3428
{
@@ -38,9 +32,10 @@
3832
]
3933
},
4034
"export": {
41-
"executor": "@nx/next:export",
35+
"executor": "nx:run-commands",
4236
"options": {
43-
"buildTarget": "next-app-router-4001:build:production"
37+
"command": "npm run export",
38+
"cwd": "apps/next-app-router/next-app-router-4001"
4439
}
4540
},
4641
"lint": {

0 commit comments

Comments
 (0)