sambacha / foundry-scripts

ergonomic devtooling for foundry

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

a picture of justfile recipes




tldr

justfile

just is the new make

load .env via justfile run tests; etc; TLRs; two letter recipes


Quickstart

download the latest justfile

curl https://raw.githubusercontent.com/sambacha/foundry-scripts/master/justfile --output justfile --silent

In your repo, you execute the command just and add a recipe after to run the process

$ just
Available recipes:
    build                     # [BUILD]: Timer
    build-mainnet             # [TEST] mainnet test
    deploy-contract           # [DEPLOY]: Deploy contract
    dumpbuild                 # Executes a dump of ethers-rs solc compiler output into two json files
    forge-gas-snapshot        # [GAS] get gas snapshot timer
    forge-gas-snapshot-diff
    gas-cov
    gas-snapshot              # [GAS] default gas snapshot script
    gas-snapshot-local        # [GAS] get gas snapshot from local tests and save it to file
    size                      # Contract Size
    sl
    test                      # [TEST] default test scripts
    test-debug *commands=""   # [TEST] run mainnet fork forge debug tests (all files with the extension .t.sol)
    test-local *commands=""   # [TEST] run local forge test using --match-path <PATTERN>
    test-mainnet *commands="" # [TEST] run mainnet fork forge tests (all files with the extension .t.sol)
    tl
    verify-contract           # [DEPLOY]: Verify contract

using ssh

USE_SSH=true
GIT_USER=<GITHUB_USERNAME> forge deploy

Two Letter Recipes

TLR's

just tl
tl:
    forge test --list

sl:
    forge snapshot --list

ZSH Completions

In .zlogin:

fpath=($HOME/.zsh/completion $fpath)

autoload -Uz compinit
compinit -u

In $HOME/.zsh/completion/_just

#compdef _just just
#autoload

_just () {
    local -a subcmds

    subcmds=($(just --summary))

    _describe 'command' subcmds
}

_just "$@"

FiSH

completions/just.fish:

complete -c just -a (just --summary)

Bash v4.2+

Simple.

complete -W '$(just --summary)' just

Alt.

if [ -f justfile ]; then
    complete -W "`just --summary`" just
fi

# ex: ts=4 sw=4 et filetype=sh

Developer notes

If you modify the justfile, run just --fmt --unstable and it will format the justfile itself.

Repo Example

see https://github.com/sambacha/foundry-justfile-example

License

Apache-2.0/MIT

About

ergonomic devtooling for foundry

License:Other


Languages

Language:Shell 72.4%Language:Makefile 27.6%