Skip to content
Open
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
4 changes: 4 additions & 0 deletions .yamlfmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
formatter:
type: basic
indent: 2
retain_line_breaks: true
4 changes: 4 additions & 0 deletions .yamlfmt.manifests
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
formatter:
type: basic
indent: 4
retain_line_breaks: true
28 changes: 28 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
TEMPLATES_REPO := "git@github.com:ethereum-optimism/devnet-templates.git"
TEMPLATES_BRANCH := "main"

# Devnet folders whose YAML files are formatted (indent config lives in .yamlfmt)
YAML_DIRS := "dev stg prod"

# Default: show help
default:
@just --list
Expand Down Expand Up @@ -106,3 +109,28 @@ create-devnet net_type name preset:
echo "Next steps:"
echo " 1. Edit $TARGET_DIR/manifest.yaml to configure your devnet"
echo " 2. Edit $TARGET_DIR/inventory.yaml to configure nodes and services"

# Fix YAML indentation/formatting in place across dev/stg/prod devnet folders.
# manifest.yaml uses 4-space, all other YAML uses 2-space, matching netchef output.
fmt-yaml:
#!/usr/bin/env bash
set -euo pipefail
dirs=()
for d in {{YAML_DIRS}}; do [ -d "$d" ] && dirs+=("$d"); done
[ ${#dirs[@]} -eq 0 ] && exit 0
manifests=(); while IFS= read -r f; do manifests+=("$f"); done < <(find "${dirs[@]}" -name manifest.yaml)
others=(); while IFS= read -r f; do others+=("$f"); done < <(find "${dirs[@]}" -name '*.yaml' ! -name manifest.yaml)
if [ ${#manifests[@]} -gt 0 ]; then mise exec -- yamlfmt -conf .yamlfmt.manifests "${manifests[@]}"; fi
if [ ${#others[@]} -gt 0 ]; then mise exec -- yamlfmt "${others[@]}"; fi

# Check YAML formatting without writing changes (fails if any file needs formatting)
lint-yaml:
#!/usr/bin/env bash
set -euo pipefail
dirs=()
for d in {{YAML_DIRS}}; do [ -d "$d" ] && dirs+=("$d"); done
[ ${#dirs[@]} -eq 0 ] && exit 0
manifests=(); while IFS= read -r f; do manifests+=("$f"); done < <(find "${dirs[@]}" -name manifest.yaml)
others=(); while IFS= read -r f; do others+=("$f"); done < <(find "${dirs[@]}" -name '*.yaml' ! -name manifest.yaml)
if [ ${#manifests[@]} -gt 0 ]; then mise exec -- yamlfmt -lint -conf .yamlfmt.manifests "${manifests[@]}"; fi
if [ ${#others[@]} -gt 0 ]; then mise exec -- yamlfmt -lint "${others[@]}"; fi
3 changes: 2 additions & 1 deletion mise.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[tools]
mdbook = "v0.4.43"
uv = "0.9.5"
"pipx:cookiecutter" = "2.6.0"
"pipx:cookiecutter" = "2.6.0"
yamlfmt = "0.21.0"