Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(docs): add vhs gif #2012

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
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
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ install: install.gnokey install.gno install.gnodev
.PHONY: install.gnokey
install.gnokey:
$(MAKE) --no-print-directory -C ./gno.land install.gnokey
# \033[0;32m ... \033[0m is ansi for green text.
@echo "\033[0;32m[+] 'gnokey' has been installed. Read more in ./gno.land/\033[0m"
.PHONY: install.gno
install.gno:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# XXX: source config for theming and common config
# Source ../../config.tape

# Output
Output gnokey-generate.gif

# Requirement
Require gnokey

# Set up, should be in config.
Set FontSize 18
Set Width 1200
Set Height 800

## Run

Type "gnokey generate"
Sleep 500ms
Enter

# Wait a bit and Exit
Sleep 3s
Ctrl+c
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# XXX: source config for theming and common config
# Source ../../config.tape

# Output
Output gnokey-help.gif

# Requirement
Require gnokey

# Set up, should be in config.
Set FontSize 18
Set Width 1200
Set Height 800

## Run

Type "gnokey --help"
Sleep 500ms
Enter


# Wait a bit and Exit
Sleep 3s
Ctrl+c
Binary file modified docs/assets/gno-tooling/gnodev/gnodev.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions docs/assets/gno-tooling/gnodev/gnodev.gif.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# XXX: source config for theming and common config
# Source ../../config.tape

# Output
Output gnodev.gif

# Requirement
Require gnodev

# Set up, should be in config.
Set FontSize 18
Set Width 1200
Set Height 800

## Run

Type "gnodev"
Sleep 500ms
Enter


# Wait a bit and Exit
Sleep 3s
Ctrl+c
3 changes: 3 additions & 0 deletions misc/gendocs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ clean:

kill_zombies:
kill -9 `lsof -t -i tcp:8080 -s TCP:LISTEN` || true

gif:
TAPES_DIR=$(PWD)/../../docs $(MAKE) -C ../gno-vhs gif.docker
1 change: 1 addition & 0 deletions misc/gno-vhs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.build
7 changes: 7 additions & 0 deletions misc/gno-vhs/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM ghcr.io/charmbracelet/vhs:v0.7.2

VOLUME /gobin

ENV PATH=/gobin:$PATH

RUN apt-get update && apt-get install -y make && rm -rf /var/lib/apt/lists/*
69 changes: 69 additions & 0 deletions misc/gno-vhs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Generate GIFs using VHS

# Makefile directory
CPATH := $(abspath $(lastword $(MAKEFILE_LIST)/../))

# GnoRoot path
GNOROOT_DIR ?= $(abspath $(CPATH)/../../)

# Specify on which directory to run
TAPES_DIR ?= $(GNOROOT_DIR)

# Other overwritable variables
BUILD_DIR ?= $(CPATH)/.build
IMAGE_NAME ?= charmbracelet/vhs:local

# Run vhs recursively on target directory
# For more information, visit https://github.com/charmbracelet/vhs/tree/main?tab=readme-ov-file#installation
gif:
@which ttyd ffmpeg vhs 1>/dev/null || \
(echo "ttyd, ffmpeg, and vhs need to be installed to generate GIF"; exit 1)
find $(TAPES_DIR) -iname '*.tape' -execdir vhs {} \; -print

## Nix

gif.nix:
nix-shell -p ffmpeg ttyd vhs --run 'TAPES_DIR=$(TAPES_DIR) make gif'

## Docker

# Run vhs within Docker
gif.docker: bins .dockerfile.build
docker run -it --rm \
-v "$(BUILD_DIR):/gobin" \
-v "$(GNOROOT_DIR):$(GNOROOT_DIR)" \
-v "$(TAPES_DIR):$(TAPES_DIR)" \
--workdir=$(CPATH) \
--entrypoint="bash" \
$(IMAGE_NAME) -c "TAPES_DIR=$(TAPES_DIR) make gif"

## Extra rules to run vhs+gno in Docker
bins: gnodev gno gnokey gnoland
.PHONY: bins

# Build binaries for Linux Docker container
gnodev: | $(BUILD_DIR)
GOOS=linux go -C $(GNOROOT_DIR)/contribs/gnodev/cmd/gnodev build -v -o $(BUILD_DIR)/gnodev .
gno: | $(BUILD_DIR)
GOOS=linux go -C $(GNOROOT_DIR)/gnovm/cmd/gno build -v -o $(BUILD_DIR)/gno .
gnokey: | $(BUILD_DIR)
GOOS=linux go -C $(GNOROOT_DIR)/gno.land/cmd/gnokey build -v -o $(BUILD_DIR)/gnokey .
gnoland: | $(BUILD_DIR)
GOOS=linux go -C $(GNOROOT_DIR)/gno.land/cmd/gnoland build -v -o $(BUILD_DIR)/gnoland .
.PHONY: gnodev gnokey gno gnoland

# Create build directory
$(BUILD_DIR):
mkdir -p $@

.dockerfile.build: Dockerfile
docker build -t $(IMAGE_NAME) . && touch $@

## Cleanup

clean:
rm -rf $(BUILD_DIR)

flcean: clean
rm -f .dockerfile.build

Loading