Skip to content

Commit 864f3e6

Browse files
Copilotr-near
andcommitted
Migrate from pnpm/turborepo to bun package manager
Co-authored-by: r-near <[email protected]>
1 parent 4df1471 commit 864f3e6

File tree

13 files changed

+43
-6626
lines changed

13 files changed

+43
-6626
lines changed

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Happy contributing!
99
- [ ] I have read the [Contributing Guidelines on pull requests](https://github.com/near/near-api-js/blob/master/CONTRIBUTING.md).
1010
- [ ] Commit messages follow the [conventional commits](https://www.conventionalcommits.org/) spec
1111
- [ ] **If this is a code change**: I have written unit tests.
12-
- [ ] **If this changes code in a published package**: I have run `pnpm changeset` to create a `changeset` JSON document appropriate for this change.
12+
- [ ] **If this changes code in a published package**: I have run `bun changeset` to create a `changeset` JSON document appropriate for this change.
1313
- [ ] **If this is a new API or substantial change**: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.
1414

1515
## Motivation

.github/workflows/pull-request.yml

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,46 +21,36 @@ jobs:
2121
- name: Checkout repository
2222
uses: actions/checkout@v4
2323

24-
25-
- name: Cache turbo build setup
26-
uses: actions/cache@v4
27-
with:
28-
path: .turbo
29-
key: ${{ runner.os }}-turbo-${{ github.sha }}
30-
restore-keys: |
31-
${{ runner.os }}-turbo-
32-
33-
- name: Setup pnpm
34-
uses: pnpm/action-setup@v4
24+
- name: Setup bun
25+
uses: oven-sh/setup-bun@v2
3526
with:
36-
version: 10.4.1
27+
bun-version: 1.1.42
3728

3829
- name: Setup Node
3930
uses: actions/setup-node@v4
4031
with:
4132
node-version: 20.18.3
42-
cache: pnpm
4333

4434
- name: Install dependencies
45-
run: pnpm install
35+
run: bun install
4636

4737
- name: Typecheck
48-
run: pnpm typecheck
38+
run: bun run typecheck
4939

5040
- name: Build
51-
run: pnpm build
41+
run: bun run build
5242

5343
- name: Lint
54-
run: pnpm lint
44+
run: bun run lint
5545

5646
- name: Unit tests
57-
run: pnpm test
47+
run: bun run test
5848

5949
- name: Check exports
60-
run: pnpm check-exports
50+
run: bun run check-exports
6151

6252
- name: E2E tests
63-
run: pnpm it --ignore-workspace --dir e2e
53+
run: cd e2e && bun install && bun run test
6454

6555
changeset-checks:
6656
runs-on: ubuntu-latest
@@ -88,7 +78,7 @@ jobs:
8878
if: steps.source-files.outputs.has_changed == 'true' && steps.changesets.outputs.has_added == 'false'
8979
run: |
9080
echo "❌ Source files changed, but no new changset file was added."
91-
echo "Please run 'pnpm changeset' and commit the generated file."
81+
echo "Please run 'bun changeset' and commit the generated file."
9282
exit 1
9383
9484
- name: Fail if changeset was added, but no source files were changed

.github/workflows/release.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,26 @@ jobs:
2121
- name: Checkout Repo
2222
uses: actions/checkout@v4
2323

24-
- name: Setup pnpm
25-
uses: pnpm/action-setup@v4
24+
- name: Setup bun
25+
uses: oven-sh/setup-bun@v2
2626
with:
27-
version: 10.4.1
27+
bun-version: 1.1.42
2828

2929
- name: Setup Node.js
3030
uses: actions/setup-node@v4
3131
with:
3232
node-version: 20.18.3
33-
cache: pnpm
3433

3534
- name: Install Dependencies
36-
run: pnpm install
35+
run: bun install
3736

3837
- name: Build Packages
39-
run: pnpm build
38+
run: bun run build
4039

4140
- name: Create Release Pull Request or Publish to NPM
4241
uses: changesets/action@v1
4342
with:
44-
publish: pnpm release
43+
publish: bun run release
4544
commit: "chore(release): publish packages"
4645
title: "Publish packages"
4746
createGithubReleases: ${{ github.ref_name == 'master' }}

.github/workflows/typedoc-generator.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ env:
99
NODE_VERSION: 20.18.3
1010
ENTRY_FILE: 'packages'
1111
CONFIG_PATH: 'tsconfig.base.json'
12-
USES_PNPM: 'true'
1312
DESTINATION_FOLDER: "docs"
1413

1514
jobs:
@@ -21,24 +20,23 @@ jobs:
2120
steps:
2221
- uses: actions/checkout@v4
2322

24-
- name: Setup pnpm
25-
uses: pnpm/action-setup@v4
23+
- name: Setup bun
24+
uses: oven-sh/setup-bun@v2
2625
with:
27-
version: 10.4.1
26+
bun-version: 1.1.42
2827

2928
- uses: actions/setup-node@v4
3029
with:
3130
node-version: ${{ env.NODE_VERSION }}
32-
cache: 'pnpm'
3331

3432
- name: Install dependencies
35-
run: pnpm install
33+
run: bun install
3634

3735
- name: Build project
38-
run: pnpm build
36+
run: bun run build
3937

4038
- name: Build documentation
41-
run: pnpm docs:generate
39+
run: bun run docs:generate
4240

4341
- name: Deploy to GitHub pages
4442
uses: JamesIves/github-pages-deploy-action@v4

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,4 @@ lib/
2222
# Generated test files
2323
test-keys/
2424

25-
.turbo
26-
2725
typedoc-docs/

.husky/commit-msg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/sh
22

3-
pnpm commitlint --edit $1
3+
bun commitlint --edit $1

.husky/pre-push

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/sh
22

3-
pnpm lint
3+
bun lint

README.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,23 @@ NEAR JavaScript API is a complete library to interact with the NEAR blockchain.
1919

2020
1. Install dependencies
2121

22-
pnpm install
22+
bun install
2323

2424
2. Run continuous build with:
2525

26-
pnpm -r compile -w
26+
bun run compile -w
2727

2828
### Publish
2929

3030
Prepare `dist` version by running:
3131

32-
pnpm dist
32+
bun run dist
3333

3434
### Integration Test
3535

3636
Start the node by following instructions from [nearcore](https://github.com/nearprotocol/nearcore), then
3737

38-
pnpm test
38+
bun run test
3939

4040
Tests use sample contract from `near-hello` npm package, see https://github.com/nearprotocol/near-hello
4141

@@ -45,21 +45,18 @@ From the root directory, run the following commands:
4545

4646
```
4747
cd e2e
48-
pnpm install --ignore-workspace
49-
pnpm test
48+
bun install
49+
bun run test
5050
```
5151

52-
The `--ignore-workspace` flag is required because the `e2e` project is intentionally excluded from the workspace.
53-
This setup ensures that packages are installed just like a real application would — as standalone builds. Workspace linking would not allow this, as it forces symlinks instead of proper package installations.
54-
5552
### Update error schema
5653

5754
Follow next steps:
5855

5956
1. [Optionally, set a specific hash for the commit with errors in the nearcore](https://github.com/near/near-api-js/blob/master/packages/utils/fetch_error_schema.js#L4-L5)
6057
2. Fetch new schema: `node fetch_error_schema.js`
61-
3. `pnpm build` and `pnpm test` to check tests still work
62-
4. `pnpm changeset` to generate a changeset with a minor bump for the @near-js/utils package
58+
3. `bun run build` and `bun run test` to check tests still work
59+
4. `bun changeset` to generate a changeset with a minor bump for the @near-js/utils package
6360
5. commit all changes and submit a PR on GitHub
6461

6562
## Packages

README2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ npm install near-api-js
99
# or
1010
yarn add near-api-js
1111
# or
12-
pnpm add near-api-js
12+
bun add near-api-js
1313
```
1414

1515
## Why near-api-js?

TOOLING.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@
22

33
This document describes at a high level some the key tools used across `near-js`.
44

5-
## Package Manager - [PNPM](https://pnpm.io/)
6-
PNPM is a package manager focused on fast installations while still being disk efficient. It manages dependency installations across the monorepo as well as linking interdependent packages. Unlike other package managers, PNPM creates a non-flat `node_modules` structure which ensures packages only have access to dependencies defined in their `package.json`.
7-
8-
## Build System - [Turborepo](https://turborepo.org/)
9-
Turborepo provides tooling for orchestrating commands across the monorepo. Similar to Yarn Workspaces, Turborepo can run tasks within each project via a single command, but rather than executing serially, Turborepo has various performance enhancing features such as task parallelization and local/remote caching.
5+
## Package Manager - [Bun](https://bun.sh/)
6+
Bun is a fast all-in-one JavaScript runtime and toolkit with a built-in bundler, test runner, and Node.js-compatible package manager. It provides significantly faster package installations compared to npm, yarn, or pnpm while maintaining full compatibility with the npm ecosystem.
107

118
## Package Publishing - [Changesets](https://github.com/changesets/changesets)
129
Changesets manages package versioning, changelog generation, and publishing to the package registry. Changesets provides a CLI to simplify bumping packages and adding changelog entries, it then automates versioning and publishing via GitHub Actions.

0 commit comments

Comments
 (0)