Skip to content

Commit

Permalink
Merge pull request #586 from nwplus/vite
Browse files Browse the repository at this point in the history
Vite migration
  • Loading branch information
DonaldKLee authored Jun 12, 2024
2 parents cab70c8 + 7621039 commit ee8e9eb
Show file tree
Hide file tree
Showing 107 changed files with 2,969 additions and 103 deletions.
40 changes: 20 additions & 20 deletions .github/workflows/firebase-hosting-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/setup-node@v3

- name: Set up firebase
run: sudo npm install -g firebase-tools
run: yarn global add firebase-tools

- name: Choose dev firebase project
if: ${{ env.IS_PRODUCTION == 'false' }}
Expand All @@ -28,33 +28,33 @@ jobs:
run: firebase use nwplus-ubc --token ${{ secrets.FIREBASE_TOKEN }}

- name: Install dependencies
run: npm install --force
run: yarn install --frozen-lockfile

- name: Build with dev env variables
if: ${{ env.IS_PRODUCTION == 'false' }}
run: npm run build:staging
run: yarn build:staging
env:
REACT_APP_FIREBASE_API_KEY: ${{ secrets.DEV_FIREBASE_API_KEY }}
REACT_APP_FIREBASE_AUTH_DOMAIN: ${{ secrets.DEV_FIREBASE_AUTH_DOMAIN }}
REACT_APP_FIREBASE_DATABASE_URL: ${{ secrets.DEV_FIREBASE_DATABASE_URL }}
REACT_APP_FIREBASE_PROJECT_ID: ${{ secrets.DEV_FIREBASE_PROJECT_ID }}
REACT_APP_FIREBASE_STORAGE_BUCKET: ${{ secrets.DEV_FIREBASE_STORAGE_BUCKET }}
REACT_APP_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.DEV_FIREBASE_MESSAGING_SENDER_ID }}
REACT_APP_FIREBASE_APP_ID: ${{ secrets.DEV_FIREBASE_APP_ID }}
REACT_APP_FIREBASE_MEASUREMENT_ID: ${{ secrets.DEV_FIREBASE_MEASUREMENT_ID }}
VITE_FIREBASE_API_KEY: ${{ secrets.DEV_FIREBASE_API_KEY }}
VITE_FIREBASE_AUTH_DOMAIN: ${{ secrets.DEV_FIREBASE_AUTH_DOMAIN }}
VITE_FIREBASE_DATABASE_URL: ${{ secrets.DEV_FIREBASE_DATABASE_URL }}
VITE_FIREBASE_PROJECT_ID: ${{ secrets.DEV_FIREBASE_PROJECT_ID }}
VITE_FIREBASE_STORAGE_BUCKET: ${{ secrets.DEV_FIREBASE_STORAGE_BUCKET }}
VITE_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.DEV_FIREBASE_MESSAGING_SENDER_ID }}
VITE_FIREBASE_APP_ID: ${{ secrets.DEV_FIREBASE_APP_ID }}
VITE_FIREBASE_MEASUREMENT_ID: ${{ secrets.DEV_FIREBASE_MEASUREMENT_ID }}

- name: Build with prod env variables
if: ${{ env.IS_PRODUCTION == 'true' }}
env:
REACT_APP_FIREBASE_API_KEY: ${{ secrets.FIREBASE_API_KEY }}
REACT_APP_FIREBASE_AUTH_DOMAIN: ${{ secrets.FIREBASE_AUTH_DOMAIN }}
REACT_APP_FIREBASE_DATABASE_URL: ${{ secrets.FIREBASE_DATABASE_URL }}
REACT_APP_FIREBASE_PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }}
REACT_APP_FIREBASE_STORAGE_BUCKET: ${{ secrets.FIREBASE_STORAGE_BUCKET }}
REACT_APP_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.FIREBASE_MESSAGING_SENDER_ID }}
REACT_APP_FIREBASE_APP_ID: ${{ secrets.FIREBASE_APP_ID }}
REACT_APP_FIREBASE_MEASUREMENT_ID: ${{ secrets.FIREBASE_MEASUREMENT_ID }}
run: npm run build
VITE_FIREBASE_API_KEY: ${{ secrets.FIREBASE_API_KEY }}
VITE_FIREBASE_AUTH_DOMAIN: ${{ secrets.FIREBASE_AUTH_DOMAIN }}
VITE_FIREBASE_DATABASE_URL: ${{ secrets.FIREBASE_DATABASE_URL }}
VITE_FIREBASE_PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }}
VITE_FIREBASE_STORAGE_BUCKET: ${{ secrets.FIREBASE_STORAGE_BUCKET }}
VITE_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.FIREBASE_MESSAGING_SENDER_ID }}
VITE_FIREBASE_APP_ID: ${{ secrets.FIREBASE_APP_ID }}
VITE_FIREBASE_MEASUREMENT_ID: ${{ secrets.FIREBASE_MEASUREMENT_ID }}
run: yarn build

