Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor, move from react-scripts to vite #333

Open
wants to merge 28 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
90f5c9c
fix: vendor vis-network-react, update failing test
mihirsamdarshi May 10, 2024
01a767c
fix: add corepack enable to Dockerfile
mihirsamdarshi May 10, 2024
da6ade6
feat: add vite-plugin-image-optimizer
mihirsamdarshi May 10, 2024
e4b3509
chore: rename .prettierrc
mihirsamdarshi Apr 23, 2024
f87bdad
refactor: move from react-scripts to vite
mihirsamdarshi Apr 23, 2024
a180b2f
chore: update .gitignore
mihirsamdarshi Apr 23, 2024
bc5680c
refactor: update motrpac-frontend to use react-router-dom
mihirsamdarshi Apr 23, 2024
5c3c1be
feat: update storybook config
mihirsamdarshi Apr 23, 2024
25d1366
test: update test to use Vitest
mihirsamdarshi Apr 23, 2024
0e174e4
chore: remove error-causing args from CircleCI config
mihirsamdarshi May 2, 2024
5319e4c
fix: update linting configurations
mihirsamdarshi May 3, 2024
a450cd3
feat: update to React 18
mihirsamdarshi May 3, 2024
ce6168f
build(ci): disable yarn caching until actions/setup-node#1027 is reso…
mihirsamdarshi May 3, 2024
6ea174c
feat: add rollup-plugin-visualizer
mihirsamdarshi May 3, 2024
a21d6b1
feat: add manual chunking for vis-network-react
mihirsamdarshi May 4, 2024
da0ed2f
fix: add preconnection to fonts.googleapis.com
mihirsamdarshi Jul 8, 2024
ab89bf3
refactor: scope styles to each page/component, add purgeCSS
mihirsamdarshi Jul 8, 2024
e3b1138
Merge branch 'dev' into refactor/vite
mihirsamdarshi Jul 9, 2024
41c4b22
fix: ensure consistent naming of environment variables
mihirsamdarshi Jul 23, 2024
43d12a5
Merge branch 'dev' into refactor/vite
mihirsamdarshi Jul 23, 2024
ca6b6f6
fix: only run purgeCSS during build
mihirsamdarshi Jul 23, 2024
9d4c146
fix: import createRoot from react-dom/client
mihirsamdarshi Jul 23, 2024
e513730
fix: add back React Helmet to Project Overview page
mihirsamdarshi Jul 24, 2024
c5b36f4
refactor: replace deprecated defaultProps with object default syntax
mihirsamdarshi Jul 24, 2024
7a794d0
fix: fix CSS issues by removing PurgeCSS
mihirsamdarshi Jul 24, 2024
ac0fe1e
fix: fix dashboard auth redirection
mihirsamdarshi Jul 24, 2024
c2a5173
chore: update Dockerfile to use latest NGINX version
mihirsamdarshi Jul 24, 2024
f9e092d
fix: tag image as latest in build_and_push.sh
mihirsamdarshi Jul 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ jobs:

- run:
name: Run Frontend tests
command: yarn test --updateSnapshot --ci
command: yarn test
# use this line instead if we version control snapshots
# command: yarn test --ci
4 changes: 3 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ node_modules/
README.md
LICENSE
.prettierignore
.eslintrc.js
eslint.config.cjs
.prettierrc.js
stylelint.config.js
.circleci/
.github/
scripts/
.storybook/
.env
build/
/.yarn/
29 changes: 0 additions & 29 deletions .eslintrc.js

This file was deleted.

18 changes: 12 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Run corepack enable
run: corepack enable

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
# cache: yarn

