-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ASAP-249 Migrate frontend to Vite (#3989)
* convert to vite * fix packages and jest config * add babelrc and tweak jest config * fix linting and package errors * fix service worker env var refs * fix unsupported browser test for CRN * update bundlwatch dir * change s3 destination dir * add prod sourcemap generation * fix api missing url * revert auth config file * convert gp2 to vite * add gp2 frontend to bundlewatch * fix lint service worker * update and fix release for sentry * update flags env vars * update readme's * fix the config to use import.meta instead of process * fix tests * remove remaining react-scripts bits * remove comments * update pnp cjs * support browserslist --------- Co-authored-by: Quentin Leonetti <[email protected]> Co-authored-by: Gabriela Ueno <[email protected]>
- Loading branch information
1 parent
057057c
commit 0c1a942
Showing
50 changed files
with
2,316 additions
and
2,096 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file added
BIN
+3.68 KB
.yarn/cache/browserslist-to-esbuild-npm-1.2.0-0b060cd242-a6c1adc2ad.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
presets: [ | ||
[require.resolve('@babel/preset-react'), { runtime: 'automatic' }], | ||
require.resolve('babel-preset-vite'), | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,11 +6,10 @@ | |
"node": "18.x" | ||
}, | ||
"scripts": { | ||
"start": "cross-env TSC_COMPILE_ON_ERROR=true react-scripts start", | ||
"build": "node ./scripts/build-unsupported-browser-page.js && DISABLE_ESLINT_PLUGIN=true react-scripts build", | ||
"start": "cross-env TSC_COMPILE_ON_ERROR=true vite", | ||
"build": "node ./scripts/build-unsupported-browser-page.js && vite build", | ||
"typecheck": "tsc", | ||
"test": "echo Run the workspace root script instead", | ||
"eject": "react-scripts eject", | ||
"release:frontend": "node ./scripts/sentry-release.js" | ||
}, | ||
"dependencies": { | ||
|
@@ -26,8 +25,10 @@ | |
"@asap-hub/unsupported-browser-page": "workspace:*", | ||
"@asap-hub/validation": "workspace:*", | ||
"@auth0/auth0-spa-js": "1.22.6", | ||
"@babel/preset-react": "7.23.3", | ||
"@sentry/react": "6.19.7", | ||
"@sentry/tracing": "6.19.7", | ||
"@vitejs/plugin-react": "^4.2.0", | ||
"browser-image-compression": "1.0.17", | ||
"csv-stringify": "6.4.4", | ||
"date-fns": "2.30.0", | ||
|
@@ -45,7 +46,8 @@ | |
"stream": "npm:[email protected]", | ||
"use-debounce": "8.0.4", | ||
"use-deep-compare-effect": "1.6.1", | ||
"uuid": "8.3.2" | ||
"uuid": "8.3.2", | ||
"vite": "5.0.4" | ||
}, | ||
"devDependencies": { | ||
"@asap-hub/dom-test-utils": "workspace:*", | ||
|
@@ -71,13 +73,15 @@ | |
"@types/testing-library__react": "10.0.1", | ||
"@types/testing-library__react-hooks": "3.4.1", | ||
"@types/uuid": "8.3.4", | ||
"babel-preset-vite": "^1.1.0", | ||
"browserslist-to-esbuild": "^1.2.0", | ||
"browserslist-useragent-regexp": "3.0.2", | ||
"cross-env": "7.0.3", | ||
"identity-obj-proxy": "3.0.0", | ||
"jest-transform-css": "^6.0.1", | ||
"jose": "2.0.6", | ||
"nock": "13.4.0", | ||
"pirates": "4.0.6", | ||
"react-scripts": "5.0.1", | ||
"react-test-renderer": "17.0.2", | ||
"typescript": "4.9.5", | ||
"webpack": "5.76.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
export const GTM_CONTAINER_ID = process.env.REACT_APP_CRN_GTM_CONTAINER_ID; | ||
export const GTM_CONTAINER_ID = import.meta.env.VITE_APP_CRN_GTM_CONTAINER_ID; | ||
export const API_BASE_URL = | ||
process.env.REACT_APP_API_BASE_URL || 'http://localhost:3333'; | ||
import.meta.env.VITE_APP_API_BASE_URL || 'http://localhost:3333'; | ||
export const ALGOLIA_APP_ID = | ||
process.env.REACT_APP_CRN_ALGOLIA_APP_ID || 'LVYWOPQ0A9'; | ||
import.meta.env.VITE_APP_CRN_ALGOLIA_APP_ID || 'LVYWOPQ0A9'; | ||
export const ALGOLIA_INDEX = | ||
process.env.REACT_APP_CRN_ALGOLIA_INDEX || 'asap-hub_dev'; | ||
export const SENTRY_DSN = process.env.REACT_APP_CRN_SENTRY_DSN; | ||
export const ENVIRONMENT = process.env.REACT_APP_ENVIRONMENT || 'local'; | ||
export const RELEASE = process.env.REACT_APP_RELEASE; | ||
export const AUTH0_AUDIENCE = process.env.REACT_APP_CRN_AUTH0_AUDIENCE || ''; | ||
export const AUTH0_CLIENT_ID = process.env.REACT_APP_CRN_AUTH0_CLIENT_ID || ''; | ||
export const AUTH0_DOMAIN = process.env.REACT_APP_CRN_AUTH0_DOMAIN || ''; | ||
import.meta.env.VITE_APP_CRN_ALGOLIA_INDEX || 'asap-hub_dev'; | ||
export const SENTRY_DSN = import.meta.env.VITE_APP_CRN_SENTRY_DSN; | ||
export const ENVIRONMENT = import.meta.env.VITE_APP_ENVIRONMENT || 'local'; | ||
export const RELEASE = import.meta.env.VITE_APP_RELEASE; | ||
export const AUTH0_AUDIENCE = import.meta.env.VITE_APP_CRN_AUTH0_AUDIENCE || ''; | ||
export const AUTH0_CLIENT_ID = | ||
import.meta.env.VITE_APP_CRN_AUTH0_CLIENT_ID || ''; | ||
export const AUTH0_DOMAIN = import.meta.env.VITE_APP_CRN_AUTH0_DOMAIN || ''; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/// <reference types="vite/client" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { defineConfig } from 'vite'; | ||
import react from '@vitejs/plugin-react'; | ||
import browserslistToEsbuild from 'browserslist-to-esbuild'; | ||
|
||
export default defineConfig({ | ||
plugins: [react()], | ||
build: { | ||
sourcemap: true, | ||
target: browserslistToEsbuild(), | ||
}, | ||
server: { | ||
open: true, | ||
port: 3000, | ||
}, | ||
define: { | ||
global: 'globalThis', | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
presets: [ | ||
[require.resolve('@babel/preset-react'), { runtime: 'automatic' }], | ||
require.resolve('babel-preset-vite'), | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.