Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
71 changes: 0 additions & 71 deletions .eslintrc.js

This file was deleted.

35 changes: 0 additions & 35 deletions .github/actions/setup-pnpm/action.yaml

This file was deleted.

33 changes: 0 additions & 33 deletions .github/workflows/build.yaml

This file was deleted.

73 changes: 43 additions & 30 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,54 @@ on:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.2

- name: get build info
id: build_info
run: echo timestamp=$(git show -s --format=%cI) >> $GITHUB_OUTPUT

- run: bun install
- run: bun run build:production
env:
VITE_APP_GIT_SHA: ${{ github.sha }}
VITE_APP_GIT_TIMESTAMP: ${{ steps.build_info.outputs.timestamp }}

- name: Upload built project
uses: actions/upload-artifact@v4
with:
path: ./dist
overwrite: true
retention-days: 1
name: build-artifacts-${{ github.run_id }}

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-pnpm
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.2

- run: |
pnpm install
cd ./node_modules/puppeteer
pnpm install
bun install
node ./node_modules/puppeteer/install.js || true

- run: pnpm run build:development
- run: bun run build:development

- name: Lint
run: pnpm lint
run: bun run lint

- name: Run unit tests
run: pnpm test
run: bun run test

- name: Run end-to-end tests
run: pnpm test-puppeteer-build
run: bun run test-puppeteer-build

# bundle_size:
# runs-on: ubuntu-latest
Expand All @@ -47,22 +74,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-pnpm
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.2

- run: pnpm install
- run: pnpm build:production
- run: bun install
- run: bun run build:production

- name: run Lighthouse CI
run: |
pnpm add -g @lhci/cli@0.12.x
lhci autorun
run: bunx @lhci/cli@0.12.x autorun
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}

docker:
runs-on: ubuntu-latest
needs: [test]
if: github.ref == 'refs/heads/master' && github.repository == 'commaai/connect'
permissions:
packages: write
contents: read
Expand All @@ -71,13 +96,6 @@ jobs:
- id: buildx
uses: docker/setup-buildx-action@v2

- uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-

- uses: docker/login-action@v3
with:
registry: ghcr.io
Expand Down Expand Up @@ -108,12 +126,7 @@ jobs:
SENTRY_RELEASE=${{ github.event_name == 'push' && github.sha || github.event.pull_request.head.sha }}
builder: ${{ steps.buildx.outputs.name }}
context: .
push: true
pull: true
push: ${{ github.ref == 'refs/heads/master' && github.repository == 'commaai/connect' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new

- run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
18 changes: 18 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
welcome!

our goal is to modernize and cleanup this ancient codebase.
you are a refactoring machine! you love clean code and ripping out complexity.
and i will wisely guide you.

your loop is:
- evaluate the options and come up with a plan. you should have already read all the code so you can offer a concrete plan
- i will give feedback and an approval
- if i give feedback, please present the plan again given the feedback before proceeding

for all changes, make sure to:
- run the tests: bun run jest
- run the linter: bun lint
- run the formatter: bun format

some more tips:
- always prioritize the simple, straightforward changes over risky big ones
24 changes: 12 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
FROM node:20-alpine AS base

ARG PNPM_VERSION=8.6.3
RUN npm install -g pnpm@$PNPM_VERSION
WORKDIR /app
FROM oven/bun:latest AS base

# needed to fix bun SSL bug
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates \
&& rm -rf /var/lib/apt/lists/*

FROM base AS build
WORKDIR /app

COPY ./pnpm-lock.yaml .
RUN pnpm fetch
FROM base AS builder
COPY package.json bun.lock ./
RUN bun install

ADD . ./
RUN pnpm install --offline
COPY . .

ARG VITE_APP_GIT_SHA=unknown
ARG VITE_APP_GIT_TIMESTAMP=1970-01-01T00:00:00Z
Expand All @@ -21,14 +21,14 @@ ENV VITE_APP_GIT_SHA $VITE_APP_GIT_SHA
ENV VITE_APP_GIT_TIMESTAMP $VITE_APP_GIT_TIMESTAMP
ENV SENTRY_AUTH_TOKEN $SENTRY_AUTH_TOKEN
ENV SENTRY_RELEASE $SENTRY_RELEASE
RUN pnpm build:production

RUN bun run build:production

FROM nginx:1.24

COPY config.js.template /etc/nginx/templates/config.js.template
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist /usr/share/nginx/html
COPY --from=builder /app/dist /usr/share/nginx/html

ENV NGINX_ENVSUBST_OUTPUT_DIR /usr/share/nginx/html

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
The frontend to the comma connect progressive web app. This a react app using [Create React App](https://github.com/facebookincubator/create-react-app)

## Development
* Install pnpm: https://pnpm.io/installation
* Install dependencies: `pnpm install`
* Start dev server: `pnpm start`
* Install Bun: https://bun.sh
* Install dependencies: `bun install`
* Start dev server: `bun run start`

## Contributing

Expand Down
45 changes: 45 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"root": true,
"files": {
"includes": ["src/**/*"]
},
"formatter": {
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 180
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"jsxQuoteStyle": "double",
"semicolons": "always",
"trailingCommas": "all"
},
"globals": ["gtag", "jestPuppeteer", "page", "jest", "describe", "it", "beforeAll", "afterAll", "beforeEach", "afterEach", "expect", "test", "AppleID"]
},
"linter": {
"rules": {
"recommended": false,
"correctness": "warn",
"style": "off",
"suspicious": "off",
"security": "off",
"performance": "off",
"complexity": "off",
"nursery": "off",
"a11y": "off"
}
},
"overrides": [
{
"includes": ["**/*.jsx", "**/*.tsx"],
"linter": {
"rules": {
"correctness": {
"noSolidDestructuredProps": "off"
}
}
}
}
]
}
Loading