- name: Deploy to dev firebase project
if: ${{ env.IS_PRODUCTION == 'false' }}
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/firebase-hosting-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ jobs:
uses: actions/setup-node@v3
- run: yarn install --frozen-lockfile && yarn build:staging
env:
REACT_APP_FIREBASE_API_KEY: ${{ secrets.DEV_FIREBASE_API_KEY }}
REACT_APP_FIREBASE_AUTH_DOMAIN: ${{ secrets.DEV_FIREBASE_AUTH_DOMAIN }}
REACT_APP_FIREBASE_DATABASE_URL: ${{ secrets.DEV_FIREBASE_DATABASE_URL }}
REACT_APP_FIREBASE_PROJECT_ID: ${{ secrets.DEV_FIREBASE_PROJECT_ID }}
REACT_APP_FIREBASE_STORAGE_BUCKET: ${{ secrets.DEV_FIREBASE_STORAGE_BUCKET }}
REACT_APP_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.DEV_FIREBASE_MESSAGING_SENDER_ID }}
REACT_APP_FIREBASE_APP_ID: ${{ secrets.DEV_FIREBASE_APP_ID }}
REACT_APP_FIREBASE_MEASUREMENT_ID: ${{ secrets.DEV_FIREBASE_MEASUREMENT_ID }}
VITE_FIREBASE_API_KEY: ${{ secrets.DEV_FIREBASE_API_KEY }}
VITE_FIREBASE_AUTH_DOMAIN: ${{ secrets.DEV_FIREBASE_AUTH_DOMAIN }}
VITE_FIREBASE_DATABASE_URL: ${{ secrets.DEV_FIREBASE_DATABASE_URL }}
VITE_FIREBASE_PROJECT_ID: ${{ secrets.DEV_FIREBASE_PROJECT_ID }}
VITE_FIREBASE_STORAGE_BUCKET: ${{ secrets.DEV_FIREBASE_STORAGE_BUCKET }}
VITE_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.DEV_FIREBASE_MESSAGING_SENDER_ID }}
VITE_FIREBASE_APP_ID: ${{ secrets.DEV_FIREBASE_APP_ID }}
VITE_FIREBASE_MEASUREMENT_ID: ${{ secrets.DEV_FIREBASE_MEASUREMENT_ID }}
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
/node_modules
/.pnp
.pnp.js
yarn.lock

# secrets
.env
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ We hope for Portal to
0. Please use `node v16`, 17+ doesn't work.
1. Setup `.env` file to contain
```bash
REACT_APP_FIREBASE_API_KEY=...
REACT_APP_FIREBASE_AUTH_DOMAIN=...
REACT_APP_FIREBASE_DATABASE_URL=...
REACT_APP_FIREBASE_PROJECT_ID=...
REACT_APP_FIREBASE_STORAGE_BUCKET=...
REACT_APP_FIREBASE_MESSAGING_SENDER_ID=...
REACT_APP_FIREBASE_APP_ID=...
REACT_APP_FIREBASE_MEASUREMENT_ID=...
VITE_FIREBASE_API_KEY=...
VITE_FIREBASE_AUTH_DOMAIN=...
VITE_FIREBASE_DATABASE_URL=...
VITE_FIREBASE_PROJECT_ID=...
VITE_FIREBASE_STORAGE_BUCKET=...
VITE_FIREBASE_MESSAGING_SENDER_ID=...
VITE_FIREBASE_APP_ID=...
VITE_FIREBASE_MEASUREMENT_ID=...
```
2. run `yarn && yarn start` to start the development server on `http://localhost:3000/`

