Skip to content

Commit

Permalink
build: switch from Yarn to Bun (#625)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahsnider authored Sep 12, 2023
1 parent 5f8e6db commit ac07dd9
Show file tree
Hide file tree
Showing 14 changed files with 22 additions and 8,768 deletions.
3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/.yarn/releases/** binary
/.yarn/plugins/** binary
*.lockb diff=lockb
34 changes: 15 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,26 @@ jobs:
steps:
- name: Checkout Git repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
node-version: "20"
cache: "yarn"
- name: Install dependencies with Yarn
run: yarn install --immutable
bun-version: "1.0.0"
- name: Install dependencies with Bun
run: bun install --frozen-lockfile
- name: Pull environment variables
run: yarn vercel env pull --environment development .env --token ${{ secrets.VERCEL_TOKEN }}
run: bun vercel env pull --environment development .env --token ${{ secrets.VERCEL_TOKEN }}
- name: Cache Next.js
uses: actions/cache@v3
with:
# See here for caching with `yarn` https://github.com/actions/cache/blob/main/examples.md#node---yarn or you can leverage caching with actions/setup-node https://github.com/actions/setup-node
path: |
~/.npm
${{ github.workspace }}/.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/bun.lockb') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
${{ runner.os }}-nextjs-${{ hashFiles('**/bun.lockb') }}-
- name: Build
run: yarn run build
run: bun run build
lint:
name: Lint

Expand All @@ -48,12 +45,11 @@ jobs:
steps:
- name: Checkout Git repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
node-version: "20"
cache: "yarn"
- name: Install dependencies with Yarn
run: yarn install --immutable
bun-version: "1.0.0"
- name: Install dependencies with Bun
run: bun install --frozen-lockfile
- name: Lint
run: yarn run lint
run: bun run lint
9 changes: 0 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,6 @@ $RECYCLE.BIN/

# End of https://www.toptal.com/developers/gitignore/api/node,linux,macos,windows,visualstudiocode

# Yarn
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# Dotenv files
*.env
!*example.env
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20
18
6 changes: 0 additions & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
{
"typescript.preferences.importModuleSpecifierEnding": "index",
"typescript.tsdk": "node_modules/typescript/lib",
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/*.code-search": true,
".yarn/**": true
},
"typescript.preferences.importModuleSpecifier": "shortest",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": {
Expand Down
9 changes: 0 additions & 9 deletions .yarn/plugins/@yarnpkg/plugin-typescript.cjs

This file was deleted.

28 changes: 0 additions & 28 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

This file was deleted.

874 changes: 0 additions & 874 deletions .yarn/releases/yarn-3.6.3.cjs

This file was deleted.

9 changes: 0 additions & 9 deletions .yarnrc.yml

This file was deleted.

4 changes: 2 additions & 2 deletions Procfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
web: yarn start
release: yarn run migrations
web: bun start
release: bun run migrations
Binary file added bun.lockb
Binary file not shown.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"build": "node --require ./ss-polyfills/File.js ./node_modules/.bin/next build",
"build:nixpack": "nixpacks build . --name zws-im/zws",
"dev": "node --require ./ss-polyfills/File.js ./node_modules/.bin/next dev",
"postinstall": "prisma generate",
"lint": "biome check .",
"lint:fix": "biome check . --apply-unsafe",
"migrations": "prisma migrate deploy",
Expand Down Expand Up @@ -64,7 +65,7 @@
"type-fest": "4.3.1",
"vercel": "32.2.1"
},
"packageManager": "[email protected]",
"packageManager": "[email protected]",
"engines": {
"node": "18.x || 20.x"
}
Expand Down
2 changes: 1 addition & 1 deletion vercel.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"buildCommand": "prisma generate && prisma db push && yarn build",
"buildCommand": "prisma generate && prisma db push && bun run build",
"cleanUrls": true,
"crons": [
{
Expand Down
Loading

0 comments on commit ac07dd9

Please sign in to comment.