Skip to content

Commit

Permalink
replace pnpm with bun (#555)
Browse files Browse the repository at this point in the history
  • Loading branch information
lihebi authored Sep 29, 2023
1 parent 3337565 commit 400bbc5
Show file tree
Hide file tree
Showing 17 changed files with 63 additions and 13,452 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ plugin](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vsco
to format your code before checking in.
Last but not least, give us a star on Github!


# Citation

https://arxiv.org/abs/2301.02410
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"@apollo/client": "^3.8.3",
"@codepod/ui": "workspace:^",
"@codepod/ui": "workspace:*",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.10.9",
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop-yjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"@apollo/client": "^3.7.1",
"@codepod/prisma": "workspace:*",
"@codepod/yjs": "workspace:^",
"@codepod/yjs": "workspace:*",
"@kubernetes/client-node": "^0.17.1",
"apollo-server": "^3.5.0",
"apollo-server-core": "^3.10.3",
Expand Down
2 changes: 1 addition & 1 deletion apps/electron-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"typescript": "~4.5.4"
},
"dependencies": {
"@codepod/ui": "workspace:^",
"@codepod/ui": "workspace:*",
"@electron-forge/shared-types": "^6.4.1",
"electron-squirrel-startup": "^1.0.0",
"react": "^18.2.0",
Expand Down
6 changes: 3 additions & 3 deletions apps/spawner/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "yjs",
"name": "spawner",
"version": "1.0.0",
"license": "MIT",
"scripts": {
Expand All @@ -12,8 +12,8 @@
"dependencies": {
"@apollo/client": "^3.7.1",
"@codepod/prisma": "workspace:*",
"@codepod/runtime": "workspace:^",
"@codepod/yjs": "workspace:^",
"@codepod/runtime": "workspace:*",
"@codepod/yjs": "workspace:*",
"@kubernetes/client-node": "^0.17.1",
"apollo-server": "^3.5.0",
"apollo-server-core": "^3.10.3",
Expand Down
2 changes: 1 addition & 1 deletion apps/web-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"@apollo/client": "^3.8.3",
"@codepod/ui": "workspace:^",
"@codepod/ui": "workspace:*",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.10.9",
Expand Down
2 changes: 1 addition & 1 deletion apps/web-yjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"@apollo/client": "^3.7.1",
"@codepod/prisma": "workspace:*",
"@codepod/yjs": "workspace:^",
"@codepod/yjs": "workspace:*",
"@kubernetes/client-node": "^0.17.1",
"apollo-server": "^3.5.0",
"apollo-server-core": "^3.10.3",
Expand Down
Binary file added bun.lockb
Binary file not shown.
25 changes: 3 additions & 22 deletions compose/desktop/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,6 @@
version: "3.5"

services:
# Run: docker compose up setup
# Then run: docker compose up -d
setup:
image: node:18
working_dir: /codepod
volumes:
- ../..:/codepod
# pnpm-store serves two purposes:
# 1. without it, pnpm install will throw error. Ref:
# https://github.com/pnpm/pnpm/issues/3952#issuecomment-1262136483
# 2. it is mounted to all service containers, and will cache and speed up
# pnpm install and pnpm add/remove
- pnpm-store:/codepod/.pnpm-store
command: sh -c "corepack enable && pnpm install && echo '=== Setup Finished, idling ===' && tail -f /dev/null"

api:
image: node:18
working_dir: /codepod/apps/desktop-api
Expand All @@ -25,8 +10,7 @@ services:
volumes:
- ../..:/codepod
- desktop-var-codepod:/var/codepod
- pnpm-store:/codepod/.pnpm-store
command: sh -c "corepack enable && pnpm dev"
command: sh -c "npm run dev"

yjs:
image: node:18
Expand All @@ -35,10 +19,9 @@ services:
- 4234:4233
volumes:
- ../..:/codepod
- pnpm-store:/codepod/.pnpm-store
- desktop-var-codepod:/var/codepod
- /var/run/docker.sock:/var/run/docker.sock
command: sh -c "corepack enable && pnpm dev"
command: sh -c "npm run dev"

ui:
image: node:18
Expand All @@ -54,11 +37,9 @@ services:
# VITE_APP_SPAWNER_API_URL: "http://localhost:4021/graphql"
volumes:
- ../..:/codepod
- pnpm-store:/codepod/.pnpm-store
command: sh -c "corepack enable && pnpm dev"
command: sh -c "npm run dev"

volumes:
pnpm-store:
desktop-var-codepod:

networks:
Expand Down
6 changes: 6 additions & 0 deletions compose/web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ RUN pip install ipykernel

ENV HOME /root

# Install bun
RUN apt-get install -y unzip
RUN curl -fsSL https://bun.sh/install | bash
ENV BUN_INSTALL="/root/.bun"
ENV PATH=$BUN_INSTALL/bin:$PATH

# Docker won't let us source nvm.sh directly, so we have several options: (ref:
# https://stackoverflow.com/a/55922307)
# 1. Avoid env. But nodejs binary package is hard to install.
Expand Down
40 changes: 7 additions & 33 deletions compose/web/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,10 @@ services:
volumes:
- db-data:/var/lib/postgresql/data

# Run: docker compose up setup
# Then run: docker compose up -d
setup:
image: node:18
working_dir: /codepod
depends_on:
- db
volumes:
- ../..:/codepod
# pnpm-store serves two purposes:
# 1. without it, pnpm install will throw error. Ref:
# https://github.com/pnpm/pnpm/issues/3952#issuecomment-1262136483
# 2. it is mounted to all service containers, and will cache and speed up
# pnpm install and pnpm add/remove
- pnpm-store:/codepod/.pnpm-store
command: sh -c "corepack enable && pnpm install && cd packages/prisma && pnpm dlx prisma migrate dev && echo '=== Setup Finished, idling ===' && tail -f /dev/null"
environment:
DATABASE_URL: "postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}?schema=public"

prisma:
image: node:18
restart: always
command: sh -c "corepack enable && pnpm dlx prisma studio"
command: sh -c "npx prisma studio"
working_dir: /codepod/packages/prisma
volumes:
- ../..:/codepod
Expand All @@ -48,8 +29,7 @@ services:
- 4000:4000
volumes:
- ../..:/codepod
- pnpm-store:/codepod/.pnpm-store
command: sh -c "corepack enable && pnpm dev"
command: sh -c "npm run dev"
environment:
DATABASE_URL: "postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}?schema=public"
JWT_SECRET: ${JWT_SECRET}
Expand All @@ -64,8 +44,7 @@ services:
working_dir: /codepod/apps/spawner
volumes:
- ../..:/codepod
- pnpm-store:/codepod/.pnpm-store
command: bash -c "corepack enable && pnpm dev:native"
command: bash -c "npm run dev:native"
environment:
KERNEL_TTL: "43200000"
LOOP_INTERVAL: "60000"
Expand All @@ -79,9 +58,8 @@ services:
- 4021:4021
volumes:
- ../..:/codepod
- pnpm-store:/codepod/.pnpm-store
- /var/run/docker.sock:/var/run/docker.sock
command: sh -c "corepack enable && pnpm dev:docker"
command: sh -c "npm run dev:docker"
environment:
# Set PROJECT_ROOT to the absolute path of your codepod local repo if you
# want to debug the runtime code.
Expand Down Expand Up @@ -111,9 +89,8 @@ services:
- 4233:4233
volumes:
- ../..:/codepod
- pnpm-store:/codepod/.pnpm-store
- /var/run/docker.sock:/var/run/docker.sock
command: sh -c "corepack enable && pnpm dev"
command: sh -c "npm run dev"
environment:
DATABASE_URL: "postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}?schema=public"
JWT_SECRET: ${JWT_SECRET}
Expand All @@ -134,8 +111,7 @@ services:
# VITE_APP_SPAWNER_API_URL: "http://localhost:4021/graphql"
volumes:
- ../..:/codepod
- pnpm-store:/codepod/.pnpm-store
command: sh -c "corepack enable && pnpm dev"
command: sh -c "npm run dev"

# This container is only used for installing node_modules into the volume, so
# that the docker spawner can use the image without waiting for installing.
Expand All @@ -144,8 +120,7 @@ services:
working_dir: /codepod/apps/runtime
volumes:
- ../..:/codepod
- pnpm-store:/codepod/.pnpm-store
command: sh -c "corepack enable && pnpm dev"
command: sh -c "npm run dev"

example-runtime-prod:
image: lihebi/codepod-runtime:0.4.13-alpha.49
Expand All @@ -157,7 +132,6 @@ services:

volumes:
db-data:
pnpm-store:

networks:
default:
Expand Down
1 change: 1 addition & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("Hello via Bun!");
15 changes: 15 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "codepod",
"module": "index.ts",
"type": "module",
"workspaces": [
"packages/*",
"apps/*"
],
"devDependencies": {
"bun-types": "latest"
},
"peerDependencies": {
"typescript": "^5.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"@apollo/client": "^3.8.1",
"@benrbray/prosemirror-math": "^0.2.2",
"@codepod/yjs": "workspace:^",
"@codepod/yjs": "workspace:*",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.10.9",
Expand Down
Loading

0 comments on commit 400bbc5

Please sign in to comment.