Expand Down
24 changes: 3 additions & 21 deletions public/index.html → index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,15 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon_default.ico" />
<link rel="icon" href="/favicon_default.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Live event information for events hosted by nwPlus" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<link rel="manifest" href="/manifest.json" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta2/css/all.min.css"
Expand All @@ -40,15 +31,6 @@
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
<script type="module" src="/src/index.jsx"></script>
</body>
</html>
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"cross-env": "^7.0.2",
"firebase": "^7.17.1",
"html2canvas": "^1.4.1",
Expand All @@ -16,7 +13,6 @@
"react-csv": "^2.2.1",
"react-dom": "^18.2.0",
"react-markdown": "^4.3.1",
"react-scripts": "5.0.1",
"react-select": "^3.1.0",
"react-spinner": "^0.2.7",
"react-spinners": "^0.9.0",
Expand All @@ -25,11 +21,10 @@
"wouter": "^2.5.1"
},
"scripts": {
"start": "react-scripts start",
"build:staging": "cross-env REACT_APP_ENV=STAGING react-scripts build",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"dev": "vite",
"build:staging": "cross-env VITE_ENV=STAGING vite build",
"build": "vite build",
"serve": "vite preview",
"deploy": "yarn build && firebase deploy --only hosting:nwplus-ubc",
"deploy:dev": "yarn build && firebase deploy --only hosting:nwplus-ubc-dev"
},
Expand All @@ -54,7 +49,12 @@
}
},
"devDependencies": {
"@vitejs/plugin-react": "^4.2.1",
"browserslist": "^4.23.0",
"browserslist-to-esbuild": "^2.1.1",
"prettier": "^2.1.2",
"pretty-quick": "^3.1.0"
"pretty-quick": "^3.1.0",
"vite": "^5.2.11",
"vite-plugin-svgr": "^4.2.0"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import styled from 'styled-components'
import { format } from 'timeago.js'
import { format } from 'timeago'
import ReactMarkdown from 'react-markdown'
import { Card, CardWithHeader } from './Common'
import { P, A } from './Typography'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState } from 'react'
import styled from 'styled-components'
import { ReactComponent as HandWave } from '../assets/hand-wave.svg'
import Icon from '../components/Icon'
import HandWave from '../assets/hand-wave.svg?react'
import Icon from './Icon'
import {
ANALYTICS_EVENTS,
APPLICATION_STATUS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
QuestionHeading,
ErrorSpan as Required,
} from '../Typography'
import { FormSpacing, SubHeading } from './'
import { FormSpacing, SubHeading } from './index'

