Skip to content

chore: add TypeScript configuration files #3778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 56 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
dec648c
fix(runtime): update cypress config for improved e2e testing with inj…
ScriptedAlchemy May 14, 2025
049bc0e
chore: upgrade nx
ScriptedAlchemy May 14, 2025
6ecb9f8
chore: upgrade nx
ScriptedAlchemy May 14, 2025
d81dbd9
chore: upgrade nx
ScriptedAlchemy May 14, 2025
2cf2839
chore: upgrade nx
ScriptedAlchemy May 14, 2025
dc1786f
chore: upgrade nx
ScriptedAlchemy May 14, 2025
97f5ca1
chore: update vue and vue-tsc dependencies in package.json and pnpm-l…
ScriptedAlchemy May 14, 2025
b1ab869
chore: upgrade nx
ScriptedAlchemy May 14, 2025
6a52a07
chore: set current working directory for dts-plugin commands
ScriptedAlchemy May 14, 2025
fca0da6
chore: upgrade nx
ScriptedAlchemy May 14, 2025
d03c0a4
chore: upgrade nx
ScriptedAlchemy May 14, 2025
d57eded
chore: upgrade nx
ScriptedAlchemy May 14, 2025
d004962
chore: upgrade nx
ScriptedAlchemy May 14, 2025
770fccd
chore: upgrade nx
ScriptedAlchemy May 14, 2025
68c7ade
chore: upgrade nx
ScriptedAlchemy May 14, 2025
67fc132
chore: up
ScriptedAlchemy May 14, 2025
29d4513
chore: nx
ScriptedAlchemy May 14, 2025
08ac223
chore: nx
ScriptedAlchemy May 14, 2025
c3c3863
chore: nx
ScriptedAlchemy May 14, 2025
9fa3cbd
chore: nx
ScriptedAlchemy May 15, 2025
fd64b1e
chore: nx
ScriptedAlchemy May 15, 2025
4e7fd70
chore: nx
ScriptedAlchemy May 15, 2025
4e8f392
feat: update E2E testing configuration across Next.js projects
ScriptedAlchemy May 15, 2025
87b5d8a
chore: nx
ScriptedAlchemy May 15, 2025
9c94b96
feat: finalize E2E testing configuration for Next.js projects
ScriptedAlchemy May 15, 2025
7b344b8
chore: nx
ScriptedAlchemy May 15, 2025
64ce5f0
feat: update build-and-test workflow for E2E tests
ScriptedAlchemy May 15, 2025
a11d290
fix: update e2e-next-prod workflow configuration
ScriptedAlchemy May 15, 2025
7a557c6
fix: update 3001-shop project configuration
ScriptedAlchemy May 15, 2025
79ad46a
fix: update e2e-next-dev workflow configuration
ScriptedAlchemy May 15, 2025
20001cc
ci: add caching for Playwright browsers and Cypress binary to improve…
ScriptedAlchemy May 15, 2025
4e550c6
chore: nx
ScriptedAlchemy May 15, 2025
7f954ff
fix: update project name in nx config to match package.json naming co…
ScriptedAlchemy May 15, 2025
768bd92
chore: nx
ScriptedAlchemy May 15, 2025
42188d2
chore: nx
ScriptedAlchemy May 15, 2025
f23e469
chore: nx
ScriptedAlchemy May 15, 2025
cb2ee05
refactor: optimize Playwright installation in CI using cache
ScriptedAlchemy May 15, 2025
bc56ae0
chore: update commit message enhancement script
ScriptedAlchemy May 15, 2025
b0d4231
chore: update commit msg
ScriptedAlchemy May 15, 2025
100593a
chore: update commit msg
ScriptedAlchemy May 15, 2025
5bee188
chore: update commit msg
ScriptedAlchemy May 15, 2025
3276885
chore: untrack .temp-commit-msg and add to gitignore
ScriptedAlchemy May 15, 2025
e98ca8a
chore(modern-js-plugin): add delay to build command
ScriptedAlchemy May 15, 2025
45e7fb5
chore(modern-js-plugin): add delay to build command
ScriptedAlchemy May 15, 2025
c73d619
chore: message
ScriptedAlchemy May 15, 2025
d52ac00
chore: message
ScriptedAlchemy May 15, 2025
0fd953c
chore: x
ScriptedAlchemy May 15, 2025
9ba58b3
chore(core): improve commit history update script
ScriptedAlchemy May 15, 2025
1c647d2
chore: update commit message enhancement script
ScriptedAlchemy May 15, 2025
d43c2e3
chore: message
ScriptedAlchemy May 15, 2025
f98a1d6
chore: remove commit message enhancement script
ScriptedAlchemy May 15, 2025
6e1cf58
chore: update caching strategy
ScriptedAlchemy May 15, 2025
c4e2c32
chore: add TypeScript configuration files
ScriptedAlchemy May 15, 2025
adccfd5
chore: update output directory in tsup configuration
ScriptedAlchemy May 15, 2025
83b43ca
Merge branch 'update-nx' into ny-typescript-plugin
ScriptedAlchemy May 15, 2025
9b08220
chore: message
ScriptedAlchemy May 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/spotty-buttons-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@module-federation/storybook-addon': patch
---

