Skip to content

Commit ba6c6c5

Browse files
committed
feat(repo): migrate nx to 20.4.0 and fix breaking changes
closed COD-263
1 parent 3424a5a commit ba6c6c5

31 files changed

+538
-557
lines changed

.env.e2e

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
### Nx variables to override .env.local for E2E ###
2+
3+
# If set to `false`, disables the Nx daemon process. Disable the daemon to print console.log statements in plugin code you are developing.
4+
NX_DAEMON=true
5+
6+
### Plugins variables for E2E ###
7+
8+
# If set to `true`, will print E2E debug information useful for troubleshooting.
9+
CDWR_DEBUG_LOGGING=true
10+
11+
# Package manager to use in E2E tests; `npm`, `pnpm`, `yarn` (todo: `bun`)
12+
CDWR_E2E_PACKAGE_MANAGER=pnpm
13+
14+
# Verdaccio host; 'localhost' is default Linux and 'host.docker.internal' is for macOS and Windows
15+
CDWR_E2E_VERDACCIO_HOST='host.docker.internal'
16+
17+
### Side effect workarounds ###
18+
19+
# Fixing a problem in E2E when package manager `yarn` is tested and `packageManager` is defined in workspace `package.json`
20+
# https://github.com/yarnpkg/yarn/issues/9015
21+
SKIP_YARN_COREPACK_CHECK=0
22+
23+
# Set global yarn silent mode to prevent JSON output with extra leading and trailing data.
24+
# It's a problem when we run `nx show project --json` since Nx doesn't provide clean JSON output for Yarn 1.
25+
YARN_SILENT=true

.env.local

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,3 @@ NX_SKIP_NX_CACHE=false
3131

3232
# If set to `true`, will print debug information useful for troubleshooting.
3333
NX_VERBOSE_LOGGING=false
34-
35-
### Plugins variables ###
36-
37-
# If set to `true`, will print E2E debug information useful for troubleshooting.
38-
CDWR_DEBUG_LOGGING=true
39-
40-
# Package manager to use in E2E tests; `npm`, `pnpm`, `yarn` (todo: `bun`)
41-
CDWR_E2E_PACKAGE_MANAGER=
42-
43-
# Verdaccio host; 'localhost' is default Linux and 'host.docker.internal' is for macOS and Windows
44-
CDWR_E2E_VERDACCIO_HOST='host.docker.internal'
45-
46-
### Side effect workarounds ###
47-
48-
# Fixing a problem in E2E when package manager `yarn` is tested and `packageManager` is defined in workspace `package.json`
49-
# https://github.com/yarnpkg/yarn/issues/9015
50-
SKIP_YARN_COREPACK_CHECK=0
51-
52-
# Set global yarn silent mode to prevent JSON output with extra leading and trailing data.
53-
# It's a problem when we run `nx show project --json` since Nx doesn't provide clean JSON output for Yarn 1.
54-
YARN_SILENT=true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ migrations.json
5454
.secrets
5555

5656
vite.config.*.timestamp*
57+
vitest.config.*.timestamp*
5758

5859
# No nested lockfiles
5960
apps/**/pnpm-lock.yaml

apps/cms/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ WORKDIR /app
77
# Copy package.json first to leverage Docker cache for dependencies
88
COPY package.json ./
99

10-
RUN npm install
10+
# TODO: Remove legacy-peer-deps once the peers for @cdwr/nx-payload are less strict
11+
RUN npm install --legacy-peer-deps
1112

1213
COPY . .
1314

