Skip to content

Commit 1926a17

Browse files
committed
merge from main
2 parents db36396 + f616d2a commit 1926a17

File tree

5 files changed

+67
-14
lines changed

5 files changed

+67
-14
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## [2.6.12](https://github.com/ocadotechnology/codeforlife-package-javascript/compare/v2.6.11...v2.6.12) (2025-03-20)
2+
3+
4+
### Bug Fixes
5+
6+
* monitor release ([4bb40e1](https://github.com/ocadotechnology/codeforlife-package-javascript/commit/4bb40e1c0021c5371c64b3fb894b4fddccf19374))
7+
* Portal frontend 48 ([#82](https://github.com/ocadotechnology/codeforlife-package-javascript/issues/82)) ([b76b4b8](https://github.com/ocadotechnology/codeforlife-package-javascript/commit/b76b4b8dd4b5822820577a149d13992468c1cc0c))
8+
19
## [2.6.11](https://github.com/ocadotechnology/codeforlife-package-javascript/compare/v2.6.10...v2.6.11) (2025-02-25)
210

311

package.json

+2-13
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,10 @@
22
"name": "codeforlife",
33
"description": "Common frontend code",
44
"private": false,
5-
"version": "2.6.11",
5+
"version": "2.6.12",
66
"type": "module",
77
"scripts": {
8-
"dev": "vite",
9-
"build": "tsc && vite build",
10-
"preview": "vite preview",
11-
"test": "vitest run",
12-
"test:coverage": "vitest run --coverage",
13-
"test:verbose": "vitest run --reporter=verbose --coverage.thresholds.lines=90 --coverage.thresholds.functions=90 --coverage.thresholds.branches=90 --coverage.thresholds.statements=90",
14-
"test:ui": "vitest --ui",
15-
"format": "prettier --write .",
16-
"format:check": "prettier --check --write=false .",
17-
"lint": "eslint --max-warnings=0 .",
18-
"lint:fix": "eslint --fix .",
19-
"type-check": "tsc --noEmit"
8+
"cli": "VITE_CONFIG=./vite.config.ts ../scripts/frontend/cli $@"
209
},
2110
"repository": {
2211
"type": "git",

src/settings/index.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
// 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> }
38

49
export * from "./custom"
510
export * from "./vite"

src/vite.config.ts

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
})

vite.config.ts

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import react from "@vitejs/plugin-react"
22
import { defineConfig } from "vitest/config"
33

44
// https://vitejs.dev/config/
5+
// TODO: https://vite.dev/guide/build.html#library-mode
6+
// TODO: import common configs from src/vite.config.ts
57
export default defineConfig({
68
plugins: [react()],
79
server: {

0 commit comments

Comments
 (0)