fix type error with nx update
7 changes: 7 additions & 0 deletions .cursor/mcp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"mcpServers": {
"nx-mcp": {
"url": "http://localhost:9442/sse"
}
}
}
7 changes: 0 additions & 7 deletions .cursorignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
**/coverage/
**/dist/

# Documentation and config files
**/*.yaml
**/*.yml


# Explicitly ignore specific packages
packages/typescript/
packages/native-*
Expand All @@ -24,7 +19,6 @@ webpack/test/
webpack/benchmark/
tools/
.husky/
.github/
.verdaccio/


Expand All @@ -33,7 +27,6 @@ tools/
.cursorignore
jest.preset.js
babel.config.json
nx.json
LICENSE
.nxignore
netlify.toml
Expand Down
22 changes: 19 additions & 3 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,39 @@ jobs:
node-version: '18'
cache: 'pnpm'

- name: Cache Browsers
uses: actions/cache@v3
id: browsers-cache
with:
path: |
~/.cache/ms-playwright
~/.cache/Cypress
key: ${{ runner.os }}-browsers-${{ hashFiles('**/pnpm-lock.yaml') }}

- name: Set Playwright cache status
run: echo "PLAYWRIGHT_CACHE_HIT=${{ steps.browsers-cache.outputs.cache-hit }}" >> $GITHUB_ENV

- name: Set Nx SHA
uses: nrwl/nx-set-shas@v3

- name: Install Dependencies
run: pnpm install

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

- name: Check Code Format
run: npx nx format:check

- name: Print Number of CPU Cores
run: nproc

- name: Warm Nx Cache
run: npx nx run-many --targets=build --projects=tag:type:pkg
run: npx nx run-many --targets=build --projects=tag:type:pkg --parallel=4

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

- name: Check Package Publishing Compatibility
run: |
Expand All @@ -63,7 +79,7 @@ jobs:
with:
max_attempts: 2
timeout_minutes: 10
command: npx nx affected -t test --parallel=3 --exclude='*,!tag:type:pkg' --skip-nx-cache
command: npx nx affected -t test --parallel=3 --exclude='*,!tag:type:pkg'