apps/cms/project.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
"projectType": "application",
66
"tags": ["scope:cms", "type:app"],
77
"targets": {
8-
"lint": {},
9-
"test": {},
108
"serve-fresh": {
119
"executor": "nx:run-commands",
1210
"options": {

apps/web/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"@infisical/sdk": "^3.0.4",
1313
"@lexical/headless": "0.13.1",
1414
"@lexical/markdown": "0.13.1",
15-
"@nx/react": "20.2.2",
15+
"@nx/react": "^20.0.0",
1616
"@payloadcms/richtext-lexical": "0.11.4",
1717
"@remix-run/node": "^2.14.0",
1818
"@remix-run/react": "^2.14.0",
@@ -29,7 +29,7 @@
2929
"zod": "^3.23.8"
3030
},
3131
"devDependencies": {
32-
"@nx/vite": "20.2.2",
32+
"@nx/vite": "^20.0.0",
3333
"@remix-run/dev": "^2.14.0",
3434
"@types/react": "^18.2.0",
3535
"@types/react-dom": "^18.2.0",

e2e/utils/stop-local-registry.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,6 @@ export default () => {
3333
} catch (error) {
3434
console.warn('Failed to clean up local registry config:', error);
3535
}
36+
37+
process.exit(0);
3638
};

jest.preset.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ const nxPreset = require('@nx/jest/preset').default;
22

33
module.exports = {
44
...nxPreset,
5+
collectCoverage: true,
56
coverageReporters: ['html', 'json'],
67
moduleNameMapper: {
78
'^@actions/github$': '__mocks__/@actions/github.jest.ts'
8-
}
9+
},
10+
passWithNoTests: true
911
};

libs/shared/data-access/seed/tsconfig.spec.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
},
1313
"include": [
1414
"vite.config.ts",
15+
"vite.config.mts",
1516
"src/**/*.test.ts",
1617
"src/**/*.spec.ts",
1718
"src/**/*.d.ts"

nx.json

Lines changed: 20 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,6 @@
1717
"sharedGlobals": ["{workspaceRoot}/.github/workflows/ci.yml"]
1818
},
1919
"targetDefaults": {
20-
"@nx/jest:jest": {
21-
"inputs": [
22-
"default",
23-
"^production",
24-
"{workspaceRoot}/jest.preset.js",
25-
"{workspaceRoot}/**/*.spec.ts"
26-
],
27-
"options": {
28-
"passWithNoTests": true,
29-
"jestConfig": "{projectRoot}/jest.config.ts"
30-
},
31-
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
32-
"configurations": {
33-
"ci": {
34-
"ci": true,
35-
"codeCoverage": true
36-
}
37-
},
38-
"cache": true
39-
},
4020
"e2e-ci--**/*": {
4121
"dependsOn": ["^build"]
4222
},
@@ -75,7 +55,6 @@
7555
"outputs": ["{options.outputPath}"]
7656
},
7757
"nx-release-publish": {
78-
"dependsOn": ["build"],
7958
"options": {
8059
"packageRoot": "{workspaceRoot}/dist/packages/{projectName}"
8160
}
@@ -220,20 +199,17 @@
220199
},
221200
"plugins": [
222201
{
223-
"plugin": "@nx/vite/plugin",
202+
"plugin": "@nx/eslint/plugin",
203+
"exclude": ["packages/**/*__tmpl__"],
224204
"options": {
225-
"buildTargetName": "build",
226-
"testTargetName": "test",
227-
"serveTargetName": "serve",
228-
"previewTargetName": "preview",
229-
"serveStaticTargetName": "serve-static",
230-
"typecheckTargetName": "typecheck"
205+
"targetName": "lint"
231206
}
232207
},
233208
{
234-
"plugin": "@nx/eslint/plugin",
209+
"plugin": "@nx/jest/plugin",
210+
"exclude": ["e2e/**/*"],
235211
"options": {
236-
"targetName": "lint"
212+
"targetName": "test"
237213
}
238214
},
239215
{
@@ -242,7 +218,6 @@
242218
"targetName": "e2e"
243219
}
244220
},
245-
"@cdwr/nx-payload/plugin",
246221
{
247222
"plugin": "@nx/remix/plugin",
248223
"options": {
@@ -253,7 +228,18 @@
253228
"serveStaticTargetName": "serve-static",
254229
"staticServeTargetName": "static-serve"
255230
}
256-
}
257-
],
258-
"useLegacyCache": true
231+
},
232+
{
233+
"plugin": "@nx/vite/plugin",
234+
"options": {
235+
"buildTargetName": "build",
236+
"testTargetName": "test",
237+
"serveTargetName": "serve",
238+
"previewTargetName": "preview",
239+
"serveStaticTargetName": "serve-static",
240+
"typecheckTargetName": "typecheck"
241+
}
242+
},
243+
"@cdwr/nx-payload/plugin"
244+
]
259245
}

