Skip to content

Commit

Permalink
chore: bun to pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm committed Jun 2, 2024
1 parent ba2c697 commit dd7a4b4
Show file tree
Hide file tree
Showing 17 changed files with 13,200 additions and 70 deletions.
8 changes: 4 additions & 4 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ 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 +134,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 +170,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 +308,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
4 changes: 2 additions & 2 deletions .github/actions/install-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ runs:
with:
node-version: 21

- name: Set up bun
uses: wevm/actions/.github/actions/bun@main
- name: Set up pnpm
uses: wevm/actions/.github/actions/pnpm@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
4 changes: 2 additions & 2 deletions .github/workflows/test-chains.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
uses: foundry-rs/foundry-toolchain@v1

- name: Install dependencies
uses: wevm/actions/.github/actions/bun@main
uses: wevm/actions/.github/actions/pnpm@main

- name: Run tests
run: bun run test:chains
run: pnpm test:chains
10 changes: 5 additions & 5 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 Down Expand Up @@ -95,10 +95,10 @@ jobs:
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 }}
26 changes: 13 additions & 13 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,22 +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
# run: pnpm test:typecheck
# env:
# VITE_ANVIL_BLOCK_NUMBER: ${{ vars.VITE_ANVIL_BLOCK_NUMBER }}

Expand All @@ -105,14 +105,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_NUMBER_SEPOLIA: ${{ vars.VITE_ANVIL_BLOCK_NUMBER_SEPOLIA }}
Expand Down Expand Up @@ -185,13 +185,13 @@ jobs:
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 }}

