Skip to content

Commit 2ca17f8

Browse files
chore: upgrade nx (#3774)
1 parent 0b076b7 commit 2ca17f8

File tree

57 files changed

+3926
-5961
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+3926
-5961
lines changed

.changeset/spotty-buttons-cough.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@module-federation/storybook-addon': patch
3+
---
4+
5+
fix type error with nx update

.cursor/mcp.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"mcpServers": {
3+
"nx-mcp": {
4+
"url": "http://localhost:9442/sse"
5+
}
6+
}
7+
}

.cursorignore

-7
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@
44
**/coverage/
55
**/dist/
66

7-
# Documentation and config files
8-
**/*.yaml
9-
**/*.yml
10-
11-
127
# Explicitly ignore specific packages
138
packages/typescript/
149
packages/native-*
@@ -24,7 +19,6 @@ webpack/test/
2419
webpack/benchmark/
2520
tools/
2621
.husky/
27-
.github/
2822
.verdaccio/
2923

3024

@@ -33,7 +27,6 @@ tools/
3327
.cursorignore
3428
jest.preset.js
3529
babel.config.json
36-
nx.json
3730
LICENSE
3831
.nxignore
3932
netlify.toml

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

+20-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
jobs:
1010
checkout-install:
1111
runs-on: ubuntu-latest
12+
timeout-minutes: 30
1213
steps:
1314
- name: Checkout Repository
1415
uses: actions/checkout@v3
@@ -26,23 +27,39 @@ jobs:
2627
node-version: '18'
2728
cache: 'pnpm'
2829

30+
- name: Cache Browsers
31+
uses: actions/cache@v3
32+
id: browsers-cache
33+
with:
34+
path: |
35+
~/.cache/ms-playwright
36+
~/.cache/Cypress
37+
key: ${{ runner.os }}-browsers-${{ hashFiles('**/pnpm-lock.yaml') }}
38+
39+
- name: Set Playwright cache status
40+
run: echo "PLAYWRIGHT_CACHE_HIT=${{ steps.browsers-cache.outputs.cache-hit }}" >> $GITHUB_ENV
41+
2942
- name: Set Nx SHA
3043
uses: nrwl/nx-set-shas@v3
3144

3245
- name: Install Dependencies
3346
run: pnpm install
3447

3548
- name: Install Cypress
49+
# if: steps.browsers-cache.outputs.cache-hit != 'true'
3650
run: npx cypress install
3751

3852
- name: Check Code Format
3953
run: npx nx format:check
4054

55+
- name: Print Number of CPU Cores
56+
run: nproc
57+
4158
- name: Warm Nx Cache
42-
run: npx nx run-many --targets=build --projects=tag:type:pkg
59+
run: npx nx run-many --targets=build --projects=tag:type:pkg --parallel=4
4360

4461
- name: Run Build for All
45-
run: npx nx run-many --targets=build --projects=tag:type:pkg --skip-nx-cache
62+
run: npx nx run-many --targets=build --projects=tag:type:pkg --parallel=4 --skip-nx-cache
4663

4764
- name: Check Package Publishing Compatibility
4865
run: |
@@ -63,7 +80,7 @@ jobs:
6380
with:
6481
max_attempts: 2
6582
timeout_minutes: 10
66-
command: npx nx affected -t test --parallel=3 --exclude='*,!tag:type:pkg' --skip-nx-cache
83+
command: npx nx affected -t test --parallel=3 --exclude='*,!tag:type:pkg'
6784

6885
- name: Run Affected Experimental Tests
6986
uses: nick-fields/retry@v3

.github/workflows/devtools.yml

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ env:
1313
jobs:
1414
main:
1515
runs-on: ubuntu-latest
16+
timeout-minutes: 30
1617
steps:
1718
- name: Checkout Repository
1819
uses: actions/checkout@v3

