-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🪚 Stub of toolbox-foundry package (#220)
- Loading branch information
1 parent
34d6ad8
commit ebddc88
Showing
18 changed files
with
187 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ dist | |
node_modules | ||
*.md | ||
*.sol | ||
*.toml | ||
pnpm-lock.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[submodule "toolbox-foundry/forge-std"] | ||
path = packages/toolbox-foundry/lib/forge-std | ||
url = https://github.com/foundry-rs/forge-std | ||
[submodule "toolbox-foundry/ds-test"] | ||
path = packages/toolbox-foundry/lib/ds-test | ||
url = https://github.com/dapphub/ds-test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,29 @@ The code is arranged into: | |
|
||
## Development | ||
|
||
### Getting the source code | ||
|
||
This repository contains several git submodules. To clone the repository, please follow these steps: | ||
|
||
```bash | ||
# 1. Clone the repository | ||
|
||
# Using HTTPS | ||
git clone https://github.com/LayerZero-Labs/devtools.git | ||
|
||
# Using SSH | ||
git clone [email protected]:LayerZero-Labs/devtools.git | ||
|
||
# 2. Install submodules | ||
|
||
git submodules init | ||
git submodules update | ||
``` | ||
|
||
### Setting up the environment | ||
|
||
This repository uses `pnpm` as its package manager and has a requirement on the minimum `node` version used. If using `nvm`, please run the following to setup the enviornment: | ||
|
||
```bash | ||
# or nvm install if nvm use fails | ||
nvm use | ||
|
@@ -29,7 +52,11 @@ corepack enable | |
|
||
# Install project dependencies | ||
pnpm install | ||
``` | ||
|
||
### Making changes | ||
|
||
```bash | ||
# Build the entire project | ||
pnpm build | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ import type { Example, PackageManager } from '@/types' | |
* To enable example development in a custom repository | ||
* we open the repository URL field to be taken from the environment | ||
*/ | ||
const repository = process.env['LAYERZERO_EXAMPLES_REPOSITORY_URL'] || '[email protected]:LayerZero-Labs/lz-utils' | ||
const repository = process.env['LAYERZERO_EXAMPLES_REPOSITORY_URL'] || '[email protected]:LayerZero-Labs/devtools' | ||
|
||
/** | ||
* To enable example development in a custom branch, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ import { createExampleGitURL } from '@/utilities/cloning' | |
|
||
describe('utilities/cloning', () => { | ||
describe('createExampleGitURL', () => { | ||
const REPO_URL = '[email protected]:LayerZero-Labs/lz-utils' | ||
const REPO_URL = '[email protected]:LayerZero-Labs/devtools' | ||
|
||
it('should return the repository field if directory and ref are not specified', () => { | ||
expect(createExampleGitURL({ repository: REPO_URL, id: 'dummy', label: 'Dummy' })).toEqual(REPO_URL) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
lib | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "../../.eslintrc.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
lib/ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<p align="center"> | ||
<a href="https://layerzero.network"> | ||
<img alt="LayerZero" style="max-width: 500px" src="https://d3a2dpnnrypp5h.cloudfront.net/bridge-app/lz.png"/> | ||
</a> | ||
</p> | ||
|
||
<h1 align="center">Development</h1> | ||
|
||
## Adding libraries | ||
|
||
To install a new library to be included with this package, please follow these steps: | ||
|
||
```bash | ||
# In your terminal, navigate to the root of the devtools repository | ||
|
||
# Add a git submodule | ||
# | ||
# These two examples show the commands for the two existing libraries, forge-std and ds-test | ||
git submodule add --name "toolbox-foundry/ds-test" --force https://github.com/dapphub/ds-test packages/toolbox-foundry/lib/ds-test | ||
git submodule add --name "toolbox-foundry/forge-std" --force https://github.com/foundry-rs/forge-std packages/toolbox-foundry/lib/forge-std | ||
``` | ||
|
||
Alternatively use the `forge install` command but since it is not playing nice with the monorepo structure, you might end up with a broken submodule state. | ||
|
||
After adding a submodule, the pre-commit hooks setup using `husky` and `lint-staged` tend to error out on not being able to lint the submodule even though the `lib` directory has been ignored in both ESLint and Prettier. This is a known and low-priority bug, for now please just make a commit containing only the change to `.gitmodules` using `--no-verify` flag: | ||
|
||
```bash | ||
git commit -m "chore: Adding XXX library" --no-verify | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<p align="center"> | ||
<a href="https://layerzero.network"> | ||
<img alt="LayerZero" style="max-width: 500px" src="https://d3a2dpnnrypp5h.cloudfront.net/bridge-app/lz.png"/> | ||
</a> | ||
</p> | ||
|
||
<h1 align="center">@layerzerolabs/toolbox-foundry</h1> | ||
|
||
<p align="center">One-stop-shop for developing LayerZero applications with <code>foundry</code></p> | ||
|
||
## Installation | ||
|
||
```bash | ||
yarn add @layerzerolabs/toolbox-foundry | ||
|
||
pnpm add @layerzerolabs/toolbox-foundry | ||
|
||
npm install @layerzerolabs/toolbox-foundry | ||
``` | ||
|
||
## Configuration | ||
|
||
### 1. Add `@layerzerolabs/toolbox-foundry` to your config | ||
|
||
To use `@layerzerolabs/toolbox-foundry` you will need to point to it in your `foundry.toml` config file. | ||
|
||
```toml | ||
libs = [ | ||
'node_modules/@layerzerolabs/toolbox-foundry/lib' | ||
# Any other library folders you need, e.g. | ||
'node_modules' | ||
] | ||
``` | ||
|
||
## Usage | ||
|
||
### Testing | ||
|
||
This package comes with support for `forge-std` out of the box so you can start using: | ||
|
||
```solidity | ||
// forge-std is automatically resolved without needing to install it | ||
// so you can start using forge test helpers in your tests | ||
import "forge-std/console.sol"; | ||
import { Test } from "forge-std/Test.sol"; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"name": "@layerzerolabs/toolbox-foundry", | ||
"version": "0.0.1", | ||
"description": "One-stop-shop for developing LayerZero applications using foundry", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/LayerZero-Labs/devtools.git", | ||
"directory": "packages/toolbox-foundry" | ||
}, | ||
"license": "MIT", | ||
"files": [ | ||
"lib", | ||
"!lib/ds-test/.github", | ||
"!lib/ds-test/.gitignore", | ||
"!lib/ds-test/demo", | ||
"!lib/forge-std/.github", | ||
"!lib/forge-std/.gitignore", | ||
"!lib/forge-std/.gitmodules" | ||
], | ||
"scripts": {}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@types/jest": "^29.5.11", | ||
"jest": "^29.7.0", | ||
"ts-jest": "^29.1.1", | ||
"ts-node": "^10.9.2", | ||
"tsup": "~8.0.1", | ||
"typescript": "^5.3.3" | ||
}, | ||
"publishConfig": { | ||
"access": "restricted" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters