Skip to content
Merged
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
11 changes: 6 additions & 5 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
name: Setup
description: Install Node.js, pnpm, and dependencies
description: Install Bun and dependencies

runs:
using: composite
steps:
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Install Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.2.23

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'

- name: Install dependencies
shell: bash
run: pnpm install
run: bun install
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'
45 changes: 29 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
uses: ./.github/actions/setup

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

eslint:
name: ESLint
Expand All @@ -47,13 +47,13 @@ jobs:
uses: ./.github/actions/setup

- name: Build MDX
run: pnpm build:mdx
run: bun build:mdx

- name: Generate Next.js route types
run: pnpm --filter web typegen
run: bun typegen

- name: Run ESLint
run: pnpm lint
run: bun lint

types:
name: TypeScript
Expand All @@ -66,13 +66,13 @@ jobs:
uses: ./.github/actions/setup

- name: Build MDX
run: pnpm build:mdx
run: bun build:mdx

- name: Generate Next.js route types
run: pnpm --filter web typegen
run: bun typegen

- name: Run type check
run: pnpm type-check
run: bun type-check

prettier:
name: Prettier
Expand All @@ -85,7 +85,7 @@ jobs:
uses: ./.github/actions/setup

- name: Run Prettier format check
run: pnpm format:check
run: bun format:check

spelling:
name: Spelling
Expand All @@ -98,7 +98,7 @@ jobs:
uses: ./.github/actions/setup

- name: Run spelling check
run: pnpm check:spelling
run: bun check:spelling

knip:
name: Knip
Expand All @@ -111,10 +111,23 @@ jobs:
uses: ./.github/actions/setup

- name: Build MDX
run: pnpm build:mdx
run: bun build:mdx

- name: Run Knip
run: pnpm check:knip
run: bun check:knip

i18n:
name: i18n
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4

- name: Configure environment
uses: ./.github/actions/setup

- name: Run i18n check
run: bun check:i18n

e2e:
name: End-to-end tests
Expand All @@ -128,7 +141,7 @@ jobs:
uses: ./.github/actions/setup

- name: Install Playwright with dependencies
run: pnpm playwright install --with-deps chromium --only-shell
run: bun playwright install --with-deps chromium --only-shell

- name: Create test posts and copy dummy images
run: |
Expand Down Expand Up @@ -187,19 +200,19 @@ jobs:
done

- name: Build apps
run: pnpm build:apps
run: bun build:apps

- name: Run services
run: docker compose up -d

- name: Migrate database
run: pnpm db:migrate
run: bun db:migrate

- name: Seed database
run: pnpm db:seed
run: bun db:seed

- name: Run Playwright tests
run: pnpm test:e2e
run: bun test:e2e

- name: Upload Playwright report
if: always()
Expand Down
16 changes: 2 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# Dependencies
node_modules/
.pnp/
.pnp.*

# Local env files
# Env files
.env*.local
.env

Expand All @@ -13,21 +11,11 @@ node_modules/
# Vercel
.vercel/

# Debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# Misc
.DS_Store
*.pem

# Build outputs
# Outputs
.next/
out/
build/
dist/

# Content Collections
.content-collections
Expand Down
4 changes: 2 additions & 2 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pnpm commitlint --edit $1
pnpm check:spelling $1
bun commitlint --edit $1
bun check:spelling $1
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pnpm lint-staged
bun lint-staged
1 change: 0 additions & 1 deletion .prettierignore

This file was deleted.

