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

Switch to Bun #623

Draft
wants to merge 23 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
50650d1
Update node to 16
aviupadhyayula Feb 18, 2024
aadb79f
Update Dockerfile to node16
aviupadhyayula Feb 18, 2024
b0bf4cf
Pass in node16 to shared actions
aviupadhyayula Feb 18, 2024
9c71b0a
Update TS linting, enable legacy SSL
aviupadhyayula Feb 19, 2024
e89bb3f
Fix pageProps type
aviupadhyayula Feb 19, 2024
5409e99
Make linter happy
aviupadhyayula Feb 19, 2024
541e8cb
Update yarn lockfile
aviupadhyayula Feb 19, 2024
be79e1a
Builds on node 18 + latest versions of everything. Adapted Input comp…
julianweng Feb 20, 2024
9cb1e62
Bump node in build step
julianweng Feb 20, 2024
9e7b3b0
Add Node 18 to build step as well
julianweng Feb 20, 2024
f6684a8
Update build image
julianweng Feb 20, 2024
ed7c23d
Node 20, fix Links, and attempt to move stylesheet imports to _document
julianweng Feb 20, 2024
428cb1d
Fix TextField styling
julianweng Feb 20, 2024
9fd22ab
Definitely not a typo
julianweng Feb 20, 2024
dbad1d9
Merge branch 'master' into bump-frontend-dependencies
julianweng Feb 20, 2024
bed701c
Fix add club button, tag deletion, textarea, orderinput dropdown trig…
julianweng Feb 20, 2024
741e1a9
Fix multi-select tag delete and downgrade react-datepicker.
julianweng Feb 21, 2024
e831b47
Use next Script tag
aviupadhyayula Feb 21, 2024
b6c4d91
BUN!
julianweng Feb 23, 2024
7c8dd0a
Suppress hydration warnings for dates to satisfy bun
julianweng Feb 23, 2024
71db670
Add next middleware proxy library
julianweng Feb 24, 2024
14cb4e8
update frontend Dockerfile
rm03 Feb 27, 2024
d197a5b
update pre-commit to use bun
rm03 Feb 27, 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
1 change: 1 addition & 0 deletions .github/workflows/build-and-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
uses: pennlabs/shared-actions/.github/workflows/[email protected]
with:
path: frontend
nodeVersion: 20.11.1

build-backend:
name: Build backend
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ repos:
require_serial: true
files: ^backend/
- id: frontend
name: Yarn Linter
entry: bash -c "cd frontend && yarn lint"
name: Bun Linter
entry: bash -c "cd frontend && bun lint"
language: system
files: ^frontend/
require_serial: false
Expand Down
24 changes: 9 additions & 15 deletions frontend/.babelrc
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
{
"presets": [
"next/babel"
],
"plugins": [
"istanbul"
],
"env": {
"production": {
"plugins": [["styled-components", { "ssr": true }]]
},
"development": {
"plugins": [
"babel-plugin-styled-components"
]
}
"presets": ["next/babel"],
"plugins": ["istanbul"],
"env": {
"production": {
"plugins": [["styled-components", { "ssr": true }]]
},
"development": {
"plugins": ["babel-plugin-styled-components"]
}
}
}
1 change: 1 addition & 0 deletions frontend/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
}
],
"no-unused-vars": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
"unused-imports/no-unused-imports-ts": "error",
"camelcase": ["warn", { "ignoreDestructuring": true }],
Expand Down
12 changes: 6 additions & 6 deletions frontend/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"endOfLine": "lf",
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"useTabs": false,
"trailingComma": "all"
"endOfLine": "lf",
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"useTabs": false,
"trailingComma": "all"
}
10 changes: 3 additions & 7 deletions frontend/.storybook/.babelrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"presets": [
"next/babel"
],
"plugins": [
"styled-components"
]
}
"presets": ["next/babel"],
"plugins": ["styled-components"]
}
8 changes: 6 additions & 2 deletions frontend/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
module.exports = {
stories: ['../components/**/*.stories.@(js|ts|mdx|tsx)'],
addons: ['@storybook/addon-actions/register', '@storybook/addon-links/register', '@storybook/addon-docs'],
stories: ['../components/**/*.stories.@(js|ts|mdx|tsx)'],
addons: [
'@storybook/addon-actions/register',
'@storybook/addon-links/register',
'@storybook/addon-docs',
],
}
4 changes: 2 additions & 2 deletions frontend/.storybook/preview-head.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.0/css/bulma.min.css"
integrity="sha256-aPeK/N8IHpHsvPBCf49iVKMdusfobKo2oxF8lRruWJg="
crossOrigin="anonymous"
crossorigin="anonymous"
/>
<!-- Fonts-->
<link
Expand Down Expand Up @@ -31,4 +31,4 @@
.prismjs .token.plain-text {
color: white;
}
</style>
</style>
38 changes: 19 additions & 19 deletions frontend/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"editor.tabSize": 2,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/.next": true,
"**/.nyc_output": true
},
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/*.code-search": true,
"**/coverage": true
}
"editor.tabSize": 2,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/.next": true,
"**/.nyc_output": true
},
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/*.code-search": true,
"**/coverage": true
}
}
19 changes: 14 additions & 5 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
FROM node:14.14.0-buster-slim
FROM node:20.11.1-buster-slim