.github/workflows/e2e-manifest.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
jobs:
88
e2e-manifest:
99
runs-on: ubuntu-latest
10+
timeout-minutes: 30
1011
steps:
1112
- name: Checkout Repository
1213
uses: actions/checkout@v3
@@ -45,7 +46,7 @@ jobs:
4546

4647
- name: E2E Test for Manifest Demo Development
4748
if: steps.check-ci.outcome == 'success'
48-
run: pnpm run app:manifest:dev & echo "done" && npx wait-on tcp:3009 && npx wait-on tcp:3012 && npx wait-on http://127.0.0.1:4001/ && npx nx run-many --target=e2e --projects=manifest-webpack-host --parallel=1 && npx kill-port 3013 3009 3010 3011 3012 4001
49+
run: pnpm run app:manifest:dev & echo "done" && npx wait-on tcp:3009 && npx wait-on tcp:3012 && npx wait-on http://127.0.0.1:4001/ && npx nx run-many --target=e2e --projects=manifest-webpack-host --parallel=2 && npx kill-port 3013 3009 3010 3011 3012 4001
4950

5051
- name: E2E Test for Manifest Demo Production
5152
if: steps.check-ci.outcome == 'success'

.github/workflows/e2e-modern-ssr.yml

+17-16
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
jobs:
77
e2e-modern:
88
runs-on: ubuntu-latest
9+
timeout-minutes: 30
910
steps:
1011
- name: Checkout Repository
1112
uses: actions/checkout@v3
@@ -44,20 +45,20 @@ jobs:
4445