package.json

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"axios": "^1.6.0",
3535
"clsx": "^2.1.1",
3636
"drizzle-orm": "0.32.1",
37-
"express": "^4.18.1",
37+
"express": "4.21.2",
3838
"fast-glob": "^3.3.2",
3939
"hono": "^4.6.10",
4040
"http-status-codes": "^2.3.0",
@@ -62,23 +62,23 @@
6262
"@eslint/js": "^9.8.0",
6363
"@evilmartians/lefthook": "^1.8.0",
6464
"@homebridge/node-pty-prebuilt-multiarch": "^0.11.14",
65-
"@nx/cypress": "20.2.2",
66-
"@nx/devkit": "20.2.2",
67-
"@nx/esbuild": "20.2.2",
68-
"@nx/eslint": "20.2.2",
69-
"@nx/eslint-plugin": "20.2.2",
70-
"@nx/express": "20.2.2",
71-
"@nx/jest": "20.2.2",
72-
"@nx/js": "20.2.2",
73-
"@nx/node": "20.2.2",
74-
"@nx/playwright": "20.2.2",
75-
"@nx/plugin": "20.2.2",
76-
"@nx/react": "20.2.2",
77-
"@nx/remix": "20.2.2",
78-
"@nx/vite": "20.2.2",
79-
"@nx/web": "20.2.2",
80-
"@nx/webpack": "20.2.2",
81-
"@nx/workspace": "20.2.2",
65+
"@nx/cypress": "20.4.0",
66+
"@nx/devkit": "20.4.0",
67+
"@nx/esbuild": "20.4.0",
68+
"@nx/eslint": "20.4.0",
69+
"@nx/eslint-plugin": "20.4.0",
70+
"@nx/express": "20.4.0",
71+
"@nx/jest": "20.4.0",
72+
"@nx/js": "20.4.0",
73+
"@nx/node": "20.4.0",
74+
"@nx/playwright": "20.4.0",
75+
"@nx/plugin": "20.4.0",
76+
"@nx/react": "20.4.0",
77+
"@nx/remix": "20.4.0",
78+
"@nx/vite": "20.4.0",
79+
"@nx/web": "20.4.0",
80+
"@nx/webpack": "20.4.0",
81+
"@nx/workspace": "20.4.0",
8282
"@octokit/graphql-schema": "^15.25.0",
8383
"@octokit/plugin-rest-endpoint-methods": "^13.2.6",
8484
"@octokit/types": "^13.6.1",
@@ -94,9 +94,9 @@
9494
"@swc/helpers": "~0.5.11",
9595
"@swc/jest": "~0.2.36",
9696
"@testing-library/jest-dom": "6.6.3",
97-
"@testing-library/react": "16.0.1",
97+
"@testing-library/react": "16.1.0",
9898
"@testing-library/user-event": "^14.5.2",
99-
"@types/express": "^4.17.17",
99+
"@types/express": "4.17.21",
100100
"@types/jest": "^29.5.12",
101101
"@types/kill-port": "^2.0.3",
102102
"@types/node": "22.12.0",
@@ -112,7 +112,7 @@
112112
"@vitest/ui": "^1.3.1",
113113
"autoprefixer": "10.4.20",
114114
"chalk": "^4.1.0",
115-
"create-nx-workspace": "20.2.2",
115+
"create-nx-workspace": "20.4.0",
116116
"cz-git": "^1.8.0",
117117
"czg": "^1.8.0",
118118
"docker-cli-js": "^2.10.0",
@@ -134,7 +134,7 @@
134134
"kill-port": "^2.0.1",
135135
"memfs": "^4.14.0",
136136
"npm-whoami": "^1.1.4",
137-
"nx": "20.2.2",
137+
"nx": "20.4.0",
138138
"nx-cloud": "19.1.0",
139139
"postcss": "8.5.1",
140140
"prettier": "^3.0.0",