LABEL maintainer="Penn Labs"

RUN apt-get update \
&& apt-get install --no-install-recommends -y curl unzip openssl ca-certificates \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we can consider using the docker image instead? https://hub.docker.com/r/oven/bun/tags

&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Install bun
RUN curl -fsSL https://bun.sh/install | bash && \
ln -s ~/.bun/bin/bun /usr/local/bin/bun

WORKDIR /app/

# Copy project dependencies
COPY package.json /app/
COPY yarn.lock /app/
COPY bun.lockb /app/

# Install project dependencies
RUN yarn install --frozen-lockfile --production=false
RUN bun install --frozen-lockfile

# Copy project files
COPY . /app/
Expand All @@ -18,6 +27,6 @@ COPY . /app/
ENV NEXT_TELEMETRY_DISABLED=1

# Build project
RUN yarn build
RUN bun run build

CMD ["yarn", "start"]
CMD ["bun", "start"]
Binary file added frontend/bun.lockb
Binary file not shown.
49 changes: 24 additions & 25 deletions frontend/components/Applications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const MainInfo = styled.div`
flex-direction: row;
`
type CardProps = {
readonly hovering?: boolean
readonly $hovering?: boolean
className?: string
}

Expand All @@ -63,7 +63,7 @@ const Card = styled.div<CardProps>`
transition: all ${ANIMATION_DURATION}ms ease;
border-radius: ${BORDER_RADIUS};
box-shadow: 0 0 0 ${WHITE};
background-color: ${({ hovering }) => (hovering ? HOVER_GRAY : WHITE)};
background-color: ${({ $hovering }) => ($hovering ? HOVER_GRAY : WHITE)};
border: 1px solid ${ALLBIRDS_GRAY};
justify-content: space-between;
height: auto;
Expand Down Expand Up @@ -105,35 +105,34 @@ function ApplicationsPage({ whartonapplications }): ReactElement {
{whartonapplications != null && whartonapplications.length > 0 ? (
whartonapplications.map((application) => (
<CardWrapper className={'column is-half-desktop'}>
<Link href={application.external_url}>
<a target="_blank">
<Card className="card">
<MainInfo>
<div>
<ClubName>{application.name}</ClubName>
<DateInterval
start={application.application_start_time}
end={application.application_end_time}
/>
</div>
<div>
{application.club_image_url != null &&
application.club_image_url !== '' && (
<LazyLoad>
<Image src={application.club_image_url} />
</LazyLoad>
)}
</div>
</MainInfo>
{application.description && application.description.length && (
<Link href={application.external_url} target="_blank">
<Card className="card">
<MainInfo>
<div>
<ClubName>{application.name}</ClubName>
<DateInterval
start={application.application_start_time}
end={application.application_end_time}
/>
</div>
<div>
{application.club_image_url != null &&
application.club_image_url !== '' && (
<LazyLoad>
<Image src={application.club_image_url} />
</LazyLoad>
)}
</div>
</MainInfo>
{application.description &&
application.description.length && (
<DescriptionWrapper
dangerouslySetInnerHTML={{
__html: application.description,
}}
></DescriptionWrapper>
)}
</Card>
</a>
</Card>
</Link>
</CardWrapper>
))
Expand Down
73 changes: 32 additions & 41 deletions frontend/components/ClubCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const Description = styled.p`
`

type CardProps = {
readonly hovering?: boolean
readonly $hovering?: boolean
className?: string
}

Expand All @@ -46,7 +46,7 @@ const Card = styled.div<CardProps>`
transition: all ${ANIMATION_DURATION}ms ease;
border-radius: ${BORDER_RADIUS};
box-shadow: 0 0 0 ${WHITE};
background-color: ${({ hovering }) => (hovering ? HOVER_GRAY : WHITE)};
background-color: ${({ $hovering }) => ($hovering ? HOVER_GRAY : WHITE)};
border: 1px solid ${ALLBIRDS_GRAY};
justify-content: space-between;
height: auto;
Expand Down Expand Up @@ -97,55 +97,46 @@ type ClubCardProps = {
}

