Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bun => pnpm #2357

Merged
merged 8 commits into from
Jun 4, 2024
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
5 changes: 0 additions & 5 deletions .env.example

This file was deleted.

18 changes: 10 additions & 8 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,18 @@ After the install completes, Bun links packages across the project for developme
First, add the following to your environment (recommended to use [`direnv`](https://github.com/direnv/direnv)):

```bash
VITE_ANVIL_FORK_URL=https://rpc
VITE_ANVIL_BLOCK_TIME=1
VITE_ANVIL_BLOCK_NUMBER=16280770
VITE_ANVIL_FORK_URL=
VITE_ANVIL_FORK_URL_OPTIMISM=
VITE_ANVIL_FORK_URL_OPTIMISM_SEPOLIA=
VITE_ANVIL_FORK_URL_SEPOLIA=
VITE_ANVIL_FORK_URL_ZKSYNC=
VITE_BATCH_MULTICALL=false
VITE_NETWORK_TRANSPORT_MODE=http
VITE_ANVIL_PORT=8545
```

`VITE_ANVIL_FORK_URL` can be for any RPC service provider (e.g. Alchemy or Infura) for the mainnet. Now you are ready to run the tests!

- `bun run test` — runs tests in watch mode
- `pnpm test` — runs tests in watch mode

Sometimes there may be some tests which fail unexpectedly – you can press `f` to rerun them and they should pass.

Expand All @@ -134,7 +136,7 @@ When adding new features or fixing bugs, it's important to add test cases to cov
Documentation is crucial to helping developers of all experience levels use viem. viem uses [Vocs](https://vocs.dev) and Markdown for the documentation site (located at [`site`](../site)). To start the site in dev mode, run:

```bash
bun run docs:dev
pnpm docs:dev
```

Try to keep documentation brief and use plain language so folks of all experience levels can understand. If you think something is unclear or could be explained better, you are welcome to open a pull request.
Expand Down Expand Up @@ -170,7 +172,7 @@ When adding new features or fixing bugs, we'll need to bump the package versions

Each changeset defines which package(s) should be published and whether the change should be a major/minor/patch release, as well as providing release notes that will be added to the changelog upon release.

To create a new changeset, run `bun run changeset`. This will run the Changesets CLI, prompting you for details about the change. You’ll be able to edit the file after it’s created — don’t worry about getting everything perfect up front.
To create a new changeset, run `pnpm changeset`. This will run the Changesets CLI, prompting you for details about the change. You’ll be able to edit the file after it’s created — don’t worry about getting everything perfect up front.

Even though you can technically use any markdown formatting you like, headings should be avoided since each changeset will ultimately be nested within a bullet list. Instead, bold text should be used as section headings.

Expand Down Expand Up @@ -308,7 +310,7 @@ export { zora } from './definitions/zora.js'
Add a `patch` changeset with the description `"Added <your chain here> chain."`.

```diff
> bun run changeset
> pnpm changeset

What kind of change is this for viem?
+ patch
Expand Down
7 changes: 2 additions & 5 deletions .github/actions/install-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ runs:
- name: Set up foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Set up node
uses: actions/setup-node@v4
- name: Set up pnpm
uses: wevm/actions/.github/actions/pnpm@main
with:
node-version: 22

- name: Set up bun
uses: wevm/actions/.github/actions/bun@main

2 changes: 1 addition & 1 deletion .github/actions/setup-wagmi/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ runs:

- name: Build viem
shell: bash
run: bun run build
run: pnpm build

- name: Install dependencies
shell: bash
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/changesets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
with:
commit: 'chore: version package'
title: 'chore: version package'
version: bun run changeset:version
version: pnpm changeset:version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -62,7 +62,7 @@ jobs:
uses: changesets/action@v1
with:
createGithubReleases: ${{ github.ref == 'refs/heads/main' }}
publish: bun run changeset:publish
publish: pnpm changeset:publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand All @@ -80,10 +80,10 @@ jobs:
run: |
npm config set "//registry.npmjs.org/:_authToken" "$NPM_TOKEN"
git reset --hard origin/main
bun run clean
bun run changeset version --no-git-tag --snapshot canary
bun run changeset:prepublish
bun run changeset publish --no-git-tag --snapshot canary --tag canary
pnpm clean
pnpm changeset version --no-git-tag --snapshot canary
pnpm changeset:prepublish
pnpm changeset publish --no-git-tag --snapshot canary --tag canary
jsr:
name: JSR
Expand All @@ -102,4 +102,4 @@ jobs:
uses: ./.github/actions/install-dependencies

- name: Publish to JSR
run: bun ./scripts/updateVersion.ts && cd src && bunx jsr publish --allow-slow-types --allow-dirty
run: pnpm version:update && cd src && pnpx jsr publish --allow-slow-types --allow-dirty
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:
uses: andresz1/size-limit-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
package_manager: bun
package_manager: pnpm
8 changes: 4 additions & 4 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
run: |
snapshot=$(git branch --show-current | tr -cs '[:alnum:]-' '-' | tr '[:upper:]' '[:lower:]' | sed 's/-$//')
npm config set "//registry.npmjs.org/:_authToken" "$NPM_TOKEN"
bun run clean
bun run changeset version --no-git-tag --snapshot $snapshot
bun run changeset:prepublish
bun run changeset publish --no-git-tag --snapshot $snapshot --tag $snapshot
pnpm clean
pnpm changeset version --no-git-tag --snapshot $snapshot
pnpm changeset:prepublish
pnpm changeset publish --no-git-tag --snapshot $snapshot --tag $snapshot
8 changes: 5 additions & 3 deletions .github/workflows/test-chains.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ jobs:
- name: Set up foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Install dependencies
uses: wevm/actions/.github/actions/bun@main
- name: Set up pnpm
uses: wevm/actions/.github/actions/pnpm@main
with:
node-version: 22

- name: Run tests
run: bun run test:chains
run: pnpm test:chains
19 changes: 8 additions & 11 deletions .github/workflows/test-rpc-providers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ jobs:

- name: Build contracts
shell: bash
run: bun run contracts:build
run: pnpm contracts:build

- name: Run tests
uses: nick-fields/retry@v3
with:
timeout_minutes: 10
max_attempts: 3
command: bun run test:ci --shard=${{ matrix.shard }}/${{ matrix.total-shards }}
command: pnpm test:ci --shard=${{ matrix.shard }}/${{ matrix.total-shards }}
env:
VITE_ANVIL_BLOCK_NUMBER: ${{ vars.VITE_ANVIL_BLOCK_NUMBER }}
VITE_ANVIL_BLOCK_TIME: ${{ vars.VITE_ANVIL_BLOCK_TIME }}
Expand All @@ -45,7 +45,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
type: ['bun', 'node-18', 'node-20', 'node-latest', 'next', 'sveltekit', 'tsc', 'vite']
type: ['bun', 'node-18', 'node-20', 'node-latest', 'next', 'tsc', 'vite']
include:
- type: bun
runtime: bun
Expand All @@ -60,9 +60,6 @@ jobs:
runtime: node
- type: next
runtime: next
- type: sveltekit
node-version: 18
runtime: sveltekit
- type: tsc
node-version: 20
runtime: tsc
Expand All @@ -88,17 +85,17 @@ jobs:
node-version: ${{ matrix.node-version }}

- name: Install Playwright Browsers
if: ${{ matrix.runtime == 'next' || matrix.runtime == 'sveltekit' || matrix.runtime == 'vite' }}
run: npx [email protected] install --with-deps
if: ${{ matrix.runtime == 'next' || matrix.runtime == 'vite' }}
run: pnpx [email protected] install --with-deps

- name: Install dependencies
uses: ./.github/actions/install-dependencies

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

- name: Link
run: bun install
run: pnpm install

- name: Run tests
run: bun run test:env:${{ matrix.runtime }}
run: pnpm test:env:${{ matrix.runtime }}
56 changes: 27 additions & 29 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: ./.github/actions/install-dependencies

- name: Lint code
run: bun run lint
run: pnpm lint

- uses: stefanzweifel/git-auto-commit-action@v5
env:
Expand All @@ -45,7 +45,7 @@ jobs:
uses: ./.github/actions/install-dependencies

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

types:
name: Types
Expand All @@ -65,24 +65,22 @@ jobs:
- name: Install dependencies
uses: ./.github/actions/install-dependencies

- run: bun i -d typescript@${{ matrix.version }}
- run: pnpm i -d -w typescript@${{ matrix.version }}

- name: Build contracts
shell: bash
run: bun run contracts:build
run: pnpm contracts:build

- name: Check types
run: bun run typecheck
run: pnpm typecheck

- name: Bench types
run: bun run typebench
run: pnpm typebench

# Redundant with `pnpm typecheck`
# If Vitest adds special features in the future, e.g. type coverage, can add this back!
# - name: Test types
# run: bun run test:typecheck
# env:
# VITE_ANVIL_BLOCK_NUMBER: ${{ vars.VITE_ANVIL_BLOCK_NUMBER }}
# run: pnpm test:typecheck

test:
name: Test
Expand All @@ -91,6 +89,7 @@ jobs:
strategy:
max-parallel: 3
matrix:
multicall: ['true', 'false']
transport-mode: ['http', 'webSocket']
shard: [1, 2, 3]
total-shards: [3]
Expand All @@ -105,23 +104,20 @@ jobs:

- name: Build contracts
shell: bash
run: bun run contracts:build
run: pnpm contracts:build

- name: Run tests
uses: nick-fields/retry@v3
with:
timeout_minutes: 10
max_attempts: 3
command: bun run test:ci --shard=${{ matrix.shard }}/${{ matrix.total-shards }}
command: pnpm test:ci --shard=${{ matrix.shard }}/${{ matrix.total-shards }}
env:
VITE_ANVIL_BLOCK_NUMBER: ${{ vars.VITE_ANVIL_BLOCK_NUMBER }}
VITE_ANVIL_BLOCK_NUMBER_SEPOLIA: ${{ vars.VITE_ANVIL_BLOCK_NUMBER_SEPOLIA }}
VITE_ANVIL_BLOCK_NUMBER_OPTIMISM_SEPOLIA: ${{ vars.VITE_ANVIL_BLOCK_NUMBER_OPTIMISM_SEPOLIA }}
VITE_ANVIL_BLOCK_TIME: ${{ vars.VITE_ANVIL_BLOCK_TIME }}
VITE_ANVIL_FORK_URL: ${{ secrets.VITE_ANVIL_FORK_URL }}
VITE_ANVIL_FORK_URL_OPTIMISM: ${{ secrets.VITE_ANVIL_FORK_URL_OPTIMISM }}
VITE_ANVIL_FORK_URL_SEPOLIA: ${{ secrets.VITE_ANVIL_FORK_URL_SEPOLIA }}
VITE_ANVIL_FORK_URL_OPTIMISM_SEPOLIA: ${{ secrets.VITE_ANVIL_FORK_URL_OPTIMISM_SEPOLIA }}
VITE_ANVIL_FORK_URL_SEPOLIA: ${{ secrets.VITE_ANVIL_FORK_URL_SEPOLIA }}
VITE_ANVIL_FORK_URL_ZKSYNC: ${{ secrets.VITE_ANVIL_FORK_URL_ZKSYNC }}
VITE_BATCH_MULTICALL: ${{ matrix.multicall }}
VITE_NETWORK_TRANSPORT_MODE: ${{ matrix.transport-mode }}

Expand All @@ -135,7 +131,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
type: ['bun', 'node-18', 'node-20', 'node-latest', 'next', 'sveltekit', 'tsc', 'vite']
type: ['bun', 'node-18', 'node-20', 'node-latest', 'next', 'tsc', 'vite']
include:
- type: bun
runtime: bun
Expand All @@ -150,9 +146,6 @@ jobs:
runtime: node
- type: next
runtime: next
- type: sveltekit
node-version: 18
runtime: sveltekit
- type: tsc
node-version: 20
runtime: tsc
Expand All @@ -165,6 +158,14 @@ jobs:
with:
submodules: 'recursive'

- name: Set up foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Set up pnpm
uses: wevm/actions/.github/actions/pnpm@main
with:
node-version: 22

- name: Set up Bun
if: ${{ matrix.runtime == 'bun' }}
uses: oven-sh/setup-bun@v1
Expand All @@ -178,20 +179,17 @@ jobs:
node-version: ${{ matrix.node-version }}

- name: Install Playwright Browsers
if: ${{ matrix.runtime == 'next' || matrix.runtime == 'sveltekit' || matrix.runtime == 'vite' }}
run: npx [email protected] install --with-deps

- name: Install dependencies
uses: ./.github/actions/install-dependencies
if: ${{ matrix.runtime == 'next' || matrix.runtime == 'vite' }}
run: pnpx [email protected] install --with-deps

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

- name: Link
run: bun install
run: pnpm install

- name: Run tests
run: bun run test:env:${{ matrix.runtime }}
run: pnpm test:env:${{ matrix.runtime }}

vectors:
name: Vectors
Expand All @@ -207,7 +205,7 @@ jobs:

- name: Run test vectors
shell: bash
run: bun run vectors
run: pnpm vectors

wagmi:
name: Wagmi
Expand Down
Binary file removed bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion environments/next/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ export default defineConfig({
},
],
webServer: {
command: 'bun run dev',
command: 'pnpm dev',
},
})
12 changes: 0 additions & 12 deletions environments/sveltekit/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion environments/sveltekit/.npmrc

This file was deleted.

Loading
Loading