Skip to content

Commit 29311bc

Browse files
feat!: migrate the monorepo to Bun and Biome (#327)
* feat!: migrate the monorepo to Bun and Biome Replace pnpm/Jest with Bun for install, test, and CI, keep Biome as the linter/formatter, and publish ESM-only packages to npm via Changesets. Co-authored-by: Cursor <cursoragent@cursor.com> * fix: harden Bun migration for publishing and CI Restore runtime metadata, hermetic test isolation, package-scoped coverage, and artifact checks so the ESM-only release remains reproducible and reviewable. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(mcp-server): preserve hex identifiers after migration Accept canonical hexadecimal chain and block values, make mock resets order-independent, and enforce packed CLI checks without network-resolved tooling. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(mcp-server): reject ambiguous numeric identifiers Keep hex support without treating blanks or exponent notation as chain data, and harden direct execution and ESM build checks against future regressions. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent c928ae9 commit 29311bc

111 files changed

Lines changed: 3478 additions & 20919 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
"@sei-js/precompiles": major
3+
"@sei-js/registry": major
4+
"@sei-js/sei-global-wallet": major
5+
"@sei-js/mcp-server": major
6+
"@sei-js/create-sei": major
7+
---
8+
9+
Migrate the monorepo to Bun and publish ESM-only packages.
10+
11+
**Breaking:** all packages drop CommonJS (`require`) entry points and flatten `dist/`. Consumers must use ESM `import`. `@sei-js/precompiles` now ships an `exports` map with working `./ethers`, `./viem`, and `./precompiles` subpaths. `@sei-js/sei-global-wallet` keeps the `./solana` entrypoint.
12+
13+
Install, build, and test with Bun (`bun install`, `bun run build`, `bun run test`). `@sei-js/mcp-server` now requires Node.js 20 or newer. The MCP server and precompiles development toolchain pin Viem to `2.37.2`, the last compatible release that includes `seiDevnet`. Generated apps target the new `@sei-js/precompiles` major. Packages continue to publish to npm via Changesets.

‎.github/workflows/checks.yml‎

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
name: Checks
22

3-
on: [push]
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
10+
cancel-in-progress: true
411

512
jobs:
613
build:
@@ -9,27 +16,32 @@ jobs:
916
steps:
1017
- uses: actions/checkout@v4
1118
with:
12-
fetch-depth: 0 # Fetch the full history instead of a shallow clone
19+
fetch-depth: 0
1320
submodules: recursive
1421

15-
- uses: actions/setup-node@v4
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
1624
with:
1725
node-version-file: '.nvmrc'
1826

19-
- name: Install pnpm
20-
uses: pnpm/action-setup@v4
27+
- uses: oven-sh/setup-bun@v2
28+
with:
29+
bun-version: '1.3.14'
2130

2231
- name: Install system dependencies
2332
run: sudo apt-get update && sudo apt-get install -y rsync
2433

2534
- name: Install dependencies
26-
run: pnpm install --frozen-lockfile
35+
run: bun install --frozen-lockfile
36+
37+
- name: Lint, Format & Type Check
38+
run: bun run check
2739

2840
- name: Build All Packages
29-
run: pnpm build:all
41+
run: bun run build
3042

3143
- name: Test
32-
run: pnpm test:all
44+
run: bun run test
3345

3446
- name: Validate Published Packages
35-
run: pnpm lint:pack:all
47+
run: bun run lint:pack:all

‎.github/workflows/coverage.yml‎

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,53 @@ name: Run & Upload Test Coverage
22

33
on:
44
push:
5-
branches:
6-
- main
5+
branches: [main]
76
pull_request:
8-
branches:
9-
- main
10-
- feature/**
117

128
jobs:
139
run-tests:
1410
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
include:
15+
- package: precompiles
16+
flag: precompiles
17+
- package: registry
18+
flag: registry
19+
- package: sei-global-wallet
20+
flag: sei-global-wallet
21+
- package: mcp-server
22+
flag: mcp-server
1523

1624
steps:
1725
- name: Checkout code
1826
uses: actions/checkout@v4
1927
with:
20-
fetch-depth: 0 # Fetch the full history instead of a shallow clone
28+
fetch-depth: 0
2129
submodules: recursive
22-
- name: Use Node.js
30+
31+
- name: Setup Node.js
2332
uses: actions/setup-node@v4
2433
with:
2534
node-version-file: '.nvmrc'
2635

27-
- uses: browser-actions/setup-chrome@v1
28-
- run: chrome --version
29-
30-
- name: Install pnpm
31-
uses: pnpm/action-setup@v4
32-
33-
- name: Install system dependencies
34-
run: sudo apt-get update && sudo apt-get install -y rsync
36+
- uses: oven-sh/setup-bun@v2
37+
with:
38+
bun-version: '1.3.14'
3539

3640
- name: Install dependencies
37-
run: pnpm install --frozen-lockfile
38-
39-
- name: Build packages
40-
run: pnpm build:all
41+
run: bun install --frozen-lockfile
4142

42-
- name: Run Jest tests
43-
run: pnpm test:coverage
43+
- name: Run ${{ matrix.package }} tests with coverage
44+
run: bun test --isolate --coverage --coverage-reporter=lcov --coverage-dir=coverage/${{ matrix.flag }} packages/${{ matrix.package }}/src
4445

45-
- name: Upload coverage reports to Codecov
46+
- name: Upload ${{ matrix.package }} coverage to Codecov
4647
uses: codecov/codecov-action@v4
4748
with:
48-
files: '**/coverage-final.json'
49+
files: coverage/${{ matrix.flag }}/lcov.info
50+
flags: ${{ matrix.flag }}
51+
name: ${{ matrix.flag }}
52+
disable_search: true
4953
token: ${{ secrets.CODECOV_TOKEN }}
5054
fail_ci_if_error: true

‎.github/workflows/release.yml‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,29 @@ jobs:
2626
- name: Setup Node.js (for npm OIDC publishing)
2727
uses: actions/setup-node@v4
2828
with:
29-
node-version: '24'
29+
node-version-file: '.nvmrc'
3030
registry-url: 'https://registry.npmjs.org'
3131

32-
- name: Install pnpm
33-
uses: pnpm/action-setup@v4
32+
- uses: oven-sh/setup-bun@v2
33+
with:
34+
bun-version: '1.3.14'
3435

3536
- name: Install system dependencies
3637
run: sudo apt-get update && sudo apt-get install -y rsync
3738

3839
- name: Install Dependencies
39-
run: pnpm install --frozen-lockfile
40+
run: bun install --frozen-lockfile
4041

4142
- name: Build Packages
42-
run: pnpm build:all
43+
run: bun run build
4344

4445
- name: Validate Published Packages
45-
run: pnpm lint:pack:all
46+
run: bun run lint:pack:all
4647

4748
- name: Create Release Pull Request or Publish to npm
4849
id: changesets
4950
uses: changesets/action@v1
5051
with:
51-
# Release builds the packages and calls changeset publish
52-
publish: pnpm release
52+
publish: bun run release
5353
env:
5454
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# testing
44
packages/*/coverage
5+
packages/*/coverage.json
56

67
examples/
78

‎.nvmrc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v20
1+
24

‎README.md‎

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,39 @@ SeiJS is a monorepo that contains multiple NPM libraries for writing application
66

77
SeiJS consists of smaller NPM packages within the @sei-js namespace. See the package READMEs below for usage details.
88

9-
| Package | Description |
10-
|---------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------|
11-
| [@sei-js/precompiles](packages/precompiles) | Typescript library containing helper functions for interacting with Sei's precompile contracts. |
12-
| [@sei-js/create-sei](packages/create-sei) | CLI Tool used to quickly spin up Sei Projects and dApps in either the cosmos or EVM ecosystem |
13-
| [@sei-js/mcp-server](packages/mcp-server) | MCP server for interacting with Sei via LLM's and agents |
14-
| [@sei-js/sei-global-wallet](packages/sei-global-wallet) | A global wallet conforming to EIP-6963 allowing for AA across dApps. |
9+
| Package | Description |
10+
| ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
11+
| [@sei-js/precompiles](packages/precompiles) | Typescript library containing helper functions for interacting with Sei's precompile contracts. |
12+
| [@sei-js/create-sei](packages/create-sei) | CLI Tool used to quickly spin up Sei Projects and dApps in either the cosmos or EVM ecosystem |
13+
| [@sei-js/mcp-server](packages/mcp-server) | MCP server for interacting with Sei via LLM's and agents |
14+
| [@sei-js/sei-global-wallet](packages/sei-global-wallet) | A global wallet conforming to EIP-6963 allowing for AA across dApps. |
15+
| [@sei-js/registry](packages/registry) | TypeScript library for Sei chain constants and assets. |
1516

1617
## Development
1718

19+
This project uses [Bun](https://bun.sh) for package management, tests, and scripts. Packages are still published to npm as ESM-only libraries.
20+
1821
### Prerequisites
1922

20-
This project uses Yarn 4.7.0 with Corepack for package management. To get started:
23+
Install Bun 1.3.14: https://bun.sh/docs/installation
24+
25+
Node.js 24 is pinned in `.nvmrc` for npm package validation and OIDC publishing; Bun remains the workspace package manager and test runner.
26+
27+
### Install, build, test
2128

22-
1. **Enable Corepack** (if not already enabled):
23-
```bash
24-
corepack enable
25-
```
29+
```bash
30+
git submodule update --init --recursive
31+
bun install
32+
bun run build
33+
bun run test
34+
```
2635

27-
2. **Install dependencies**:
28-
```bash
29-
yarn install
30-
```
36+
Lint and format with Biome:
3137

32-
The correct Yarn version will be automatically used thanks to the `packageManager` field in `package.json` and Corepack.
38+
```bash
39+
bun run check
40+
```
3341

34-
### Building
42+
### Publishing
3543

36-
To build all packages, run `pnpm install` then `pnpm build:all`
44+
Releases still go through Changesets and publish to npm (OIDC). Merging to `main` opens a Version Packages PR; merging that publishes.

‎REVIEW.md‎

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Review guidelines for AI agents
22

33
Repo-specific conventions for automated PR review (Codex, Cursor, Claude, and
4-
any other AI reviewer). This is a pnpm workspace that publishes five
4+
any other AI reviewer). This is a Bun workspace that publishes five
55
independently versioned `@sei-js/*` packages to npm, so a defect ships to every
66
downstream dApp that upgrades rather than to a single deployment we control.
77
Calibrate accordingly: a wrong precompile address or a weakened wallet guard is
@@ -59,10 +59,9 @@ the code without releasing it, which is the common miss on this repo.
5959
Ask for a changeset when a published package's behaviour, types, or
6060
dependencies change. Docs-only, CI-only, and changes confined to
6161
`packages/create-sei/templates/**` generally don't need one, though the repo
62-
has deliberately added patch changesets across all six packages for
63-
release-note visibility (the `@asyncapi` pinning in `pnpm.overrides` is the
64-
precedent). Absence of a changeset on that kind of PR is a question, not a
65-
defect.
62+
has deliberately added patch changesets across all five packages for
63+
release-note visibility. Absence of a changeset on that kind of PR is a
64+
question, not a defect.
6665

6766
## 4. Known non-issues — do not flag these
6867

@@ -88,22 +87,22 @@ defect.
8887
`submodules: recursive`; local source builds must initialize them explicitly.
8988
Their JSON is vendored upstream — review the TypeScript wrappers, not the
9089
data.
91-
- **Biome findings are not enforced anywhere.** `biome.json` configures tabs,
92-
160-column lines, single quotes and no trailing commas, but no package
93-
defines a `biome` script and `.github/workflows/checks.yml` runs only
94-
`pnpm build:all` and `pnpm test:all`. Match the surrounding style; do not
95-
file formatting-only findings as blocking.
90+
- **Biome is enforced in CI.** `bun run check` runs in `.github/workflows/checks.yml`
91+
with tabs, 160-column lines, single quotes and no trailing commas. Match that
92+
style; formatting-only findings that `biome check` already catches do not
93+
need a separate review comment.
9694
- **Test file naming is inconsistent across packages.** `mcp-server` and
9795
`create-sei` use `*.test.ts`; `precompiles`, `registry` and
9896
`sei-global-wallet` use `*.spec.ts` under `__tests__/`. Follow the
9997
convention of the package being changed rather than proposing a repo-wide
10098
rename.
101-
- **`mcp-server` has no Codecov target.** `codecov.yml` defines 80% project
102-
targets for the other four packages only. Thin coverage on an mcp-server PR
103-
is worth mentioning on its merits, but it does not fail a gate.
99+
- **`mcp-server` and `create-sei` have no Codecov target.** `codecov.yml`
100+
defines 80% project targets for the three library packages with meaningful
101+
source coverage. Thin coverage elsewhere is worth mentioning on its merits,
102+
but it does not fail a gate.
104103
- **`noImplicitAny: false` in `tsconfig.base.json`.** This is a deliberate
105104
repo-wide setting. Flag an untyped value when it actually causes an unsound
106105
path, not because the compiler permitted it.
107-
- **The `create-sei` templates are excluded from the root Biome config** and
108-
carry their own toolchain. Do not apply root formatting rules to anything
109-
under `packages/create-sei/templates/`.
106+
- **The `create-sei` templates and extensions are excluded from the root Biome
107+
config** and carry their own toolchain. Do not apply root formatting rules to
108+
scaffold sources under `packages/create-sei/{templates,extensions}/`.

‎biome.json‎

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,33 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.5.8/schema.json",
33
"vcs": {
4-
"enabled": false,
4+
"enabled": true,
55
"clientKind": "git",
6-
"useIgnoreFile": false
6+
"useIgnoreFile": true
77
},
88
"files": {
99
"ignoreUnknown": false,
10-
"ignore": ["*/coverage/*", "*/dist/*", "packages/create-sei/templates/**"]
10+
"includes": [
11+
"**",
12+
"!**/coverage",
13+
"!**/dist",
14+
"!**/node_modules",
15+
"!**/bun.lock",
16+
"!packages/create-sei/templates",
17+
"!packages/create-sei/extensions",
18+
"!packages/registry/chain-registry",
19+
"!packages/registry/community-assetlist"
20+
]
1121
},
1222
"formatter": {
1323
"enabled": true,
1424
"indentStyle": "tab",
1525
"lineWidth": 160
1626
},
17-
"organizeImports": {
18-
"enabled": true
19-
},
2027
"linter": {
2128
"enabled": true,
2229
"rules": {
23-
"recommended": true,
30+
"preset": "recommended",
2431
"correctness": {
2532
"useExhaustiveDependencies": "off"
2633
},
@@ -35,5 +42,32 @@
3542
"jsxQuoteStyle": "double",
3643
"trailingCommas": "none"
3744
}
38-
}
45+
},
46+
"assist": {
47+
"actions": {
48+
"source": {
49+
"organizeImports": "on"
50+
}
51+
}
52+
},
53+
"overrides": [
54+
{
55+
"includes": ["**/*.test.ts", "**/*.spec.ts", "**/__tests__/**", "**/tests/**"],
56+
"linter": {
57+
"rules": {
58+
"suspicious": {
59+
"noExplicitAny": "off"
60+
},
61+
"style": {
62+
"noNonNullAssertion": "off"
63+
},
64+
"correctness": {
65+
"noUnusedFunctionParameters": "off",
66+
"noUnusedImports": "off",
67+
"noUnusedVariables": "off"
68+
}
69+
}
70+
}
71+
}
72+
]
3973
}

0 commit comments

Comments
 (0)