vectors:
name: Vectors
Expand All @@ -207,7 +207,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',
},
})
2 changes: 1 addition & 1 deletion environments/sveltekit/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default defineConfig({
},
],
webServer: {
command: 'bun run build && bun run preview',
command: 'pnpm build && pnpm preview',
port: 4173,
},
})
2 changes: 1 addition & 1 deletion environments/vite/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',
},
})
48 changes: 24 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,38 @@
{
"workspaces": ["examples/*", "environments/*", "site", "src", "test"],
"private": true,
"type": "module",
"scripts": {
"bench": "vitest bench",
"bench:ci": "CI=true vitest bench",
"build": "bun run clean && bun run build:cjs && bun run build:esm && bun run build:types",
"build:cjs": "bun run build:trustedSetups:start && tsc --project ./tsconfig.build.json --module commonjs --outDir ./src/_cjs --removeComments --verbatimModuleSyntax false && printf '{\"type\":\"commonjs\"}' > ./src/_cjs/package.json && bun run build:trustedSetups:end",
"build:esm": "tsc --project ./tsconfig.build.json --module es2015 --outDir ./src/_esm && printf '{\"type\": \"module\",\"sideEffects\":false}' > ./src/_esm/package.json",
"build": "pnpm clean && pnpm build:cjs && pnpm build:esm && pnpm build:types",
"build:cjs": "pnpm build:trustedSetups:start && tsc --project ./tsconfig.build.json --module commonjs --outDir ./src/_cjs --removeComments --verbatimModuleSyntax false && printf '{\"type\":\"commonjs\"}' > ./src/_cjs/package.json && pnpm build:trustedSetups:end",
"build:esm": "tsc --project ./tsconfig.build.json --module es2020 --outDir ./src/_esm && printf '{\"type\": \"module\",\"sideEffects\":false}' > ./src/_esm/package.json",
"build:trustedSetups:start": "mv src/node/trustedSetups.ts src/node/trustedSetups_esm.ts && mv src/node/trustedSetups_cjs.ts src/node/trustedSetups.ts",
"build:trustedSetups:end": "mv src/node/trustedSetups.ts src/node/trustedSetups_cjs.ts && mv src/node/trustedSetups_esm.ts src/node/trustedSetups.ts",
"build:types": "tsc --project ./tsconfig.build.json --module esnext --declarationDir ./src/_types --emitDeclarationOnly --declaration --declarationMap",
"changeset": "changeset",
"changeset:prepublish": "bun run version:update && bun scripts/prepublishOnly.ts && bun run build",
"changeset:publish": "bun run changeset:prepublish && changeset publish",
"changeset:version": "changeset version && bun install --lockfile-only && bun version:update",
"clean": "rimraf src/_esm src/_cjs src/_types",
"changeset:prepublish": "pnpm version:update && bun scripts/prepublishOnly.ts && pnpm build",
"changeset:publish": "pnpm changeset:prepublish && changeset publish",
"changeset:version": "changeset version && pnpm install --lockfile-only && pnpm version:update",
"clean": "rimraf tsconfig.tsbuildinfo src/_esm src/_cjs src/_types",
"contracts:build": "forge build --config-path ./test/foundry.toml && bun ./scripts/generateTypedArtifacts.ts",
"docs:dev": "cd site && bun run dev",
"docs:build": "cd site && bun run build",
"docs:preview": "cd site && bun run preview",
"docs:dev": "cd site && pnpm dev",
"docs:build": "cd site && pnpm build",
"docs:preview": "cd site && pnpm preview",
"lint": "biome check . --apply",
"postinstall": "git submodule update --init --recursive && bun run contracts:build",
"prepare": "bun x simple-git-hooks",
"postinstall": "git submodule update --init --recursive && pnpm contracts:build",
"prepare": "pnpm simple-git-hooks",
"prepublishOnly": "bun scripts/prepublishOnly.ts",
"size": "size-limit",
"test": "vitest -c ./test/vitest.config.ts dev",
"test:chains": "vitest test/chains.test.ts",
"test:ci": "CI=true vitest -c ./test/vitest.config.ts --coverage --retry=3 --bail=1 --pool=forks",
"test:cov": "vitest dev -c ./test/vitest.config.ts --coverage",
"test:env": "bun run test:env:bun && bun run test:env:next && bun run test:env:node && bun run test:env:vite && bun run test:env:sveltekit",
"test:env:bun": "cd environments/bun && bun run test",
"test:env:next": "cd environments/next && bun run test",
"test:env:node": "cd environments/node && bun run test",
"test:env:sveltekit": "cd environments/sveltekit && bun run test",
"test:env:tsc": "cd environments/tsc && bun run test",
"test:env:vite": "cd environments/vite && bun run test",
"test:env": "pnpm test:env:bun && pnpm test:env:next && pnpm test:env:node && pnpm test:env:vite && pnpm test:env:sveltekit",
"test:env:bun": "cd environments/bun && pnpm test",
"test:env:next": "cd environments/next && pnpm test",
"test:env:node": "cd environments/node && pnpm test",
"test:env:sveltekit": "cd environments/sveltekit && pnpm test",
"test:env:tsc": "cd environments/tsc && pnpm test",
"test:env:vite": "cd environments/vite && pnpm test",
"test:typecheck": "SKIP_GLOBAL_SETUP=true vitest --typecheck.only -c ./test/vitest.config.ts",
"test:ui": "vitest dev -c ./test/vitest.config.ts --ui",
"typebench": "tsx test/typebench.ts --benchPercentThreshold 10 --benchErrorOnThresholdExceeded",
Expand All @@ -56,6 +53,8 @@
"@viem/anvil": "0.0.10",
"@vitest/coverage-v8": "^1.0.4",
"@vitest/ui": "^1.0.4",
"abitype": "1.0.0",
"bun": "^1.1.12",
"c-kzg": "^2.1.2",
"ethers": "^6.0.2",
"fs-extra": "^10.1.0",
Expand All @@ -64,12 +63,13 @@
"simple-git-hooks": "^2.8.1",
"size-limit": "^11.1.2",
"tsx": "^4.11.0",
"typescript": "5.4.2",
"typescript": "5.4.5",
"vite": "^5.0.7",
"vitest": "^1.0.4"
},
"trustedDependencies": ["c-kzg"],
"packageManager": "[email protected]",
"simple-git-hooks": {
"pre-commit": "bun run lint"
"pre-commit": "pnpm lint"
}
}
Loading

0 comments on commit dd7a4b4

Please sign in to comment.