From c44a54d392f0c16596923717d7b98677b7fe2534 Mon Sep 17 00:00:00 2001 From: Andrew Davis <1709934+Savid@users.noreply.github.com> Date: Tue, 3 Jun 2025 13:32:33 +1000 Subject: [PATCH] Add Makefile for streamlined build process and update README with simplified instructions --- Makefile | 15 +++++++++++++++ README.md | 41 ++++++++++++++++------------------------- 2 files changed, 31 insertions(+), 25 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..935fcdb3 --- /dev/null +++ b/Makefile @@ -0,0 +1,15 @@ +.PHONY: default build serve lint clean + +default: build serve + +build: + npx swagger-cli bundle ./beacon-node-oapi.yaml -r -t yaml -o ./deploy/beacon-node-oapi.yaml + +serve: + npx http-server -c-1 deploy -o "/?urls.primaryName=dev" + +lint: + npx @redocly/cli lint beacon-node-oapi.yaml + +clean: + rm -f ./deploy/beacon-node-oapi.yaml diff --git a/README.md b/README.md index fb2454ab..ea96e5c3 100644 --- a/README.md +++ b/README.md @@ -22,27 +22,26 @@ to perform validator related tasks, called "duties", on the beacon chain. The goal of this specification is to promote interoperability between various beacon node implementations. -## Render -To render spec in browser you will need any http server to load `index.html` file -in root of the repo. +## Build and Serve Locally -##### Python -``` -python -m http.server 8080 -``` -And api spec will render on [http://localhost:8080](http://localhost:8080). +The easiest way to build and serve the API spec locally is using the provided Makefile: -##### NodeJs -``` -npm install simplehttpserver -g +```bash +# Build and serve the spec (default) +make + +# Build only +make build -# OR +# Serve only (after building) +make serve -yarn global add simplehttpserver +# Run linting +make lint -simplehttpserver +# Clean build artifacts +make clean ``` -And api spec will render on [http://localhost:8000](http://localhost:8000). ### Usage @@ -53,17 +52,9 @@ Users may need to tick the "Disable Cache" box in their browser's developer tool ## Contributing Api spec is checked for lint errors before merge. -To run lint locally, install linter with -``` -npm install -g @redocly/cli - -# OR - -yarn global add @redocly/cli -``` -and run lint with +To run lint locally, run ``` -redocly lint beacon-node-oapi.yaml +make lint ``` ## Releasing