const ClubCard = ({ club, fullWidth }: ClubCardProps): ReactElement => {
const {
name,
active,
approved,
subtitle,
tags,
enables_subscription,
code,
} = club
const { name, active, approved, subtitle, tags, enables_subscription, code } =
club
const img = club.image_url
const textDescription = shorten(subtitle || 'This club has no description.')

return (
<CardWrapper className={fullWidth ? '' : 'column is-half-desktop'}>
<Link href={CLUB_ROUTE()} as={CLUB_ROUTE(code)}>
<a target="_blank">
<Card className="card">
<div style={{ display: 'flex' }}>
<div style={{ flex: 1 }}>
<div>
<CardHeader>
<CardTitle className="is-size-5">{name}</CardTitle>
</CardHeader>
</div>
{!active && (
<InactiveTag className="tag is-rounded">Inactive</InactiveTag>
)}
{approved === null && (
<InactiveTag className="tag is-rounded">
Pending Approval
</InactiveTag>
)}
{approved === false && (
<InactiveTag className="tag is-rounded">Rejected</InactiveTag>
)}
<TagGroup tags={tags} />
<Link href={CLUB_ROUTE()} as={CLUB_ROUTE(code)} target="_blank">
<Card className="card">
<div style={{ display: 'flex' }}>
<div style={{ flex: 1 }}>
<div>
<CardHeader>
<CardTitle className="is-size-5">{name}</CardTitle>
</CardHeader>
</div>
{img && (
<LazyLoad height={62} offset={800}>
<Image src={img} alt={`${name} Logo`} />
</LazyLoad>
{!active && (
<InactiveTag className="tag is-rounded">Inactive</InactiveTag>
)}
{approved === null && (
<InactiveTag className="tag is-rounded">
Pending Approval
</InactiveTag>
)}
{approved === false && (
<InactiveTag className="tag is-rounded">Rejected</InactiveTag>
)}
<TagGroup tags={tags} />
</div>
{img && (
<LazyLoad height={62} offset={800}>
<Image src={img} alt={`${name} Logo`} />
</LazyLoad>
)}
</div>

<Description>{textDescription}</Description>
<Description>{textDescription}</Description>

<ClubDetails club={club} />
</Card>
</a>
<ClubDetails club={club} />
</Card>
</Link>
</CardWrapper>
)
Expand Down
3 changes: 2 additions & 1 deletion frontend/components/ClubEditPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ const ClubForm = ({
{showInactiveTag && <InactiveTag />}
{
<Link
legacyBehavior
href={isViewButton ? CLUB_ROUTE() : HOME_ROUTE}
as={isViewButton && club ? CLUB_ROUTE(club.code) : HOME_ROUTE}
>
Expand All @@ -410,7 +411,7 @@ const ClubForm = ({
<b>Before creating your {OBJECT_NAME_SINGULAR},</b> please check to{' '}
see if it already exists on the{' '}
<Link href={DIRECTORY_ROUTE} as={DIRECTORY_ROUTE}>
<a>directory page</a>
directory page
</Link>
. If your {OBJECT_NAME_SINGULAR} already exists, please email{' '}
<Contact /> to gain access instead of filling out this form.
Expand Down
Loading
Loading