Skip to content

Commit 7e7e6d1

Browse files
committed
perf: add nx caching for tests and dev build
- Add _test, _test:int, _test:e2e targets with caching - Add _dev:build target with caching for Next.js output - Wrap test and dev:build scripts with nx for cache hits
1 parent 4434f18 commit 7e7e6d1

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

nx.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,23 @@
2222
"{projectRoot}/tsconfig.json",
2323
"{projectRoot}/dev/tsconfig.json"
2424
]
25+
},
26+
"_test": {
27+
"cache": true,
28+
"inputs": ["{projectRoot}/src/**/*", "{projectRoot}/dev/**/*"]
29+
},
30+
"_test:int": {
31+
"cache": true,
32+
"inputs": ["{projectRoot}/src/**/*", "{projectRoot}/dev/**/*"]
33+
},
34+
"_test:e2e": {
35+
"cache": true,
36+
"inputs": ["{projectRoot}/src/**/*", "{projectRoot}/dev/**/*"]
37+
},
38+
"_dev:build": {
39+
"cache": true,
40+
"inputs": ["{projectRoot}/src/**/*", "{projectRoot}/dev/**/*"],
41+
"outputs": ["{projectRoot}/dev/.next"]
2542
}
2643
},
2744
"defaultBase": "main"

package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
"clean": "rimraf {dist,*.tsbuildinfo}",
3636
"copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/",
3737
"dev": "concurrently -k -n \"WEB,MAIL\" -c \"auto\" \"npm run dev:original\" \"npm run maildev\"",
38-
"dev:build": "dotenv -e ./dev/.env.test -- next build dev",
38+
"dev:build": "nx run payload-better-auth:_dev:build",
39+
"_dev:build": "dotenv -e ./dev/.env.test -- next build dev",
3940
"dev:original": "dotenv -e ./dev/.env.development -- next dev dev --turbo",
4041
"dev:start": "dotenv -e ./dev/.env.test -- next start dev",
4142
"dev:generate-importmap": "npm run dev:payload generate:importmap",
@@ -58,9 +59,12 @@
5859
"maildev": "maildev --smtp=1025 --web=1080",
5960
"prepare": "husky",
6061
"prepublishOnly": "npm run clean && npm run build",
61-
"test": "npm run test:int && npm run test:e2e",
62-
"test:e2e": "npm run dev:build && dotenv -e ./dev/.env.test -- playwright test",
63-
"test:int": "npm run test:setup && dotenv -e ./dev/.env.test -- vitest run",
62+
"test": "nx run payload-better-auth:_test",
63+
"_test": "npm run test:int && npm run test:e2e",
64+
"test:e2e": "nx run payload-better-auth:_test:e2e",
65+
"_test:e2e": "npm run dev:build && dotenv -e ./dev/.env.test -- playwright test",
66+
"test:int": "nx run payload-better-auth:_test:int",
67+
"_test:int": "npm run test:setup && dotenv -e ./dev/.env.test -- vitest run",
6468
"test:setup": "npm run reset:test",
6569
"typecheck": "nx run payload-better-auth:_typecheck",
6670
"_typecheck": "tsc --noEmit -p ./dev/tsconfig.json",

0 commit comments

Comments
 (0)