packages/core/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@
3737
"@clack/prompts": "^0.9.0",
3838
"@infisical/sdk": "^3.0.4",
3939
"@homebridge/node-pty-prebuilt-multiarch": "^0.11.14",
40-
"@nx/devkit": "20.x",
41-
"@nx/plugin": "20.x",
40+
"@nx/devkit": "^20.0.0",
41+
"@nx/plugin": "^20.0.0",
4242
"@octokit/request-error": "^5.0.1",
4343
"chalk": "^4.1.0",
4444
"docker-cli-js": "^2.10.0",
4545
"fast-glob": "^3.3.2",
4646
"http-status-codes": "^2.3.0",
4747
"kill-port": "^2.0.1",
4848
"npm-whoami": "^1.1.4",
49-
"nx": "20.x",
49+
"nx": "^20.0.0",
5050
"simple-git": "^3.27.0",
5151
"tcp-port-used": "^1.0.2",
5252
"tiny-invariant": "^1.3.3",

packages/create-nx-payload/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
},
2222
"dependencies": {
2323
"chalk": "^4.1.0",
24-
"create-nx-workspace": "20.2.2",
24+
"create-nx-workspace": "20.4.0",
2525
"enquirer": "^2.4.1",
2626
"tslib": "^2.4.1",
2727
"yargs": "^17.7.2"

packages/create-nx-payload/project.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
"options": {
1212
"assets": ["packages/create-nx-payload/*.md"]
1313
}
14-
},
15-
"test": {
16-
"executor": "@nx/jest:jest"
1714
}
1815
}
1916
}

packages/nx-fly-deployment-action/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"@actions/core": "^1.11.1",
2828
"@actions/exec": "^1.1.1",
2929
"@actions/github": "^6.0.0",
30-
"@nx/devkit": "20.2.2",
30+
"@nx/devkit": "^20.0.0",
3131
"@octokit/webhooks-types": "^7.6.1",
3232
"zod": "^3.23.8"
3333
},

packages/nx-migrate-action/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"@actions/core": "^1.11.1",
2828
"@actions/exec": "^1.1.1",
2929
"@actions/github": "^6.0.0",
30-
"@nx/devkit": "20.2.2",
30+
"@nx/devkit": "^20.0.0",
3131
"@octokit/graphql-schema": "^15.25.0",
3232
"replace-in-file": "^7.2.0",
3333
"zod": "^3.23.8"

packages/nx-migrate-action/project.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
"format": ["cjs", "esm"]
1717
}
1818
},
19-
"test": {
20-
"executor": "@nx/jest:jest"
21-
},
2219
"act": {
2320
"command": "act schedule --env-file .env.act -j nx-migrate"
2421
}

packages/nx-payload/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@
4242
"react-dom": "^18.3.1"
4343
},
4444
"peerDependencies": {
45-
"@nx/devkit": "20.2.2",
46-
"@nx/esbuild": "20.2.2",
47-
"@nx/js": "20.2.2",
48-
"@nx/node": "20.2.2",
49-
"nx": "20.2.2"
45+
"@nx/devkit": "^20.0.0",
46+
"@nx/esbuild": "^20.0.0",
47+
"@nx/js": "^20.0.0",
48+
"@nx/node": "^20.0.0",
49+
"nx": "^20.0.0"
5050
},
5151
"peerDependenciesMeta": {
5252
"@nx/webpack": {

0 commit comments

Comments
 (0)