const genderOptions = [
{ value: 'female', label: 'Woman' },
Expand Down Expand Up @@ -456,7 +456,10 @@ const BasicInfo = ({ refs, errors, formInputs, onChange }) => (
What is your current age?
<Required />
</SubHeading>
<P>We accept hackers currently in high school but require this information for consent purposes.</P>
<P>
We accept hackers currently in high school but require this information for consent
purposes.
</P>
{errors?.ageByHackathon && <ErrorMessage>{errors?.ageByHackathon}</ErrorMessage>}
<Dropdown
options={ageOptions}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { FormSpacing } from '.'
import { FormSpacing } from './index'
import { A, CenteredH1, P } from '../Typography'

const HackathonInfo = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react'
import { Select, TextInput } from '../../components/Input'
import { ErrorMessage, QuestionHeading, ErrorSpan as Required } from '../../components/Typography'
import { Select, TextInput } from '../Input'
import { ErrorMessage, QuestionHeading, ErrorSpan as Required } from '../Typography'
import { copyText } from '../../utility/Constants'
import { CenteredH1 } from '../Typography'
import { FormSpacing, SubHeading } from './'
import { FormSpacing, SubHeading } from './index'

// const StyledDropdown = styled(Dropdown)`
// .react-select__control {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { SocialMediaLinks } from '../ApplicationDashboard'
import Banner from '../Banner'
import { Button, Checkbox } from '../Input'
import { A, H1, P, QuestionHeading, ErrorSpan as Required } from '../Typography'
import { FormSpacing, SubHeading } from './'
import { FormSpacing, SubHeading } from './index'

const ReviewContainer = styled.div`
position: relative;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Select, TextArea, TextInput } from '../Input'
import Dropdown from '../Input/Dropdown'
import ResumeUploadBtn from '../ResumeUploadBtn'
import { CenteredH1, ErrorMessage, P, QuestionHeading, ErrorSpan as Required } from '../Typography'
import { FormSpacing, SubHeading } from './'
import { FormSpacing, SubHeading } from './index'

const hackathonsAttendedOptions = [
{ value: '0', label: '0' },
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/components/Faq.js → src/components/Faq.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import Accordion from '../components/Accordion'
import Accordion from './Accordion'
import { chunkify } from '../utility/utilities'
import { DetailAnswer, DetailColumn, DetailContainer } from './Common'
import { H2 } from './Typography'
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react'
import { useCallback } from 'react'
import styled from 'styled-components'
import { ScrollbarLike, TextInputLike } from '../Common.js'
import { ScrollbarLike, TextInputLike } from '../Common'
import { ErrorMessage, Message } from '../Typography'

const TextAreaBox = styled.textarea.attrs({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import styled from 'styled-components'
import { TextInputLike, TextInputNoOutline } from '../Common.js'
import { TextInputLike, TextInputNoOutline } from '../Common'
import { ErrorMessage } from '../Typography'

const inputSize = {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import styled from 'styled-components'
import { Link } from 'wouter'
import { MAX_CHARACTERS_IN_DESCRIPTION } from '../../utility/Constants'
import { cutString } from '../../utility/utilities'
import { CardLike } from '../Common.js'
import { CardLike } from '../Common'
import { Button } from '../Input/Button'
import { H2, P } from '../Typography'

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import styled, { keyframes } from 'styled-components'
import { CardWithHeader } from '../components/Common.js'
import { H2 } from '../components/Typography'
import { CardWithHeader } from './Common'
import { H2 } from './Typography'

const Container = styled(CardWithHeader)`
text-align: center;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import QuicklinksCard from '../components/QuicklinksCard'
import QuicklinksCard from './QuicklinksCard'
import { chunkify } from '../utility/utilities'

import { DetailContainer, DetailColumn } from './Common'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { A, UL, LI } from './Typography'
import { CardWithHeader } from '../components/Common'
import { CardWithHeader } from './Common'

export default ({ title, links }) => {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useRef } from 'react'
import { Button } from '../components/Input'
import { Button } from './Input'
import styled from 'styled-components'
import { ErrorMessage } from './Typography'

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const MobileFlexColumn = styled.div`
align-items: center;
`

// These styles are a copy of what's in Common.js
// These styles are a copy of what's in Common.jsx
// I'm doing this because we're styling Schedule uniquely for cmd-f 2022
// TODO: We should change this back to what it was before this PR
const OverflowContainer = styled.div`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import styled from 'styled-components'
import { EVENT_TYPES } from './Constants'
import { ReactComponent as Icon } from '../../assets/scheduleTag.svg'
import Icon from '../../assets/scheduleTag.svg?react'

export const TagLegendContainer = styled.div`
display: flex;
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/components/Sidebar.js → src/components/Sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ const Sidebar = ({
links.tools.push({ location: '/judging/admin', text: 'Judging Admin' })
}

if (process.env.NODE_ENV !== 'production') {
if (import.meta.env.NODE_ENV !== 'production') {
links.information.push({ location: '/charcuterie', text: 'CHARCUTERIE' })
}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/containers/Schedule.js → src/containers/Schedule.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState, useEffect } from 'react'
import ScheduleC from '../components/Schedule/'
import ScheduleC from '../components/Schedule'
import { db } from '../utility/firebase'
import { DB_COLLECTION, DB_HACKATHON, DAYOF_COLLECTION } from '../utility/Constants'
import { livesiteDocRef } from '../utility/firebase'
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/pages/Charcuterie.js → src/pages/Charcuterie.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react'
import { H1, H2, H3, P, A, QuestionHeading } from '../components/Typography'
import { Card } from '../components/Common.js'
import { Card } from '../components/Common'
import { Button, TextInput, TextArea, Checkbox, Select, Dropdown } from '../components/Input'
import Accordion from '../components/Accordion'
import Countdown from '../containers/Countdown'
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit ee8e9eb

Please sign in to comment.