Skip to content

Commit

Permalink
feat: Add more code blocks for yarn (#45)
Browse files Browse the repository at this point in the history
This adds code blocks to places where there was only yarn before so at
least there is npm and adds bun to other places where only yarn and npm
were before.

This does not cover everything, but catches some obvious places

# What 💻 
* Added code blocks to areas that just had yarn hard-coded
* In code blocks that only had yarn and npm, add bun

# Why ✋
* Having just yarn is inconsistent
* Other places have bun

# Evidence 📷

![image](https://github.com/matter-labs/zksync-docs/assets/2054226/f38861cd-98fc-4e57-92f1-6f6100620c7e)

# Notes 📝
* There isn't exhaustive for all locations that do this multi-command
option, so there are options for follow ups
* Adding a parameterized partial that auto-translates an npm command to
the yarn and bun commands might be cool
(https://www.npmjs.com/package/npm-to-yarn, but then needs something for
bun)
  • Loading branch information
cpb8010 authored May 2, 2024
1 parent 8519129 commit 4337d07
Show file tree
Hide file tree
Showing 12 changed files with 125 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ yarn add -D @matterlabs/hardhat-zksync-ethers zksync-ethers ethers
npm i -D @matterlabs/hardhat-zksync-ethers
```

```bash [bun]
bun add @matterlabs/hardhat-zksync-ethers --dev
```

::

## Configuration
Expand Down
4 changes: 4 additions & 0 deletions content/00.build/40.tooling/20.hardhat/110.hardhat-zksync.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ yarn add -D @matterlabs/hardhat-zksync
npm i -D @matterlabs/hardhat-zksync
```

```bash [bun]
bun add @matterlabs/hardhat-zksync --dev
```

::

### Usage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ yarn add -D @matterlabs/hardhat-zksync-node zksync-ethers ethers
npm i -D @matterlabs/hardhat-zksync-node
```

```bash [bun]
bun add @matterlabs/hardhat-zksync-node zksync-ethers ethers --dev
```

::

### Configuration
Expand All @@ -50,10 +54,18 @@ import "@matterlabs/hardhat-zksync-node";

### Commands

```sh
::code-group

```sh [yarn]
yarn hardhat node-zksync
```

```sh [npm]
npm run hardhat node-zksync
```

::

This command runs a local ZKsync In-memory node by initiating a JSON-RPC server.
It uses the provided or default configurations to set up and run the ZKsync node, allowing for blockchain operations in a local environment.
The command also handles tasks such as downloading the necessary JSON-RPC server binary if it's not already present.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ yarn add -D @matterlabs/hardhat-zksync
npm i -D @matterlabs/hardhat-zksync
```

```bash [bun]
bun add @matterlabs/hardhat-zksync --dev
```

::

## Configuration changes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ yarn add -D @matterlabs/hardhat-zksync-solc
npm i -D @matterlabs/hardhat-zksync-solc
```

```bash [bun]
bun add @matterlabs/hardhat-zksync-solc --dev
```

::

## Configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ Add the latest version of this plugin to your project with the following command

```bash [yarn]
yarn add -D @matterlabs/hardhat-zksync-vyper @nomiclabs/hardhat-vyper

```

```bash [npm]
npm i -D @matterlabs/hardhat-zksync-vyper
```

```bash [bun]
bun add @matterlabs/hardhat-zksync-vyper --dev
```

::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ yarn add -D @matterlabs/hardhat-zksync-deploy ethers zksync-ethers
npm i -D @matterlabs/hardhat-zksync-deploy
```

```bash [bun]
bun add @matterlabs/hardhat-zksync-deploy --dev
```

::

## Network Configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@ Add the latest version of this plugin to your project with the following command

```bash [yarn]
yarn add -D @matterlabs/hardhat-zksync-upgradable @openzeppelin/upgrades-core @openzeppelin/[email protected] @openzeppelin/[email protected]

```

```bash [npm]
npm i -D @matterlabs/hardhat-zksync-upgradable @openzeppelin/[email protected] @openzeppelin/[email protected]
```

```bash [bun]
bun add @matterlabs/hardhat-zksync-upgradable @openzeppelin/[email protected] @openzeppelin/[email protected] --dev
```

::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ yarn add -D @matterlabs/hardhat-zksync-verify @nomicfoundation/hardhat-verify
npm i -D @matterlabs/hardhat-zksync-verify
```

```bash [bun]
bun add @matterlabs/hardhat-zksync-verify --dev
```

::

### Configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ yarn add -D @matterlabs/hardhat-zksync-verify-vyper
npm i -D @matterlabs/hardhat-zksync-verify-vyper
```

```bash [bun]
bun add @matterlabs/hardhat-zksync-verify-vyper --dev
```

::

### Configuration
Expand Down
32 changes: 27 additions & 5 deletions content/00.build/60.test-and-debug/20.in-memory-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,22 @@ This section demonstrates how to author and execute tests locally against `era_t
1. To incorporate the test libraries, execute:
```bash
yarn add -D mocha chai @types/mocha @types/chai
::code-group
```bash [yarn]
yarn add -D mocha chai @types/mocha @types/chai
```
```bash [npm]
npm i mocha chai @types/mocha @types/chai --save-dev
```
```bash [bun]
bun add mocha chai @types/mocha @types/chai --dev
```
::
1. Add the following lines to your `package.json` in the root folder:
```json [package.json]
Expand Down Expand Up @@ -465,9 +477,19 @@ describe("Greeter", function () {
To run the test file, execute:
```bash
yarn test
```
::code-group
```bash [yarn]
yarn test
```
```bash [npm]
npm test
```
```bash [bun]
bun run test
```
::
Well done! You've successfully run your first local tests with ZKsync Era and `era_test_node`.
Expand Down
55 changes: 51 additions & 4 deletions content/00.build/60.test-and-debug/40.hardhat.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,40 @@ and we'll use [Mocha](https://mochajs.org/) as our test runner.

Install dependencies:

```bash
::code-group

```bash [yarn]
yarn install
```

```bash [npm]
npm install
```

```bash [bun]
bun install
```

::

1. Add the following additional dependencies:

```bash
::code-group

```bash [yarn]
yarn add -D @nomicfoundation/hardhat-chai-matchers @nomiclabs/hardhat-ethers
```

```bash [npm]
npm add @nomicfoundation/hardhat-chai-matchers @nomiclabs/hardhat-ethers --save-dev
```

```bash [bun]
bun add @nomicfoundation/hardhat-chai-matchers @nomiclabs/hardhat-ethers --dev
```

::

1. Import `@nomicfoundation/hardhat-chai-matchers` into the `hardhat.config.ts` file:

```typescript [hardhat.config.ts]
Expand Down Expand Up @@ -96,10 +120,21 @@ describe("Greeter", function () {
To run this test:
```bash
::code-group
```bash [yarn]
yarn test
```
```bash [npm]
npm test
```
```bash [bun]
bun run test
```
::
You should see the following output:
```sh
Expand Down Expand Up @@ -208,10 +243,22 @@ Let's refactor our test file with the provided script:
To run this test:
```bash
::code-group
```bash [yarn]
yarn test
```
```bash [npm]
npm test
```
```bash [bun]
bun run test
```
::
You should see the following output:
```sh
Expand Down

0 comments on commit 4337d07

Please sign in to comment.