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

build: switch to bun for dep management #775

Merged
merged 3 commits into from
Jan 1, 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
32 changes: 8 additions & 24 deletions .github/workflows/ci-deep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,14 @@ jobs:
- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install Pnpm"
uses: "pnpm/action-setup@v2"
with:
version: "8"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
cache: "pnpm"
node-version: "lts/*"
- name: "Install Bun"
uses: "oven-sh/setup-bun@v1"

- name: "Install the Node.js dependencies"
run: "pnpm install"
run: "bun install"

- name: "Lint the contracts"
run: "pnpm lint"
- name: "Lint the code"
run: "bun run lint"

- name: "Add lint summary"
run: |
Expand All @@ -72,19 +64,11 @@ jobs:
- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install Pnpm"
uses: "pnpm/action-setup@v2"
with:
version: "8"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
cache: "pnpm"
node-version: "lts/*"
- name: "Install Bun"
uses: "oven-sh/setup-bun@v1"

- name: "Install the Node.js dependencies"
run: "pnpm install"
run: "bun install"

- name: "Show the Foundry config"
run: "forge config"
Expand Down
32 changes: 8 additions & 24 deletions .github/workflows/ci-slither.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,14 @@ jobs:
- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install Pnpm"
uses: "pnpm/action-setup@v2"
with:
version: "8"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
cache: "pnpm"
node-version: "lts/*"
- name: "Install Bun"
uses: "oven-sh/setup-bun@v1"

- name: "Install the Node.js dependencies"
run: "pnpm install"
run: "bun install"

- name: "Lint the contracts"
run: "pnpm lint"
- name: "Lint the code"
run: "bun run lint"

- name: "Add lint summary"
run: |
Expand All @@ -51,19 +43,11 @@ jobs:
- name: "Check out the repo"
uses: "actions/checkout@v3"

- name: "Install Pnpm"
uses: "pnpm/action-setup@v2"
with:
version: "8"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
cache: "pnpm"
node-version: "lts/*"
- name: "Install Bun"
uses: "oven-sh/setup-bun@v1"

- name: "Install the Node.js dependencies"
run: "pnpm install"
run: "bun install"

- name: "Run Slither analysis"
uses: "crytic/slither-action@v0.3.0"
Expand Down
43 changes: 8 additions & 35 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,14 @@ jobs:
- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install Pnpm"
uses: "pnpm/action-setup@v2"
with:
version: "8"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
cache: "pnpm"
node-version: "lts/*"
- name: "Install Bun"
uses: "oven-sh/setup-bun@v1"

- name: "Install the Node.js dependencies"
run: "pnpm install"
run: "bun install"

- name: "Lint the contracts"
run: "pnpm lint"
- name: "Lint the code"
run: "bun run lint"

- name: "Add lint summary"
run: |
Expand All @@ -57,19 +49,11 @@ jobs:
- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install Pnpm"
uses: "pnpm/action-setup@v2"
with:
version: "8"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
cache: "pnpm"
node-version: "lts/*"
- name: "Install Bun"
uses: "oven-sh/setup-bun@v1"

- name: "Install the Node.js dependencies"
run: "pnpm install"
run: "bun install"

- name: "Show the Foundry config"
run: "forge config"
Expand Down Expand Up @@ -112,17 +96,6 @@ jobs:
- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install Pnpm"
uses: "pnpm/action-setup@v2"
with:
version: "8"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
cache: "pnpm"
node-version: "lts/*"