- name: Run Affected Experimental Tests
uses: nick-fields/retry@v3
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/e2e-modern-ssr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,12 @@ jobs:
lsof -ti tcp:3050,3051,3052,3053,3054,3055,3056 | xargs -r kill &&
pnpm run app:modern:dev &
sleep 30 &&
# wait response content-type is application/json
for port in 3050 3051 3052 3053 3054 3055 3056; do
while true; do
response=$(curl -s -I http://127.0.0.1:$port/mf-manifest.json)
content_type=$(echo "$response" | grep -i "Content-Type" | awk '{print $2}' | tr -d '\r')
if [[ $content_type != *"text/html"* ]]; then
response=$(curl -s http://127.0.0.1:$port/mf-manifest.json)
if echo "$response" | jq empty >/dev/null 2>&1; then
break
fi
sleep 1
done
done
npx nx run modernjs-ssr-host:e2e &&
lsof -ti tcp:3050,3051,3052,3053,3054,3055,3056 | xargs kill
23 changes: 14 additions & 9 deletions .github/workflows/e2e-next-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,20 @@ jobs:
- name: Run condition check script
id: check-ci
run: node tools/scripts/ci-is-affected.mjs --appName=3000-home
- name: E2E Test for Next.js Dev - Home
if: steps.check-ci.outcome == 'success'
run: |
killall node
npx nx run 3000-home:test:e2e

- name: E2E Test for Next.js Dev - Shop
if: steps.check-ci.outcome == 'success'
run: |
killall node
npx nx run 3001-shop:test:e2e

- name: E2E Test for Next.js Dev
- name: E2E Test for Next.js Dev - Checkout
if: steps.check-ci.outcome == 'success'
run: |
npx kill-port 3000,3001,3002 &&
pnpm run app:next:dev &
sleep 1 &&
npx wait-on tcp:3001 &&
npx wait-on tcp:3002 &&
npx wait-on tcp:3000 &&
npx nx run-many --target=test:e2e --projects=3000-home,3001-shop,3002-checkout --parallel=1 &&
npx kill-port 3000,3001,3002
killall node
npx nx run 3002-checkout:test:e2e
15 changes: 7 additions & 8 deletions .github/workflows/e2e-next-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,10 @@ jobs:
- name: E2E Test for Next.js Prod
if: steps.check-ci.outcome == 'success'
run: |
pnpm run --filter @module-federation/3002-checkout --filter @module-federation/3000-home --filter @module-federation/3001-shop build &&
pnpm run app:next:prod &
sleep 4 &&
npx wait-on tcp:3001 &&
npx wait-on tcp:3002 &&
npx wait-on tcp:3000 &&
npx nx run-many --target=test:e2e --projects=3000-home,3001-shop,3002-checkout --parallel=1 &&
npx kill-port 3000,3001,3002
killall node
npx nx run 3000-home:test:e2e:production
killall node
npx nx run 3001-shop:test:e2e:production
killall node
npx nx run 3002-checkout:test:e2e:production
killall node
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

.temp-commit-msg
update-commit-messages.sh
# compiled output
/dist
/tmp
Expand Down Expand Up @@ -76,3 +77,9 @@ packages/enhanced/test/js
# Federation
**/.federation
*.ts.timestamp*

vite.config.*.timestamp*
vitest.config.*.timestamp*
.cursor/rules/nx-rules.mdc
.github/instructions/nx.instructions.md
.temp-commit-msg
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"diffEditor.wordWrap": "on",
"editor.rename.enablePreview": false
"editor.rename.enablePreview": false,
"nxConsole.generateAiAgentRules": true
}
7 changes: 6 additions & 1 deletion apps/3000-home/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ import { defineConfig } from 'cypress';

export default defineConfig({
projectId: 'sa6wfn',
e2e: nxE2EPreset(__filename, { cypressDir: 'cypress' }),
e2e: {
...nxE2EPreset(__filename, { cypressDir: 'cypress' }),
// Please ensure you use `cy.origin()` when navigating between domains and remove this option.
// See https://docs.cypress.io/app/references/migration-guide#Changes-to-cyorigin
injectDocumentDomain: true,
},
defaultCommandTimeout: 20000,
retries: {
runMode: 2,
Expand Down
2 changes: 1 addition & 1 deletion apps/3000-home/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
41 changes: 34 additions & 7 deletions apps/3000-home/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@
"executor": "@nx/next:server",
"defaultConfiguration": "development",
"options": {
"buildTarget": "3000-home:build",
"buildTarget": "@module-federation/3000-home:build",
"dev": true,
"port": 3000
},
"configurations": {
"development": {
"buildTarget": "3000-home:build:development",
"buildTarget": "@module-federation/3000-home:build:development",
"dev": true,
"port": 3000
},
"production": {
"buildTarget": "3000-home:build:production",
"buildTarget": "@module-federation/3000-home:build:production",
"dev": false,
"port": 3000
}
Expand All @@ -54,7 +54,7 @@
"export": {
"executor": "@nx/next:export",
"options": {
"buildTarget": "3000-home:build:production"
"buildTarget": "@module-federation/3000-home:build:production"
}
},
"lint": {
Expand All @@ -72,9 +72,13 @@
"baseUrl": "http://localhost:3000",
"key": "27e40c91-5ac3-4433-8a87-651d10f51cf6"
},
"defaultConfiguration": "development",
"configurations": {
"development": {
"devServerTarget": "@module-federation/3000-home:serve:development"
},
"production": {
"devServerTarget": "3000-home:serve:production"
"devServerTarget": "@module-federation/3000-home:serve:production"
}
}
},
Expand All @@ -84,14 +88,37 @@
"parallel": true,
"commands": [
{
"command": "lsof -i :3000 || nx run 3000-home:serve",
"command": "npx kill-port 3000 3001 3002",
"forwardAllArgs": false
},
{
"command": "NX_TUI=false nx run-many --target=serve --projects=3001-shop,3002-checkout --configuration=development & wait-on tcp:3001 tcp:3002",
"forwardAllArgs": false
},
{
"command": "sleep 4 && nx run 3000-home:e2e",
"command": "wait-on tcp:3001 tcp:3002 && nx run @module-federation/3000-home:e2e:development",
"forwardAllArgs": true
}
]
},
"configurations": {
"production": {
"parallel": true,
"commands": [
{
"command": "npx kill-port 3000 3001 3002",
"forwardAllArgs": false
},
{
"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",
"forwardAllArgs": false
},
{
"command": "nx build @module-federation/3000-home --configuration=production && wait-on tcp:3001 tcp:3002 && NX_TUI=false nx run @module-federation/3000-home:e2e:production",
"forwardAllArgs": true
}
]
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion apps/3000-home/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.base.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"target": "es2017",
"jsx": "preserve",
Expand Down
7 changes: 6 additions & 1 deletion apps/3001-shop/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
import { defineConfig } from 'cypress';

export default defineConfig({
e2e: nxE2EPreset(__filename, { cypressDir: 'cypress' }),
e2e: {
...nxE2EPreset(__filename, { cypressDir: 'cypress' }),
// Please ensure you use `cy.origin()` when navigating between domains and remove this option.
// See https://docs.cypress.io/app/references/migration-guide#Changes-to-cyorigin
injectDocumentDomain: true,
},
defaultCommandTimeout: 10000,
retries: {
runMode: 3,
Expand Down
2 changes: 1 addition & 1 deletion apps/3001-shop/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
40 changes: 37 additions & 3 deletions apps/3001-shop/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
"development": {
"outputPath": "apps/3001-shop"
},
"production": {}
"production": {
"cache": false,
"outputPath": "apps/3001-shop"
}
},
"dependsOn": [
{
Expand Down Expand Up @@ -70,14 +73,41 @@
"parallel": true,
"commands": [
{
"command": "lsof -i :3001 || nx run 3001-shop:serve",
"command": "npx kill-port 3000 3001 3002",
"forwardAllArgs": false
},
{
"command": "sleep 10 && nx run 3001-shop:e2e",
"command": "NX_TUI=false nx run-many --target=serve --projects=3000-home,3002-checkout --configuration=development & wait-on tcp:3000 tcp:3002 ",
"forwardAllArgs": false
},
{
"command": "wait-on tcp:3000 tcp:3002 && nx run 3001-shop:e2e:development",
"forwardAllArgs": true
}
]
},
"configurations": {
"production": {
"parallel": true,
"commands": [
{
"command": "npx kill-port 3000 3001 3002",
"forwardAllArgs": false
},
{
"command": "nx run-many --target=build --projects=3000-home,3002-checkout --configuration=production --parallel=9",
"forwardAllArgs": false
},
{
"command": "nx run-many --target=serve --projects=3000-home,3002-checkout --configuration=production --parallel=9 & wait-on tcp:3000 tcp:3002",
"forwardAllArgs": false
},
{
"command": "echo 'done'",
"forwardAllArgs": true
}
]
}
}
},
"e2e": {
Expand All @@ -87,7 +117,11 @@
"testingType": "e2e",
"baseUrl": "http://localhost:3001"
},
"defaultConfiguration": "development",
"configurations": {
"development": {
"devServerTarget": "3001-shop:serve:development"
},
"production": {
"devServerTarget": "3001-shop:serve:production"
}
Expand Down
2 changes: 1 addition & 1 deletion apps/3001-shop/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.base.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"target": "es2017",
"jsx": "preserve",
Expand Down
Loading
Loading