- name: Install project
run: yarn install --frozen-lockfile
Expand All @@ -28,20 +31,23 @@ jobs:
env:
ESLINT_NO_DEV_ERRORS: true
DISABLE_ESLINT_PLUGIN: true
REACT_APP_AUTH0_CLIENT_ID: "${{secrets.REACT_APP_AUTH0_CLIENT_ID}}"
REACT_APP_reCAPTCHA_SITE_KEY: "${{secrets.REACT_APP_reCAPTCHA_SITE_KEY}}"
run: yarn test --updateSnapshot --ci
VITE_AUTH0_CLIENT_ID: "${{secrets.VITE_AUTH0_CLIENT_ID}}"
VITE_RECAPTCHA_SITE_KEY: "${{secrets.VITE_RECAPTCHA_SITE_KEY}}"
run: yarn test

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Run corepack enable
run: corepack enable

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
# cache: yarn

- name: Install project
run: yarn install --frozen-lockfile
Expand All @@ -50,4 +56,4 @@ jobs:
env:
ESLINT_NO_DEV_ERRORS: true
DISABLE_ESLINT_PLUGIN: true
run: yarn sass && yarn build
run: yarn build
100 changes: 50 additions & 50 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,31 +177,31 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
REACT_APP_ES_PROXY_HOST="${{secrets.REACT_APP_ES_PROXY_HOST}}"
REACT_APP_API_SERVICE_ADDRESS="${{secrets.REACT_APP_API_SERVICE_ADDRESS}}"
REACT_APP_API_SERVICE_KEY="${{secrets.REACT_APP_API_SERVICE_KEY}}"
REACT_APP_SIGNED_URL_ENDPOINT="${{secrets.REACT_APP_SIGNED_URL_ENDPOINT}}"
REACT_APP_USER_REGISTRATION_ENDPOINT="${{secrets.REACT_APP_USER_REGISTRATION_ENDPOINT}}"
REACT_APP_SEND_EMAIL_ENDPOINT="${{secrets.REACT_APP_SEND_EMAIL_ENDPOINT}}"
REACT_APP_FILE_DOWNLOAD_ENDPOINT="${{secrets.REACT_APP_FILE_DOWNLOAD_ENDPOINT}}"
REACT_APP_QC_DATA_ENDPOINT="${{secrets.REACT_APP_QC_DATA_ENDPOINT}}"
REACT_APP_ES_ENDPOINT="${{secrets.REACT_APP_ES_ENDPOINT}}"
REACT_APP_FILE_SEARCH_ENDPOINT="${{secrets.REACT_APP_FILE_SEARCH_ENDPOINT}}"
REACT_APP_DATA_FILE_BUCKET="${{secrets.REACT_APP_DATA_FILE_BUCKET}}"
REACT_APP_QC_REPORT_BUCKET="${{secrets.REACT_APP_QC_REPORT_BUCKET}}"
REACT_APP_ES_ACCESS_TOKEN="${{secrets.REACT_APP_ES_ACCESS_TOKEN}}"
REACT_APP_reCAPTCHA_SITE_KEY="${{secrets.REACT_APP_reCAPTCHA_SITE_KEY}}"
REACT_APP_AUTH0_CLIENT_ID="${{secrets.REACT_APP_AUTH0_CLIENT_ID}}"
REACT_APP_QUALTRICS_SURVEY_URL="${{secrets.REACT_APP_QUALTRICS_SURVEY_URL}}"
REACT_APP_USER_SURVEY_SUBMIT_URL="${{secrets.REACT_APP_USER_SURVEY_SUBMIT_URL}}"
REACT_APP_USER_SURVEY_INPUT_1="${{secrets.REACT_APP_USER_SURVEY_INPUT_1}}"
REACT_APP_USER_SURVEY_INPUT_2="${{secrets.REACT_APP_USER_SURVEY_INPUT_2}}"
REACT_APP_USER_SURVEY_INPUT_3="${{secrets.REACT_APP_USER_SURVEY_INPUT_3}}"
REACT_APP_USER_SURVEY_INPUT_4="${{secrets.REACT_APP_USER_SURVEY_INPUT_4}}"
REACT_APP_USER_SURVEY_INPUT_5="${{secrets.REACT_APP_USER_SURVEY_INPUT_5}}"
REACT_APP_OFFICE_HOUR_DAY="${{secrets.REACT_APP_OFFICE_HOUR_DAY}}"
REACT_APP_OFFICE_HOUR_DATE="${{secrets.REACT_APP_OFFICE_HOUR_DATE}}"
REACT_APP_OFFICE_HOUR_SIGNUP_URL="${{secrets.REACT_APP_OFFICE_HOUR_SIGNUP_URL}}"
VITE_ES_PROXY_HOST="${{secrets.VITE_ES_PROXY_HOST}}"
VITE_API_SERVICE_ADDRESS="${{secrets.VITE_API_SERVICE_ADDRESS}}"
VITE_API_SERVICE_KEY="${{secrets.VITE_API_SERVICE_KEY}}"
VITE_SIGNED_URL_ENDPOINT="${{secrets.VITE_SIGNED_URL_ENDPOINT}}"
VITE_USER_REGISTRATION_ENDPOINT="${{secrets.VITE_USER_REGISTRATION_ENDPOINT}}"
VITE_SEND_EMAIL_ENDPOINT="${{secrets.VITE_SEND_EMAIL_ENDPOINT}}"
VITE_FILE_DOWNLOAD_ENDPOINT="${{secrets.VITE_FILE_DOWNLOAD_ENDPOINT}}"
VITE_QC_DATA_ENDPOINT="${{secrets.VITE_QC_DATA_ENDPOINT}}"
VITE_ES_ENDPOINT="${{secrets.VITE_ES_ENDPOINT}}"
VITE_FILE_SEARCH_ENDPOINT="${{secrets.VITE_FILE_SEARCH_ENDPOINT}}"
VITE_DATA_FILE_BUCKET="${{secrets.VITE_DATA_FILE_BUCKET}}"
VITE_QC_REPORT_BUCKET="${{secrets.VITE_QC_REPORT_BUCKET}}"
VITE_ES_ACCESS_TOKEN="${{secrets.VITE_ES_ACCESS_TOKEN}}"
VITE_RECAPTCHA_SITE_KEY="${{secrets.VITE_RECAPTCHA_SITE_KEY}}"
VITE_AUTH0_CLIENT_ID="${{secrets.VITE_AUTH0_CLIENT_ID}}"
VITE_QUALTRICS_SURVEY_URL="${{secrets.VITE_QUALTRICS_SURVEY_URL}}"
VITE_USER_SURVEY_SUBMIT_URL="${{secrets.VITE_USER_SURVEY_SUBMIT_URL}}"
VITE_USER_SURVEY_INPUT_1="${{secrets.VITE_USER_SURVEY_INPUT_1}}"
VITE_USER_SURVEY_INPUT_2="${{secrets.VITE_USER_SURVEY_INPUT_2}}"
VITE_USER_SURVEY_INPUT_3="${{secrets.VITE_USER_SURVEY_INPUT_3}}"
VITE_USER_SURVEY_INPUT_4="${{secrets.VITE_USER_SURVEY_INPUT_4}}"
VITE_USER_SURVEY_INPUT_5="${{secrets.VITE_USER_SURVEY_INPUT_5}}"
VITE_OFFICE_HOUR_DAY="${{secrets.VITE_OFFICE_HOUR_DAY}}"
VITE_OFFICE_HOUR_DATE="${{secrets.VITE_OFFICE_HOUR_DATE}}"
VITE_OFFICE_HOUR_SIGNUP_URL="${{secrets.VITE_OFFICE_HOUR_SIGNUP_URL}}"

