From 95589f8b6c8adfc77af2a53028327af72ab7147c Mon Sep 17 00:00:00 2001
From: Gustav Westling
Date: Fri, 12 Jul 2024 12:10:45 +0200
Subject: [PATCH] WASM / Vercel docs
---
go.mod | 4 ++--
vercel.json | 4 ++++
web/.gitignore | 1 +
web/README.md | 22 ++++++++++++++++++++++
web/index.html | 4 ++++
5 files changed, 33 insertions(+), 2 deletions(-)
create mode 100644 vercel.json
create mode 100644 web/.gitignore
create mode 100644 web/README.md
diff --git a/go.mod b/go.mod
index 2755883..f0820f7 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,7 @@
module github.com/zegl/kube-score
require (
+ github.com/buildkite/terminal-to-html v3.2.0+incompatible
github.com/eidolon/wordwrap v0.0.0-20161011182207-e0f54129b8bb
github.com/fatih/color v1.17.0
github.com/google/go-cmp v0.6.0
@@ -16,7 +17,6 @@ require (
)
require (
- github.com/buildkite/terminal-to-html v3.2.0+incompatible // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
@@ -39,4 +39,4 @@ require (
go 1.22.0
-toolchain go1.22.2
+toolchain go1.22.4
diff --git a/vercel.json b/vercel.json
new file mode 100644
index 0000000..3f0084d
--- /dev/null
+++ b/vercel.json
@@ -0,0 +1,4 @@
+{
+ "buildCommand": "dnf install -y go && go env && go install golang.org/dl/go1.22.5@latest && /vercel/go/bin/go1.22.5 download && GOOS=js GOARCH=wasm /vercel/go/bin/go1.22.5 build -o ./web/main.wasm ./cmd/wasm/main.go",
+ "outputDirectory": "./web"
+}
\ No newline at end of file
diff --git a/web/.gitignore b/web/.gitignore
new file mode 100644
index 0000000..19e1bce
--- /dev/null
+++ b/web/.gitignore
@@ -0,0 +1 @@
+*.wasm
diff --git a/web/README.md b/web/README.md
new file mode 100644
index 0000000..57f6a30
--- /dev/null
+++ b/web/README.md
@@ -0,0 +1,22 @@
+# The kube-score website
+
+This directory contains the source for kube-score.com.
+
+kube-score is compiled to WASM (WebAssembly) for usage in browsers, and kube-score.com is running purely in the browser.
+
+## Building
+
+```bash
+# Compile the wasm module (run from repo root)
+GOOS=js GOARCH=wasm go build -o ./web/main.wasm ./cmd/wasm/main.go
+```
+
+```bash
+# Start a webserver serving files
+python3 -m http.server
+```
+
+## Hosting
+
+The site is built and hosted on Vercel. See vercel.json for build configuration.
+
diff --git a/web/index.html b/web/index.html
index 3b0ef93..2f1896c 100644
--- a/web/index.html
+++ b/web/index.html
@@ -91,6 +91,10 @@ kube-score
Use this website to easily test kube-score, just paste your object definition YAML or JSON in the box below.
+
+ This tool is running 100% in your browser, no data is sent to any server!
+
+