From f22c38975b07e10b46df059219f785ae40b7de92 Mon Sep 17 00:00:00 2001 From: Jim O'Donnell Date: Wed, 22 May 2024 13:22:43 +0100 Subject: [PATCH] build(frontend): migrate from Create React App to Vite - add Vite packages and config. - update build scripts. - update ESLint config. - update SVG shape imports. - remove the old Express middleware proxy. - clean up unused dependencies. --- .gitignore | 3 + frontend/.eslintrc.js | 2 +- frontend/dev-proxy/proxy-table.dev.json | 16 + frontend/{public => }/index.html | 1 + frontend/package-lock.json | 12603 +++++----------------- frontend/package.json | 25 +- frontend/src/lib/map-shapes/shapes.tsx | 25 +- frontend/src/setupProxy.js | 42 - frontend/tsconfig-typings.json | 11 - frontend/tsconfig.json | 14 +- frontend/tsconfig.vite.json | 9 + frontend/vite-env.d.ts | 2 + frontend/vite.config.ts | 36 + 13 files changed, 2669 insertions(+), 10120 deletions(-) create mode 100644 frontend/dev-proxy/proxy-table.dev.json rename frontend/{public => }/index.html (95%) delete mode 100644 frontend/src/setupProxy.js delete mode 100644 frontend/tsconfig-typings.json create mode 100644 frontend/tsconfig.vite.json create mode 100644 frontend/vite-env.d.ts create mode 100644 frontend/vite.config.ts diff --git a/.gitignore b/.gitignore index 15d9e45a..9c7517c5 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,6 @@ terracotta.sqlite __pycache__ *.egg-info *.pyc + +# frontend config +proxy-table.json diff --git a/frontend/.eslintrc.js b/frontend/.eslintrc.js index e1f5db0f..a2f1e47f 100644 --- a/frontend/.eslintrc.js +++ b/frontend/.eslintrc.js @@ -1,5 +1,5 @@ module.exports = { - extends: ['react-app', 'eslint:recommended'], + extends: ['react-app', 'eslint:recommended', 'eslint-config-prettier'], rules: { 'react/prop-types': 'off', 'no-unused-vars': 'off', diff --git a/frontend/dev-proxy/proxy-table.dev.json b/frontend/dev-proxy/proxy-table.dev.json new file mode 100644 index 00000000..360c1f3f --- /dev/null +++ b/frontend/dev-proxy/proxy-table.dev.json @@ -0,0 +1,16 @@ +{ + "/vector": { + "target": "http://localhost:8080", + "changeOrigin": true, + "pathRewrite": { + "^/vector": "/" + } + }, + "/api": { + "target": "http://localhost:8888", + "changeOrigin": true, + "pathRewrite": { + "^/api": "/" + } + } +} diff --git a/frontend/public/index.html b/frontend/index.html similarity index 95% rename from frontend/public/index.html rename to frontend/index.html index 70179a05..3a5aaf92 100644 --- a/frontend/public/index.html +++ b/frontend/index.html @@ -20,6 +20,7 @@ You need to enable JavaScript to run this app.
+