Skip to content

Commit

Permalink
build: change from pnpm to bun
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronauck committed Feb 6, 2025
1 parent 83e11b3 commit c99f3c3
Show file tree
Hide file tree
Showing 29 changed files with 2,147 additions and 8,519 deletions.
20 changes: 20 additions & 0 deletions .github/actions/setup-bun/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Setup Bun
description: Install Bun tooling

inputs:
bun-version:
description: "Bun version to install"
required: false
default: "1.2.2"

runs:
using: composite
steps:
- uses: oven-sh/setup-bun@v2
name: Install Bun
with:
bun-version: ${{ inputs.bun-version }}

- name: Install dependencies
shell: bash
run: bun install --frozen-lockfile
19 changes: 6 additions & 13 deletions .github/workflows/pr-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
NODE_VERSION: 20.11.0
PNPM_VERSION: 9.5.0

jobs:
test:
name: Tests
Expand All @@ -26,20 +22,17 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: FuelLabs/github-actions/setups/node@master
with:
node-version: ${{ env.NODE_VERSION }}
pnpm-version: ${{ env.PNPM_VERSION }}
- name: Setup Bun
uses: ./.github/actions/setup-bun

- name: Build packages
run: pnpm build:libs
run: bun run build:libs

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

- name: Install Playwright Browsers
run: pnpm exec playwright install --with-deps chromium
run: bun x playwright install --with-deps chromium

- name: Run E2E tests
run: pnpm test:e2e
run: bun run test:e2e
52 changes: 5 additions & 47 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
NODE_VERSION: 20.11.0
PNPM_VERSION: 9.5.0

jobs:
validate-title:
name: Validate PR Title
Expand All @@ -21,41 +17,6 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# check-packages-changed:
# name: Assign project changed
# runs-on: ubuntu-latest
# outputs:
# changed: ${{ steps.packages-changed.outputs.any_changed }}
# steps:
# - uses: actions/checkout@v4
# - name: Check external packages changes
# id: packages-changed
# uses: tj-actions/changed-files@v22.2
# with:
# files: |
# **/packages/fuel-streams/**
#
# validate-changeset:
# name: Validate PR Changeset
# needs: check-packages-changed
# # if: ${{ github.head_ref != 'changeset-release/main' && needs.check-packages-changed.outputs.changed == 'true' }}
# if: false
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# with:
# fetch-depth: 0
#
# - name: Setup Node
# uses: FuelLabs/github-actions/setups/node@master
# with:
# node-version: ${{ env.NODE_VERSION }}
# pnpm-version: ${{ env.PNPM_VERSION }}
#
# - name: Validate Changeset
# run: pnpm changeset status --since=origin/${{ github.base_ref }}

lint:
name: Lint & Type Check
runs-on: ubuntu-latest
Expand All @@ -67,16 +28,13 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: FuelLabs/github-actions/setups/node@master
with:
node-version: ${{ env.NODE_VERSION }}
pnpm-version: ${{ env.PNPM_VERSION }}
- name: Setup Bun
uses: ./.github/actions/setup-bun

- name: Build packages
run: pnpm build:libs
run: bun run build:libs

- name: Run lint & ts:check
run: |
pnpm lint:ci
pnpm ts:check
bun run lint:ci
bun run ts:check
18 changes: 7 additions & 11 deletions .github/workflows/release-npm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ concurrency:

env:
BUILD_VERSION: ""
NODE_VERSION: 20.11.0
PNPM_VERSION: 9.5.0

jobs:
release-changesets:
Expand All @@ -29,19 +27,17 @@ jobs:
# see https://github.com/changesets/action/issues/70
persist-credentials: false

- uses: FuelLabs/github-actions/setups/node@master
with:
node-version: ${{ env.NODE_VERSION }}
pnpm-version: ${{ env.PNPM_VERSION }}
- name: Setup Bun
uses: ./.github/actions/setup-bun

- uses: FuelLabs/github-actions/setups/npm@master
with:
npm-token: ${{ secrets.NPM_TOKEN_STREAMS }}

- name: Bump and Collect Version
run: |
pnpm changeset version
echo "BUILD_VERSION=$(pnpm -s packages:version)" >> $GITHUB_ENV
bun run changeset version
echo "BUILD_VERSION=$(bun run --silent packages:version)" >> $GITHUB_ENV
git reset --hard
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -52,14 +48,14 @@ jobs:
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
- name: Build Lib
run: pnpm build:libs
run: bun run build:libs

- name: Create Release Pull Request or Publish to NPM
id: changesets
uses: FuelLabs/changesets-action@main
with:
publish: pnpm changeset publish --tag latest
version: pnpm changeset version
publish: bun run changeset publish --tag latest
version: bun run changeset version
commit: "ci(changesets): versioning packages"
title: "ci(changesets): versioning packages"
createGithubReleases: aggregate
Expand Down
12 changes: 3 additions & 9 deletions .github/workflows/unpublish-npm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: FuelLabs/github-actions/setups/node@master
with:
node-version: 20.11.0
pnpm-version: 9.5.0
- uses: FuelLabs/github-actions/setups/npm@master
with:
npm-token: ${{ secrets.NPM_TOKEN_STREAMS }}
- run: pnpm install
- run: pnpm tsx ./scripts/unpublish.ts
- uses: ./.github/actions/setup-bun
- run: bun install
- run: bun ./scripts/unpublish.ts
env:
DELETE_PACKAGES: ${{ github.event.inputs.delete_packages}}
VERSION_TO_DELETE: ${{ github.event.inputs.version }}
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@ logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr

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 run lint-staged
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"**/.turbo",
"**/build",
"**/contracts",
"pnpm-lock.yaml",
"bun.lock",
"**/examples/react-app/src/types",
"**/examples/react-next/.next",
"**/factories/**/*.ts",
Expand Down
Loading

0 comments on commit c99f3c3

Please # to comment.