- name: "Restore the cached build and the node modules"
uses: "actions/cache/restore@v3"
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ out-svg
.pnp.*
lcov.info
package-lock.json
pnpm-lock.yaml
yarn.lock
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ out-svg
*.sol
.DS_Store
.pnp.*
bun.lockb
lcov.info
package-lock.json
pnpm-lock.yaml
Expand Down
14 changes: 10 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ You will need the following software on your machine:
- [Git](https://git-scm.com/downloads)
- [Foundry](https://github.com/foundry-rs/foundry)
- [Node.Js](https://nodejs.org/en/download/)
- [Pnpm](https://pnpm.io/)
- [Bun](https://bun.sh/)

In addition, familiarity with [Solidity](https://soliditylang.org/) is requisite.

Expand All @@ -26,14 +26,21 @@ Clone this repository including submodules:
$ git clone --recurse-submodules -j8 git@github.com:sablier-labs/v2-core.git
```

Then, inside the project's directory, run this to install the Node.js dependencies:
Then, inside the project's directory, run this to install the Node.js dependencies and build the contracts:

```shell
$ pnpm install
$ bun install
$ bun run build
```

PaulRBerg marked this conversation as resolved.
Show resolved Hide resolved
Now you can start making changes.

To see a list of all available scripts:

```shell
$ bun run
```

## Pull Requests

When making a pull request, ensure that:
Expand All @@ -48,7 +55,6 @@ When making a pull request, ensure that:
- Gas snapshots are provided and demonstrate an improvement (or an acceptable deficit given other improvements).
- Reference contracts are modified correspondingly if relevant.
- New tests are included for all new features or code paths.
- If making a modification to third-party Node.js dependencies, `pnpm audit` passes.
- A descriptive summary of the PR has been provided.

## Environment Variables
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ of tokens deposited.

This is the recommended approach.

Install Sablier V2 Core as a Node.js package:
Install Sablier V2 Core using your favorite package manager, e.g., with Bun:

```shell
yarn add @sablier/v2-core
bun add @sablier/v2-core
```

Then, if you are using Foundry, add these to your `remappings.txt` file:
Then, if you are using Foundry, you need to add these to your `remappings.txt` file:

```text
@sablier/v2-core/=node_modules/@sablier/v2-core/
Expand All @@ -46,6 +46,8 @@ Then, if you are using Foundry, add these to your `remappings.txt` file:

### Git Submodules

This installation method is not recommended, but it is available for those who prefer it.

First, install the submodule using Forge:

```shell
Expand Down
Binary file added bun.lockb
Binary file not shown.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"forge-std": "github:foundry-rs/forge-std#v1.5.6",
"prettier": "^2.8.8",
"solady": "0.0.129",
"solarray": "github:evmcheb/solarray#0625e7e",
"solarray": "github:sablier-labs/solarray#6bf10cb",
"solhint": "^4.0.0"
},
"files": [
Expand Down Expand Up @@ -64,14 +64,14 @@
"clean": "rm -rf artifacts broadcast cache docs out out-optimized out-svg",
"gas:report": "forge test --gas-report --mp \"./test/integration/**/*.sol\" --nmt \"test(Fuzz)?_RevertWhen_\\w{1,}?\"",
"gas:snapshot": "forge snapshot --mp \"./test/integration/**/*.sol\" --nmt \"test(Fuzz)?_RevertWhen_\\w{1,}?\"",
"gas:snapshot:optimized": "pnpm build:optimized && FOUNDRY_PROFILE=test-optimized forge snapshot --mp \"./test/integration/**/*.sol\" --nmt \"test(Fork)?(Fuzz)?_RevertWhen_\\w{1,}?\"",
"lint": "pnpm lint:sol && pnpm prettier:check",
"lint:sol": "forge fmt --check && pnpm solhint \"{script,src,test}/**/*.sol\"",
"prepack": "pnpm install && bash ./shell/prepare-artifacts.sh",
"gas:snapshot:optimized": "bun run build:optimized && FOUNDRY_PROFILE=test-optimized forge snapshot --mp \"./test/integration/**/*.sol\" --nmt \"test(Fork)?(Fuzz)?_RevertWhen_\\w{1,}?\"",
"lint": "bun run lint:sol && bun run prettier:check",
"lint:sol": "forge fmt --check && bun solhint \"{script,src,test}/**/*.sol\"",
PaulRBerg marked this conversation as resolved.
Show resolved Hide resolved
"prepack": "bun install && bash ./shell/prepare-artifacts.sh",
"prettier:check": "prettier --check \"**/*.{json,md,svg,yml}\"",
"prettier:write": "prettier --write \"**/*.{json,md,svg,yml}\"",
"test": "forge test",
"test:lite": "FOUNDRY_PROFILE=lite forge test",
"test:optimized": "pnpm build:optimized && FOUNDRY_PROFILE=test-optimized forge test"
"test:optimized": "bun run build:optimized && FOUNDRY_PROFILE=test-optimized forge test"
}
}
Loading