A HTML templating language for Go that has great developer tooling.
Documentation
See user documentation at https://templ.guide
Tasks
build
Build a local version.
go run ./get-version > .version cd cmd/templ go build
install-snapshot
Build and install to ~/bin
rm cmd/templ/lspcmd/*.txt || true go run ./get-version > .version cd cmd/templ && go build -o ~/bin/templ
build-snapshot
Use goreleaser to build the command line binary using goreleaser.
goreleaser build --snapshot --clean
generate
Run templ generate using local version.
go run ./cmd/templ generate -include-version=false
test
Run Go tests.
go run ./get-version > .version go run ./cmd/templ generate -include-version=false go test ./...
test-cover
Run Go tests.
# Create test profile directories. mkdir -p coverage/fmt mkdir -p coverage/generate mkdir -p coverage/unit # Build the test binary. go build -cover -o ./coverage/templ-cover ./cmd/templ # Run the covered generate command. GOCOVERDIR=coverage/fmt ./coverage/templ-cover fmt . GOCOVERDIR=coverage/generate ./coverage/templ-cover generate -include-version=false # Run the unit tests. go test -cover ./... -args -test.gocoverdir="$PWD/coverage/unit" # Display the combined percentage. go tool covdata percent -i=./coverage/fmt,./coverage/generate,./coverage/unit # Generate a text coverage profile for tooling to use. go tool covdata textfmt -i=./coverage/fmt,./coverage/generate,./coverage/unit -o coverage.out # Print total go tool cover -func coverage.out | grep total
benchmark
Run benchmarks.
go run ./cmd/templ generate -include-version=false && go test ./... -bench=. -benchmem
fmt
Format all Go and templ code.
gofmt -s -w . go run ./cmd/templ fmt .
lint
golangci-lint run --verbose
release
Create production build with goreleaser.
if [ "${GITHUB_TOKEN}" == "" ]; then echo "No github token, run:"; echo "export GITHUB_TOKEN=`pass github.com/goreleaser_access_token`"; exit 1; fi ./push-tag.sh goreleaser --clean
docs-run
Run the development server.
Directory: docs
docs-build
Build production docs site.
Directory: docs
from Hacker News https://ift.tt/VHmkcv7
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.