- name: Build and push server image (dev)
if: github.ref != 'refs/heads/master'
Expand All @@ -216,28 +216,28 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
REACT_APP_ES_PROXY_HOST="${{secrets.REACT_APP_ES_PROXY_HOST_DEV}}"
REACT_APP_API_SERVICE_ADDRESS="${{secrets.REACT_APP_API_SERVICE_ADDRESS_DEV}}"
REACT_APP_API_SERVICE_KEY="${{secrets.REACT_APP_API_SERVICE_KEY_DEV}}"
REACT_APP_SIGNED_URL_ENDPOINT="${{secrets.REACT_APP_SIGNED_URL_ENDPOINT}}"
REACT_APP_USER_REGISTRATION_ENDPOINT="${{secrets.REACT_APP_USER_REGISTRATION_ENDPOINT}}"
REACT_APP_SEND_EMAIL_ENDPOINT="${{secrets.REACT_APP_SEND_EMAIL_ENDPOINT}}"
REACT_APP_FILE_DOWNLOAD_ENDPOINT="${{secrets.REACT_APP_FILE_DOWNLOAD_ENDPOINT}}"
REACT_APP_QC_DATA_ENDPOINT="${{secrets.REACT_APP_QC_DATA_ENDPOINT}}"
REACT_APP_ES_ENDPOINT="${{secrets.REACT_APP_ES_ENDPOINT}}"
REACT_APP_FILE_SEARCH_ENDPOINT="${{secrets.REACT_APP_FILE_SEARCH_ENDPOINT}}"
REACT_APP_DATA_FILE_BUCKET="${{secrets.REACT_APP_DATA_FILE_BUCKET}}"
REACT_APP_QC_REPORT_BUCKET="${{secrets.REACT_APP_QC_REPORT_BUCKET_DEV}}"
REACT_APP_ES_ACCESS_TOKEN="${{secrets.REACT_APP_ES_ACCESS_TOKEN_DEV}}"
REACT_APP_reCAPTCHA_SITE_KEY="${{secrets.REACT_APP_reCAPTCHA_SITE_KEY}}"
REACT_APP_AUTH0_CLIENT_ID="${{secrets.REACT_APP_AUTH0_CLIENT_ID}}"
REACT_APP_QUALTRICS_SURVEY_URL="${{secrets.REACT_APP_QUALTRICS_SURVEY_URL}}"
REACT_APP_USER_SURVEY_SUBMIT_URL="${{secrets.REACT_APP_USER_SURVEY_SUBMIT_URL}}"
REACT_APP_USER_SURVEY_INPUT_1="${{secrets.REACT_APP_USER_SURVEY_INPUT_1}}"
REACT_APP_USER_SURVEY_INPUT_2="${{secrets.REACT_APP_USER_SURVEY_INPUT_2}}"
REACT_APP_USER_SURVEY_INPUT_3="${{secrets.REACT_APP_USER_SURVEY_INPUT_3}}"
REACT_APP_USER_SURVEY_INPUT_4="${{secrets.REACT_APP_USER_SURVEY_INPUT_4}}"
REACT_APP_USER_SURVEY_INPUT_5="${{secrets.REACT_APP_USER_SURVEY_INPUT_5}}"
REACT_APP_OFFICE_HOUR_DAY="${{secrets.REACT_APP_OFFICE_HOUR_DAY}}"
REACT_APP_OFFICE_HOUR_DATE="${{secrets.REACT_APP_OFFICE_HOUR_DATE}}"
REACT_APP_OFFICE_HOUR_SIGNUP_URL="${{secrets.REACT_APP_OFFICE_HOUR_SIGNUP_URL}}"
VITE_ES_PROXY_HOST="${{secrets.VITE_ES_PROXY_HOST_DEV}}"
VITE_API_SERVICE_ADDRESS="${{secrets.VITE_API_SERVICE_ADDRESS_DEV}}"
VITE_API_SERVICE_KEY="${{secrets.VITE_API_SERVICE_KEY_DEV}}"
VITE_SIGNED_URL_ENDPOINT="${{secrets.VITE_SIGNED_URL_ENDPOINT}}"
VITE_USER_REGISTRATION_ENDPOINT="${{secrets.VITE_USER_REGISTRATION_ENDPOINT}}"
VITE_SEND_EMAIL_ENDPOINT="${{secrets.VITE_SEND_EMAIL_ENDPOINT}}"
VITE_FILE_DOWNLOAD_ENDPOINT="${{secrets.VITE_FILE_DOWNLOAD_ENDPOINT}}"
VITE_QC_DATA_ENDPOINT="${{secrets.VITE_QC_DATA_ENDPOINT}}"
VITE_ES_ENDPOINT="${{secrets.VITE_ES_ENDPOINT}}"
VITE_FILE_SEARCH_ENDPOINT="${{secrets.VITE_FILE_SEARCH_ENDPOINT}}"
VITE_DATA_FILE_BUCKET="${{secrets.VITE_DATA_FILE_BUCKET}}"
VITE_QC_REPORT_BUCKET="${{secrets.VITE_QC_REPORT_BUCKET_DEV}}"
VITE_ES_ACCESS_TOKEN="${{secrets.VITE_ES_ACCESS_TOKEN_DEV}}"
VITE_RECAPTCHA_SITE_KEY="${{secrets.VITE_RECAPTCHA_SITE_KEY}}"
VITE_AUTH0_CLIENT_ID="${{secrets.VITE_AUTH0_CLIENT_ID}}"
VITE_QUALTRICS_SURVEY_URL="${{secrets.VITE_QUALTRICS_SURVEY_URL}}"
VITE_USER_SURVEY_SUBMIT_URL="${{secrets.VITE_USER_SURVEY_SUBMIT_URL}}"
VITE_USER_SURVEY_INPUT_1="${{secrets.VITE_USER_SURVEY_INPUT_1}}"
VITE_USER_SURVEY_INPUT_2="${{secrets.VITE_USER_SURVEY_INPUT_2}}"
VITE_USER_SURVEY_INPUT_3="${{secrets.VITE_USER_SURVEY_INPUT_3}}"
VITE_USER_SURVEY_INPUT_4="${{secrets.VITE_USER_SURVEY_INPUT_4}}"
VITE_USER_SURVEY_INPUT_5="${{secrets.VITE_USER_SURVEY_INPUT_5}}"
VITE_OFFICE_HOUR_DAY="${{secrets.VITE_OFFICE_HOUR_DAY}}"
VITE_OFFICE_HOUR_DATE="${{secrets.VITE_OFFICE_HOUR_DATE}}"
VITE_OFFICE_HOUR_SIGNUP_URL="${{secrets.VITE_OFFICE_HOUR_SIGNUP_URL}}"
89 changes: 81 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
Expand All @@ -16,11 +21,12 @@ lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
Expand All @@ -36,15 +42,27 @@ build/Release
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

Expand All @@ -54,11 +72,62 @@ typings/
# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# next.js build output
# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# Mac autogenerated folder information (file color/position/etc)
.DS_Store
Expand All @@ -73,7 +142,11 @@ src/__snapshots__/*
# VS Code user settings
.vscode/

# Jetbrains IDE settings
.idea/
# Build files
build/

.yarnrc.yml
.yarn

.terraform/
# generated by rollup-plugin-visualizer
stats.html
4 changes: 4 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
arrowParens: 'always',
singleQuote: true,
};
4 changes: 0 additions & 4 deletions .prettierrc.js

This file was deleted.

2 changes: 0 additions & 2 deletions .storybook/addons.js

This file was deleted.

15 changes: 0 additions & 15 deletions .storybook/config.js

This file was deleted.

16 changes: 16 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
*
* @type {import('@storybook/react-vite').StorybookConfig}
*/
module.exports = {
framework: {
name: "@storybook/react-vite",
},
stories: ["../src/**/*.stories.@(js|jsx|ts|tsx)"],

docs: {
autodocs: true
},

addons: ['storybook-addon-remix-react-router', '@storybook/addon-actions', "@storybook/addon-links"]
}
Loading