File tree 5 files changed +66
-398
lines changed
5 files changed +66
-398
lines changed Original file line number Diff line number Diff line change 5
5
"version" : " 2.6.11" ,
6
6
"type" : " module" ,
7
7
"scripts" : {
8
- "dev" : " vite" ,
9
- "start" : " serve -s dist" ,
10
- "build" : " tsc && vite build" ,
11
- "preview" : " vite preview" ,
12
- "test" : " vitest run" ,
13
- "test:coverage" : " vitest run --coverage" ,
14
- "test:verbose" : " vitest run --reporter=verbose --coverage.thresholds.lines=90 --coverage.thresholds.functions=90 --coverage.thresholds.branches=90 --coverage.thresholds.statements=90" ,
15
- "test:ui" : " vitest --ui" ,
16
- "format" : " prettier --write ." ,
17
- "format:check" : " prettier --check --write=false ." ,
18
- "lint" : " eslint --max-warnings=0 ." ,
19
- "lint:fix" : " eslint --fix ." ,
20
- "type-check" : " tsc --noEmit"
8
+ "cli" : " VITE_CONFIG=./vite.config.ts ../scripts/frontend/cli $@"
21
9
},
22
10
"repository" : {
23
11
"type" : " git" ,
47
35
"react-dom" : " ^18.2.0" ,
48
36
"react-redux" : " ^9.1.0" ,
49
37
"react-router-dom" : " ^6.23.1" ,
50
- "serve" : " ^14.2.3" ,
51
38
"sirv" : " ^3.0.0" ,
52
39
"yup" : " ^1.1.1"
53
40
},
97
84
" @semantic-release/github"
98
85
]
99
86
}
100
- }
87
+ }
Original file line number Diff line number Diff line change 1
1
// Shorthand to access environment variables.
2
- export default import . meta. env as Record < string , string >
2
+ export default Object . defineProperty ( import . meta. env , "vite" , {
3
+ writable : false ,
4
+ value : new Proxy ( import . meta. env , {
5
+ get : ( target , name : string ) => target [ `VITE_${ name } ` ] ,
6
+ } ) ,
7
+ } ) as ImportMetaEnv & { vite : Record < string , string > }
3
8
4
9
export * from "./custom"
5
10
export * from "./vite"
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Shared Vite configuration for all frontend services.
3
+ *
4
+ * Vite: https://vitest.dev/config/
5
+ * Vitest: https://vitest.dev/config/
6
+ *
7
+ * NOTE: This doesn't belong in codeforlife-workspace/configs/frontend as it's
8
+ * still and a script which needs to be included in a Node.js runtime.
9
+ */
10
+
11
+ import { defineConfig } from "vitest/config"
12
+ import react from "@vitejs/plugin-react"
13
+
14
+ export default defineConfig ( {
15
+ plugins : [ react ( ) ] ,
16
+ resolve : {
17
+ alias : {
18
+ codeforlife : "codeforlife/src" ,
19
+ } ,
20
+ } ,
21
+ envDir : "env" ,
22
+ server : {
23
+ open : true ,
24
+ host : true ,
25
+ } ,
26
+ test : {
27
+ globals : true ,
28
+ environment : "jsdom" ,
29
+ setupFiles : "src/setupTests" ,
30
+ mockReset : true ,
31
+ coverage : {
32
+ enabled : true ,
33
+ provider : "istanbul" ,
34
+ reporter : [ "html" , "cobertura" ] ,
35
+ } ,
36
+ } ,
37
+ optimizeDeps : {
38
+ // TODO: investigate which of these are needed
39
+ include : [
40
+ "@mui/x-date-pickers" ,
41
+ "@mui/x-date-pickers/AdapterDayjs" ,
42
+ "dayjs" ,
43
+ "dayjs/locale/en-gb" ,
44
+ "@mui/icons-material" ,
45
+ "yup" ,
46
+ "formik" ,
47
+ ] ,
48
+ } ,
49
+ } )
Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ import react from "@vitejs/plugin-react"
2
2
import { defineConfig } from "vitest/config"
3
3
4
4
// https://vitejs.dev/config/
5
+ // TODO: https://vite.dev/guide/build.html#library-mode
6
+ // TODO: import common configs from src/vite.config.ts
5
7
export default defineConfig ( {
6
8
plugins : [ react ( ) ] ,
7
9
server : {
You can’t perform that action at this time.
0 commit comments