Skip to content

Commit ba4076d

Browse files
refactor: migrate monorepo to bun v1.3.x (#480)
* refactor: migrate monorepo to bun v1.3.x * refactor(feed-sync): update Dockerfile to copy source instead of dist for runtime * fix: use bun instead of pnpm * chore: update netlify config * chore: remove trailing whitespace * chore: use bun run test * chore: update netlify config * chore: use bun run test * chore: update scripts * fix: attempt workflow fix * fix: attempt workflow fix * chore: keep workflow changes minimal * chore: cleanup Dockerfile * chore: minimize Dockerfile changes * chore: minimize Dockerfile changes * chore: minimize Dockerfile changes * chore: update vitest to version 4.0.10 + replace tsx with bun in tool-network-spammer * Update packages/reader-main/package.json Co-authored-by: Jerónimo Albi <894299+jeronimoalbi@users.noreply.github.com> * Update packages/frontend-main/package.json Co-authored-by: Jerónimo Albi <894299+jeronimoalbi@users.noreply.github.com> * Update packages/api-main/package.json Co-authored-by: Jerónimo Albi <894299+jeronimoalbi@users.noreply.github.com> --------- Co-authored-by: Jerónimo Albi <894299+jeronimoalbi@users.noreply.github.com>
1 parent 280e764 commit ba4076d

File tree

25 files changed

+2650
-10432
lines changed

25 files changed

+2650
-10432
lines changed

.github/workflows/frontend-build.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,16 @@ jobs:
3030

3131
steps:
3232
- name: Checkout code
33-
uses: actions/checkout@v3
34-
35-
- name: Install pnpm with npm
36-
run: npm install -g pnpm
33+
uses: actions/checkout@v4
3734

38-
- uses: actions/setup-node@v4
35+
- name: Setup Bun
36+
uses: oven-sh/setup-bun@v2
3937
with:
40-
node-version-file: .nvmrc
41-
cache: pnpm
38+
bun-version: 1.3.2
4239

43-
- name: Install dependencies with pnpm
44-
run: pnpm install
40+
- name: Install dependencies
41+
run: bun install
4542

4643
- name: Verify Build
4744
working-directory: ./packages/frontend-main
48-
run: pnpm build
45+
run: bun run build

.github/workflows/lint.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,15 @@ jobs:
1212

1313
steps:
1414
- name: Checkout code
15-
uses: actions/checkout@v3
15+
uses: actions/checkout@v4
1616

17-
- name: Install pnpm with npm
18-
run: npm install -g pnpm
19-
20-
- uses: actions/setup-node@v4
17+
- name: Setup Bun
18+
uses: oven-sh/setup-bun@v2
2119
with:
22-
node-version-file: .nvmrc
23-
cache: pnpm
20+
bun-version: 1.3.2
2421

25-
- name: Install dependencies with pnpm
26-
run: pnpm install
22+
- name: Install dependencies
23+
run: bun install
2724

2825
- name: Lint
29-
run: pnpm run lint
26+
run: bun run lint

.github/workflows/npm-publish.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,31 @@ jobs:
1818
- name: Checkout repository
1919
uses: actions/checkout@v4
2020

21-
- name: Set up Node.js
21+
- name: Setup Bun
22+
uses: oven-sh/setup-bun@v2
23+
with:
24+
bun-version: 1.3.2
25+
26+
- name: Set up Node.js for NPM publish
2227
uses: actions/setup-node@v4
2328
with:
2429
node-version: 20
2530
registry-url: 'https://registry.npmjs.org/'
26-
scope: '@atomone'
27-
28-
- name: Install pnpm
29-
run: npm install -g pnpm
31+
scope: '@dither.chat'
3032

3133
- name: Install dependencies
3234
run: |
3335
cd ./packages/${{ github.event.inputs.package }}
34-
pnpm install
36+
bun install
3537
3638
- name: Build package
3739
run: |
3840
cd ./packages/${{ github.event.inputs.package }}
39-
pnpm run build
41+
bun run build
4042
4143
- name: Publish to NPM
4244
env:
4345
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4446
run: |
4547
cd ./packages/${{ github.event.inputs.package }}
46-
pnpm publish --access public --no-git-checks
48+
bun publish --access public --no-git-checks

.github/workflows/smoke-tests.yml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,19 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Checkout code
15-
uses: actions/checkout@v3
15+
uses: actions/checkout@v4
1616

17-
- name: Install pnpm with npm
18-
run: npm install -g pnpm
19-
20-
- uses: actions/setup-node@v4
17+
- name: Setup Bun
18+
uses: oven-sh/setup-bun@v2
2119
with:
22-
node-version-file: .nvmrc
23-
cache: pnpm
24-
25-
- name: Install dependencies with pnpm
26-
run: pnpm install
20+
bun-version: 1.3.2
2721

28-
- name: Build dependencies
29-
working-directory: packages/api-main
30-
run: pnpm run build:deps
22+
- name: Install dependencies
23+
run: bun install
3124

3225
- name: Run tests
3326
working-directory: packages/api-main
34-
run: pnpm run test:smoke
27+
run: bun run test:smoke
3528
env:
3629
APP_NAME: ${{ inputs.app_name }}
3730

.github/workflows/test.yml

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,32 +29,25 @@ jobs:
2929
3030
steps:
3131
- name: Checkout code
32-
uses: actions/checkout@v3
32+
uses: actions/checkout@v4
3333

34-
- name: Install pnpm with npm
35-
run: npm install -g pnpm
36-
37-
- uses: actions/setup-node@v4
34+
- name: Setup Bun
35+
uses: oven-sh/setup-bun@v2
3836
with:
39-
node-version-file: .nvmrc
40-
cache: pnpm
41-
42-
- name: Install dependencies with pnpm
43-
run: pnpm install
37+
bun-version: 1.3.2
4438

45-
- name: Build dependencies
46-
working-directory: packages/api-main
47-
run: pnpm build:deps
39+
- name: Install dependencies
40+
run: bun install
4841

4942
- name: Setup database schema
5043
working-directory: packages/api-main
51-
run: pnpm db:push:force
44+
run: bun run db:push:force
5245
env:
5346
PG_URI: postgresql://default:password@localhost:5432/postgres
5447

5548
- name: Run tests
5649
working-directory: packages/api-main
57-
run: pnpm test
50+
run: bun run test
5851
env:
5952
NODE_OPTIONS: --experimental-global-webcrypto
6053
PG_URI: postgresql://default:password@localhost:5432/postgres

.github/workflows/testnet-api-main.yml

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,43 +32,48 @@ jobs:
3232
runs-on: ubuntu-latest
3333
steps:
3434
- name: Checkout code
35-
uses: actions/checkout@v3
35+
uses: actions/checkout@v4
3636

37-
- name: Install pnpm with npm
38-
run: npm install -g pnpm
37+
- name: Setup Bun
38+
uses: oven-sh/setup-bun@v2
39+
with:
40+
bun-version: 1.3.2
3941

4042
- name: Create Directory
4143
run: mkdir -p ./packages/api-main/data/postgres_data
4244

43-
- name: Setup Node.js
44-
uses: actions/setup-node@v4
45-
with:
46-
node-version-file: .nvmrc
47-
cache: pnpm
48-
49-
- name: Install dependencies with pnpm
50-
run: pnpm install
45+
- name: Install dependencies
46+
run: bun install
5147

5248
- name: Set up Docker
5349
uses: docker/setup-docker-action@v4
5450

55-
- name: Build API Types
56-
working-directory: ./packages/lib-api-types
57-
run: pnpm build
58-
5951
- name: Run Docker Compose Up
6052
working-directory: ./packages/api-main
6153
run: docker compose -f ./docker-compose-github.yml up --build -d --wait --wait-timeout 30
6254

63-
- name: Push database migrations
55+
- name: Wait for database to be ready
6456
working-directory: ./packages/api-main
6557
run: |
66-
cp .env.example .env
67-
pnpm db:push:force
58+
until docker exec postgres_db pg_isready -U default; do
59+
sleep 1
60+
done
61+
62+
- name: Push database migrations
63+
working-directory: ./packages/api-main
64+
run: bun run db:push:force
65+
env:
66+
PG_URI: postgresql://default:password@localhost:5432/postgres
6867

69-
- name: Run tests with pnpm
68+
- name: Run tests
7069
working-directory: ./packages/api-main
71-
run: pnpm test
70+
run: bun run test
71+
env:
72+
NODE_OPTIONS: --experimental-global-webcrypto
73+
PG_URI: postgresql://default:password@localhost:5432/postgres
74+
JWT: default_jwt_secret
75+
JWT_STRICTNESS: lax
76+
AUTH: whatever
7277

7378
build:
7479
needs: [detect-changes, test]

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pnpm lint-staged
1+
bunx lint-staged

Tiltfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@ docker_build('ditherchat/api-main', '.',
66
dockerfile = './packages/api-main/Dockerfile',
77
live_update = [
88
sync('./packages/api-main/src', '/app'),
9-
run('pnpm install', trigger='package.json'),
9+
run('bun install', trigger='package.json'),
1010
restart_container(),
1111
])
1212

1313
docker_build('ditherchat/reader-main', '.',
1414
dockerfile = './packages/reader-main/Dockerfile',
1515
live_update = [
1616
sync('./packages/reader-main/src', '/app'),
17-
run('pnpm install', trigger='package.json'),
17+
run('bun install', trigger='package.json'),
1818
restart_container(),
1919
])
2020

2121
local_resource(
2222
name='frontend-main',
2323
dir='./packages/frontend-main',
24-
cmd='pnpm install',
25-
serve_cmd='cd ./packages/frontend-main && pnpm run dev',
24+
cmd='bun install',
25+
serve_cmd='cd ./packages/frontend-main && bun run dev',
2626
resource_deps=['api-main'],
2727
deps=[
2828
'./packages/frontend-main/src',

0 commit comments

Comments
 (0)