4546
- name: E2E Test for Modern.js SSR
4647
if: steps.check-ci.outcome == 'success'
47-
run: |
48-
lsof -ti tcp:3050,3051,3052,3053,3054,3055,3056 | xargs -r kill &&
49-
pnpm run app:modern:dev &
50-
sleep 30 &&
51-
# wait response content-type is application/json
52-
for port in 3050 3051 3052 3053 3054 3055 3056; do
53-
while true; do
54-
response=$(curl -s -I http://127.0.0.1:$port/mf-manifest.json)
55-
content_type=$(echo "$response" | grep -i "Content-Type" | awk '{print $2}' | tr -d '\r')
56-
if [[ $content_type != *"text/html"* ]]; then
57-
break
58-
fi
59-
sleep 1
48+
uses: nick-fields/retry@v3
49+
with:
50+
max_attempts: 2
51+
timeout_minutes: 10
52+
command: |
53+
lsof -ti tcp:3050,3051,3052,3053,3054,3055,3056 | xargs -r kill &&
54+
pnpm run app:modern:dev &
55+
sleep 30 &&
56+
for port in 3050 3051 3052 3053 3054 3055 3056; do
57+
while true; do
58+
response=$(curl -s http://127.0.0.1:$port/mf-manifest.json)
59+
if echo "$response" | jq empty >/dev/null 2>&1; then
60+
break
61+
fi
62+
sleep 1
63+
done
6064
done
61-
done
62-
npx nx run modernjs-ssr-host:e2e &&
63-
lsof -ti tcp:3050,3051,3052,3053,3054,3055,3056 | xargs kill

.github/workflows/e2e-modern.yml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
jobs:
88
e2e-modern:
99
runs-on: ubuntu-latest
10+
timeout-minutes: 30
1011
steps:
1112
- name: Checkout Repository
1213
uses: actions/checkout@v3

.github/workflows/e2e-next-dev.yml

+15-9
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
jobs:
77
e2e-next-dev:
88
runs-on: ubuntu-latest
9+
timeout-minutes: 30
910
steps:
1011
- name: Checkout Repository
1112
uses: actions/checkout@v3
@@ -44,15 +45,20 @@ jobs:
4445
- name: Run condition check script
4546
id: check-ci
4647
run: node tools/scripts/ci-is-affected.mjs --appName=3000-home
48+
- name: E2E Test for Next.js Dev - Home
49+
if: steps.check-ci.outcome == 'success'
50+
run: |
51+
killall node
52+
npx nx run 3000-home:test:e2e
53+
54+
- name: E2E Test for Next.js Dev - Shop
55+
if: steps.check-ci.outcome == 'success'
56+
run: |
57+
killall node
58+
npx nx run 3001-shop:test:e2e
4759
48-
- name: E2E Test for Next.js Dev
60+
- name: E2E Test for Next.js Dev - Checkout
4961
if: steps.check-ci.outcome == 'success'
5062
run: |
51-
npx kill-port 3000,3001,3002 &&
52-
pnpm run app:next:dev &
53-
sleep 1 &&
54-
npx wait-on tcp:3001 &&
55-
npx wait-on tcp:3002 &&
56-
npx wait-on tcp:3000 &&
57-
npx nx run-many --target=test:e2e --projects=3000-home,3001-shop,3002-checkout --parallel=1 &&
58-
npx kill-port 3000,3001,3002
63+
killall node
64+
npx nx run 3002-checkout:test:e2e

.github/workflows/e2e-next-prod.yml

+16-9
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
jobs:
77
e2e-next-prod:
88
runs-on: ubuntu-latest
9+
timeout-minutes: 30
910
steps:
1011
- name: Checkout Repository
1112
uses: actions/checkout@v3
@@ -42,14 +43,20 @@ jobs:
4243
id: check-ci
4344
run: node tools/scripts/ci-is-affected.mjs --appName=3000-home
4445

45-
- name: E2E Test for Next.js Prod
46+
- name: E2E Test for Next.js Prod - Home
4647
if: steps.check-ci.outcome == 'success'
4748
run: |
48-
pnpm run --filter @module-federation/3002-checkout --filter @module-federation/3000-home --filter @module-federation/3001-shop build &&
49-
pnpm run app:next:prod &
50-
sleep 4 &&
51-
npx wait-on tcp:3001 &&
52-
npx wait-on tcp:3002 &&
53-
npx wait-on tcp:3000 &&
54-
npx nx run-many --target=test:e2e --projects=3000-home,3001-shop,3002-checkout --parallel=1 &&
55-
npx kill-port 3000,3001,3002
49+
killall node
50+
npx nx run 3000-home:test:e2e:production
51+
52+
- name: E2E Test for Next.js Prod - Shop
53+
if: steps.check-ci.outcome == 'success'
54+
run: |
55+
killall node
56+
npx nx run 3001-shop:test:e2e:production
57+
58+
- name: E2E Test for Next.js Prod - Checkout
59+
if: steps.check-ci.outcome == 'success'
60+
run: |
61+
killall node
62+
npx nx run 3002-checkout:test:e2e:production

.github/workflows/e2e-node.yml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
jobs:
88
e2e-node:
99
runs-on: ubuntu-latest
10+
timeout-minutes: 30
1011
steps:
1112
- name: Checkout Repository
1213
uses: actions/checkout@v3

.github/workflows/e2e-router.yml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
jobs:
88
e2e-runtime:
99
runs-on: ubuntu-latest
10+
timeout-minutes: 30
1011
steps:
1112
- name: Checkout Repository
1213
uses: actions/checkout@v3

.github/workflows/e2e-runtime.yml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
jobs:
88
e2e-runtime:
99
runs-on: ubuntu-latest
10+
timeout-minutes: 30
1011
steps:
1112
- name: Checkout Repository
1213
uses: actions/checkout@v3

.gitignore

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# See http://help.github.com/ignore-files/ for more about ignoring files.
2-
2+
.temp-commit-msg
3+
update-commit-messages.sh
34
# compiled output
45
/dist
56
/tmp
@@ -76,3 +77,9 @@ packages/enhanced/test/js
7677
# Federation
7778
**/.federation
7879
*.ts.timestamp*
80+
81+
vite.config.*.timestamp*
82+
vitest.config.*.timestamp*
83+
.cursor/rules/nx-rules.mdc
84+
.github/instructions/nx.instructions.md
85+
.temp-commit-msg

.vscode/settings.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"diffEditor.wordWrap": "on",
3-
"editor.rename.enablePreview": false
3+
"editor.rename.enablePreview": false,
4+
"nxConsole.generateAiAgentRules": true
45
}

apps/3000-home/cypress.config.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ import { defineConfig } from 'cypress';
33

44
export default defineConfig({
55
projectId: 'sa6wfn',
6-
e2e: nxE2EPreset(__filename, { cypressDir: 'cypress' }),
6+
e2e: {
7+
...nxE2EPreset(__filename, { cypressDir: 'cypress' }),
8+
// Please ensure you use `cy.origin()` when navigating between domains and remove this option.
9+
// See https://docs.cypress.io/app/references/migration-guide#Changes-to-cyorigin
10+
injectDocumentDomain: true,
11+
},
712
defaultCommandTimeout: 20000,
813
retries: {
914
runMode: 2,

apps/3000-home/next-env.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
/// <reference types="next/image-types/global" />
33

44
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/basic-features/typescript for more information.
5+
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.

apps/3000-home/project.json

+29-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@
7272
"baseUrl": "http://localhost:3000",
7373
"key": "27e40c91-5ac3-4433-8a87-651d10f51cf6"
7474
},
75+
"defaultConfiguration": "development",
7576
"configurations": {
77+
"development": {
78+
"devServerTarget": "3000-home:serve:development"
79+
},
7680
"production": {
7781
"devServerTarget": "3000-home:serve:production"
7882
}
@@ -84,14 +88,37 @@
8488
"parallel": true,
8589
"commands": [
8690
{
87-
"command": "lsof -i :3000 || nx run 3000-home:serve",
91+
"command": "npx kill-port 3000 3001 3002",
92+
"forwardAllArgs": false
93+
},
94+
{
95+
"command": "NX_TUI=false nx run-many --target=serve --projects=3001-shop,3002-checkout --configuration=development & wait-on tcp:3001 tcp:3002",
8896
"forwardAllArgs": false
8997
},
9098
{
91-
"command": "sleep 4 && nx run 3000-home:e2e",
99+
"command": "wait-on tcp:3001 tcp:3002 && nx run 3000-home:e2e:development",
92100
"forwardAllArgs": true
93101
}
94102
]
103+
},
104+
"configurations": {
105+
"production": {
106+
"parallel": true,
107+
"commands": [
108+
{
109+
"command": "npx kill-port 3000 3001 3002",
110+
"forwardAllArgs": false
111+
},
112+
{
113+
"command": "nx run-many --target=build --projects=3001-shop,3002-checkout --configuration=production --parallel=9 && nx run-many --target=serve --projects=3001-shop,3002-checkout --configuration=production --parallel=9 & wait-on tcp:3001 tcp:3002",
114+
"forwardAllArgs": false
115+
},
116+
{
117+
"command": "nx build 3000-home --configuration=production && wait-on tcp:3001 tcp:3002 && NX_TUI=false nx run 3000-home:e2e:production",
118+
"forwardAllArgs": true
119+
}
120+
]
121+
}
95122
}
96123
}
97124
}

apps/3001-shop/cypress.config.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
22
import { defineConfig } from 'cypress';
33

44
export default defineConfig({
5-
e2e: nxE2EPreset(__filename, { cypressDir: 'cypress' }),
5+
e2e: {
6+
...nxE2EPreset(__filename, { cypressDir: 'cypress' }),
7+
// Please ensure you use `cy.origin()` when navigating between domains and remove this option.
8+
// See https://docs.cypress.io/app/references/migration-guide#Changes-to-cyorigin
9+
injectDocumentDomain: true,
10+
},
611
defaultCommandTimeout: 10000,
712
retries: {
813
runMode: 3,

apps/3001-shop/next-env.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
/// <reference types="next/image-types/global" />
33

44
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/basic-features/typescript for more information.
5+
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.

0 commit comments

Comments
 (0)