Skip to content
This repository was archived by the owner on May 11, 2026. It is now read-only.

Commit f577889

Browse files
bonustrackclaudewa0x6eTony
authored
chore: migrate package manager from Yarn to Bun (#638)
* chore: migrate package manager from Yarn to Bun Swaps yarn.lock for bun.lock and updates package.json scripts to invoke `bun run` / `bunx` instead of `yarn`. Doc comments in scripts/ and the test setup error message are updated accordingly. Three deps are pinned to exact versions to preserve the resolutions yarn.lock had (Bun's stricter prerelease semver otherwise upgrades the shared lint/format configs and breaks lint cleanliness): - prettier 3.0.3 - @snapshot-labs/eslint-config 0.1.0-beta.18 - @snapshot-labs/prettier-config 0.1.0-beta.7 A single `overrides` entry pins @snapshot-labs/eslint-config-base to 0.1.0-beta.18 for the same reason. CI workflows are pointed at snapshot-labs/actions@feat/bun-support with `package_manager: bun`; will need to be repointed to @main once that PR lands. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: pin test deps to yarn-locked versions ts-jest, jest, jest-environment-node-single-context, @types/jest, and lodash drifted upward when Bun resolved fresh against the ^x.y.z ranges. ts-jest 29.4 in particular was 35x slower at compiling the test suite (~1s under 29.1.1, >30s under 29.4.9), which pushed the CI test step past the 2-minute timeout. Pins them to the exact versions yarn.lock had to keep test behavior unchanged across the package-manager swap. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: pin ajv to 8.11.0 to work around schema-compile bug @snapshot-labs/snapshot.js requests ajv ^8.11.0; yarn happened to lock this at 8.11.0, but Bun resolves fresh and gets 8.20.0, which generates invalid JS in compiled validators ("SyntaxError: Unexpected token ':'") for the snapshot.js space schema. This caused 19 test failures in CI. Adding ajv@8.11.0 as a direct dependency hoists it to root, so snapshot.js picks it up. eslint's transitive ajv (^6.x) lands nested under node_modules/eslint/node_modules/ajv and stays untouched. A scoped override would have been cleaner but Bun does not yet support nested overrides (oven-sh/bun#6608). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: pin ofetch to 1.3.3 to match yarn-locked version @snapshot-labs/pineapple requests ofetch ^1.3.3; yarn locked 1.3.3 but Bun resolves to 1.5.1 fresh, which breaks the integration tests in test/integration/ingestor.test.ts (real pin calls return "pinning failed" instead of succeeding). Pineapple is the only consumer of ofetch in this project, so a global override is safe. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: point CI workflows back to actions@main * chore(deps): bump @snapshot-labs/snapshot.js from 0.14.20 to 0.14.21 0.14.21 pins ajv at exact 8.11.0 (was ^8.11.0), which prevents bun from resolving snapshot.js's transitive ajv to the broken 8.20.0 (codegen bug in `ajv-errors@3.0.0` paired with ajv@8.20.0 — `SyntaxError: Unexpected token ':'`). The direct `ajv: 8.11.0` dep stays because bun's hoisting still installs separate ajv copies under snapshot.js / ajv-formats / ajv-errors when their peer ajv constraint is `^8.0.0` rather than `8.11.0` — different copies break ajv-errors's vocabulary registration even when versions match. Forcing a single ajv at root (via this direct dep) is still the only way to deduplicate until bun supports nested overrides. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(deps): document why ajv is a direct dep Add a //ajv field explaining that the explicit ajv dependency exists purely to force bun to hoist a single ajv 8.x copy at the root, since bun won't dedupe ajv across snapshot.js / ajv-formats / ajv-errors when eslint's transitive ajv@^6.x is also in the tree. Without it, each 8.x consumer gets its own nested copy (same version, different module identities) and ajv-errors's vocabulary registration breaks. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: Wan <495709+wa0x6e@users.noreply.github.com> Co-authored-by: Tony <tony@Tonys-Mac-mini.local>
1 parent d4fa144 commit f577889

14 files changed

Lines changed: 1686 additions & 6071 deletions

.github/workflows/create-sentry-release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ jobs:
1010
uses: snapshot-labs/actions/.github/workflows/create-sentry-release.yml@main
1111
secrets: inherit
1212
with:
13+
package_manager: bun
1314
project: snapshot-sequencer
1415
sourcemaps: './build'

.github/workflows/lint.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ jobs:
66
lint:
77
uses: snapshot-labs/actions/.github/workflows/lint.yml@main
88
secrets: inherit
9+
with:
10+
package_manager: bun

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ jobs:
77
uses: snapshot-labs/actions/.github/workflows/test.yml@main
88
secrets: inherit
99
with:
10+
package_manager: bun
1011
mysql_database_name: snapshot_sequencer_test
1112
mysql_schema_path: 'test/schema.sql'
1213
redis: true

bun.lock

Lines changed: 1654 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@
22
"name": "snapshot-sequencer",
33
"version": "0.1.3",
44
"license": "MIT",
5+
"//ajv": "ajv 8.11.0 is a transitive dep of @snapshot-labs/snapshot.js (also used by ajv-formats and ajv-errors). Pinned at this level to force a single hoisted copy at node_modules/ajv. Without it, bun puts eslint's ajv@^6.x in the root slot and gives snapshot.js / ajv-formats / ajv-errors each their own nested 8.x copy — same version, different module identities, which breaks ajv-errors's vocabulary registration ('SyntaxError: Unexpected token :'). Drop this dep when bun supports nested overrides (oven-sh/bun#6608) or ajv-errors is replaced upstream.",
56
"scripts": {
67
"lint": "eslint src/ test/ --ext .ts",
7-
"lint:fix": "yarn lint --fix",
8+
"lint:fix": "bun run lint --fix",
89
"typecheck": "tsc --noEmit",
910
"build": "tsc",
1011
"dev": "nodemon src/index.ts",
1112
"start": "node build/src/index.js",
12-
"start:test": "dotenv -e test/.env.test yarn dev",
13-
"test:setup": "dotenv -e test/.env.test yarn ts-node ./test/setupDb.ts",
14-
"test": "yarn test:setup; PORT=3003 start-server-and-test 'yarn start:test' http://localhost:3003 'dotenv -e test/.env.test jest --runInBand'",
13+
"start:test": "dotenv -e test/.env.test bun run dev",
14+
"test:setup": "dotenv -e test/.env.test bunx ts-node ./test/setupDb.ts",
15+
"test": "bun run test:setup; PORT=3003 start-server-and-test 'bun run start:test' http://localhost:3003 'dotenv -e test/.env.test jest --runInBand'",
1516
"test:unit": "dotenv -e test/.env.test jest --runInBand --collectCoverage=false test/unit",
1617
"test:integration": "dotenv -e test/.env.test jest --runInBand --collectCoverage=false test/integration",
17-
"test:e2e": "PORT=3003 start-server-and-test 'yarn start:test' http://localhost:3003 'dotenv -e test/.env.test jest --runInBand --collectCoverage=false test/e2e/'"
18+
"test:e2e": "PORT=3003 start-server-and-test 'bun run start:test' http://localhost:3003 'dotenv -e test/.env.test jest --runInBand --collectCoverage=false test/e2e/'"
1819
},
1920
"eslintConfig": {
2021
"extends": "@snapshot-labs"
@@ -32,14 +33,15 @@
3233
"@snapshot-labs/pineapple": "^1.2.1",
3334
"@snapshot-labs/snapshot-metrics": "^1.4.1",
3435
"@snapshot-labs/snapshot-sentry": "^1.5.5",
35-
"@snapshot-labs/snapshot.js": "^0.14.20",
36+
"@snapshot-labs/snapshot.js": "^0.14.21",
37+
"ajv": "8.11.0",
3638
"bluebird": "^3.7.2",
3739
"connection-string": "^1.0.1",
3840
"cors": "^2.8.5",
3941
"dotenv": "^16.0.2",
4042
"express": "^4.18.1",
4143
"express-rate-limit": "^6.9.0",
42-
"lodash": "^4.17.21",
44+
"lodash": "4.17.21",
4345
"mysql": "^2.18.1",
4446
"node-fetch": "^2.7.0",
4547
"rate-limit-redis": "^3.1.0",
@@ -50,19 +52,23 @@
5052
"winston": "^3.8.2",
5153
"zod": "3.23.8"
5254
},
55+
"overrides": {
56+
"@snapshot-labs/eslint-config-base": "0.1.0-beta.18",
57+
"ofetch": "1.3.3"
58+
},
5359
"devDependencies": {
54-
"@snapshot-labs/eslint-config": "^0.1.0-beta.18",
55-
"@snapshot-labs/prettier-config": "^0.1.0-beta.7",
56-
"@types/jest": "^29.5.2",
60+
"@snapshot-labs/eslint-config": "0.1.0-beta.18",
61+
"@snapshot-labs/prettier-config": "0.1.0-beta.7",
62+
"@types/jest": "29.5.2",
5763
"@types/node": "^16.0.0",
5864
"dotenv-cli": "^7.2.1",
5965
"eslint": "^8.28.0",
60-
"jest": "^29.6.1",
61-
"jest-environment-node-single-context": "^29.1.0",
66+
"jest": "29.6.1",
67+
"jest-environment-node-single-context": "29.1.0",
6268
"nodemon": "^2.0.19",
63-
"prettier": "^3.0.3",
69+
"prettier": "3.0.3",
6470
"start-server-and-test": "^2.0.0",
6571
"supertest": "^6.3.4",
66-
"ts-jest": "^29.1.1"
72+
"ts-jest": "29.1.1"
6773
}
6874
}

scripts/hibernate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import networks from '@snapshot-labs/snapshot.js/src/networks.json';
44

55
async function main() {
66
if (process.argv.length < 2) {
7-
console.error(`Usage: yarn ts-node scripts/hibernate.ts run|preview`);
7+
console.error(`Usage: bunx ts-node scripts/hibernate.ts run|preview`);
88
return process.exit(1);
99
}
1010

scripts/import-skins.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* All imported colors will be in 6-character hex format, and will not support transparency.
1111
* All colors with transparency will be opacified, based on the background color
1212
*
13-
* To run this script: yarn ts-node scripts/import-skins.ts
13+
* To run this script: bunx ts-node scripts/import-skins.ts
1414
*/
1515

1616
import 'dotenv/config';

scripts/import-statements.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'dotenv/config';
22
import run from '../src/lib/importer/statement';
33

4-
// Usage: yarn ts-node scripts/import-statements.ts --providers tally,agora --spaces s:hop.eth
4+
// Usage: bunx ts-node scripts/import-statements.ts --providers tally,agora --spaces s:hop.eth
55
async function main() {
66
let providers: string[] | undefined = undefined;
77
let spaces: string[] | undefined = undefined;

scripts/init_leaderboard_counters.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'dotenv/config';
22
import db from '../src/helpers/mysql';
33

4-
// Usage: yarn ts-node scripts/init_leaderboard_counters.ts --pivot TIMESTAMP
4+
// Usage: bunx ts-node scripts/init_leaderboard_counters.ts --pivot TIMESTAMP
55
async function main() {
66
let pivot: number | null = null;
77

scripts/refresh-space-leaderboard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'dotenv/config';
22
import db from '../src/helpers/mysql';
33

4-
// Usage: yarn ts-node scripts/refresh-space-leaderboard.ts --space SPACE-ID
4+
// Usage: bunx ts-node scripts/refresh-space-leaderboard.ts --space SPACE-ID
55
// This script assumes there are no active proposals in the space
66

77
async function getFirstAndLastVote(space: string) {

0 commit comments

Comments
 (0)