4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"configurations": [
{
"command": "pnpm dev",
"command": "bun dev",
"name": "Next.js: debug server-side",
"request": "launch",
"type": "node-terminal"
Expand All @@ -13,7 +13,7 @@
"url": "http://localhost:3000"
},
{
"command": "pnpm dev",
"command": "bun dev",
"name": "Next.js: debug full stack",
"request": "launch",
"serverReadyAction": {
Expand Down
54 changes: 27 additions & 27 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ nelsonlai-dev/
- Authentication: Better Auth
- API: oRPC for type-safe APIs
- Testing: Playwright for E2E, Vitest for unit tests
- Package Manager: pnpm (v10+)
- Package Manager: Bun
- Monorepo: Turborepo

### Content Management
Expand Down Expand Up @@ -128,10 +128,10 @@ export default Component

```bash
# Run E2E tests
pnpm test:e2e
bun test:e2e

# Run unit tests
pnpm test:unit
bun test:unit
```

### Test File Conventions
Expand Down Expand Up @@ -167,8 +167,8 @@ test('page loads correctly', async ({ page }) => {
When modifying database schema:

1. Edit schema files in `packages/db/src/schemas/`
2. Generate migration: `pnpm db:generate`
3. Apply migration: `pnpm db:migrate`
2. Generate migration: `bun db:generate`
3. Apply migration: `bun db:migrate`
4. Update types if needed

## API Development (oRPC)
Expand Down Expand Up @@ -250,8 +250,8 @@ Available scopes:

Before submitting:

1. Run `pnpm check` (includes lint, type-check, format)
2. Run `pnpm test:unit && pnpm test:e2e` for affected packages
1. Run `bun check` (includes lint, type-check, format)
2. Run `bun test:unit && bun test:e2e` for affected packages
3. Add/update tests for new features
4. Ensure no console errors
5. Test on mobile viewport
Expand All @@ -263,36 +263,36 @@ Before submitting:

```bash
# Install dependencies
pnpm install
bun install

# Development
pnpm dev # Run all apps and packages
pnpm dev:web # Run web app only
bun dev # Run all apps and packages
bun dev:web # Run web app only

# Building
pnpm build # Build all apps and packages
pnpm build:apps # Build all apps
pnpm build:mdx # Build MDX content
bun run build # Build all apps and packages
bun build:apps # Build all apps
bun build:mdx # Build MDX content

# Quality Checks
pnpm lint # Run ESLint
pnpm lint:fix # Fix ESLint issues
pnpm format:check # Check Prettier formatting
pnpm format:fix # Fix formatting
pnpm type-check # Run TypeScript checks
pnpm check:knip # Check for unused stuff
pnpm check:spelling # Check spelling
pnpm check # Run all checks
bun lint # Run ESLint
bun lint:fix # Fix ESLint issues
bun format:check # Check Prettier formatting
bun format:fix # Fix formatting
bun type-check # Run TypeScript checks
bun check:knip # Check for unused stuff
bun check:spelling # Check spelling
bun check # Run all checks

# Database
pnpm db:generate # Generate migrations
pnpm db:migrate # Apply migrations
pnpm db:seed # Seed database
pnpm db:studio # Open Drizzle Studio
bun db:generate # Generate migrations
bun db:migrate # Apply migrations
bun db:seed # Seed database
bun db:studio # Open Drizzle Studio

# Testing
pnpm test:e2e # Run E2E tests
pnpm test:unit # Run unit tests
bun test:e2e # Run E2E tests
bun test:unit # Run unit tests
```

## Common Patterns
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Welcome to the monorepo of my personal blog! This repository houses the code for
### Prerequisites

- Node.js with [corepack](https://nodejs.org/api/corepack.html) enabled
- pnpm
- Bun
- Docker
- [Visual Studio Code](https://code.visualstudio.com/) with [recommended extensions](.vscode/extensions.json)
- Optionally [React Developer Tools](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi?hl=en)
Expand All @@ -99,10 +99,10 @@ git clone https://github.com/nelsonlaidev/nelsonlai.dev
cd nelsonlai.dev
```

3. Install dependencies using pnpm:
3. Install dependencies using Bun:

```bash
pnpm install
bun install
```

### Environment Setup
Expand All @@ -122,23 +122,23 @@ docker compose up -d
3. Run the database migrations:

```bash
pnpm db:migrate
bun db:migrate
```

4. Seed the database:

```bash
pnpm db:seed
bun db:seed
```

5. Run the app:

```bash
pnpm dev # Run all services
bun dev # Run all services
# or
pnpm dev:web # Run only the web app
bun dev:web # Run only the web app
# or
pnpm dev:docs # Run only the documentation app
bun dev:docs # Run only the documentation app
```

The services will be available at the following URLs:
Expand Down
20 changes: 10 additions & 10 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
"author": "Nelson Lai <[email protected]> (https://github.com/nelsonlaidev/)",
"type": "module",
"scripts": {
"analyze": "cross-env ANALYZE=true pnpm with-env next build",
"build": "pnpm with-env next build --turbo",
"analyze": "cross-env ANALYZE=true bun with-env next build",
"build": "bun with-env next build --turbo",
"build:mdx": "content-collections build",
"clean": "rm -rf .next .turbo .content-collections test-results playwright-report",
"dev": "pnpm with-env next dev --turbopack -p 3000",
"dev": "bun with-env next dev --turbopack -p 3000",
"lint": "eslint . --max-warnings 0",
"lint:fix": "eslint --fix .",
"start": "pnpm with-env next start -p 3000",
"test:e2e": "pnpm with-env playwright test",
"test:e2e:inspector": "pnpm with-env playwright test $1 --debug",
"test:e2e:ui": "pnpm with-env playwright test --ui",
"start": "bun with-env next start -p 3000",
"test:e2e": "bun with-env playwright test",
"test:e2e:inspector": "bun with-env playwright test $1 --debug",
"test:e2e:ui": "bun with-env playwright test --ui",
"type-check": "tsc --noEmit",
"typegen": "pnpm with-env next typegen",
"with-env": "dotenvx run -f ../../.env.local --"
"typegen": "bun with-env next typegen",
"with-env": "dotenvx run -f ../../.env.local --ignore=MISSING_ENV_FILE --"
},
"lint-staged": {
"*.{mjs,ts,tsx}": "eslint --fix"
Expand Down Expand Up @@ -88,7 +88,7 @@
"@content-collections/core": "^0.11.1",
"@content-collections/mdx": "^0.2.2",
"@content-collections/next": "^0.2.7",
"@nelsonlaidev/eslint-config": "^2.1.0",
"@nelsonlaidev/eslint-config": "^2.1.1",
"@nelsonlaidev/typescript-config": "^0.0.3",
"@next/bundle-analyzer": "^15.5.3",
"@repo/kv": "workspace:*",
Expand Down
Loading