Files
skillshare/mise.toml
T
Willie 86b5650fe5 fix: correct ui:build path in mise.toml
The multi-line run block is a single shell script, so `cd ui` persisted
into subsequent lines, making rm and cp target wrong paths. Wrap in a
subshell so the directory change does not leak.
2026-02-08 17:36:51 +08:00

142 lines
4.2 KiB
TOML

[tools]
go = "1.25.5"
[tasks.help]
description = "Show common development tasks"
run = """
echo "Common tasks:"
echo " mise run build # build binary"
echo " mise run run # run local binary help"
echo " mise run test # unit + integration tests"
echo " mise run test:unit # unit tests only"
echo " mise run test:int # integration tests only"
echo " mise run test:cover # tests with coverage"
echo " mise run test:install # install.sh sandbox tests"
echo " mise run test:docker # docker offline sandbox (build + unit + integration)"
echo " mise run test:docker:online # optional docker online install/update tests"
echo " mise run sandbox:up # start persistent docker playground"
echo " mise run sandbox:shell # enter docker playground shell"
echo " mise run sandbox:down # stop and remove docker playground"
echo " mise run lint # go vet"
echo " mise run fmt # format Go files"
echo " mise run fmt:check # verify formatting only"
echo " mise run check # fmt:check + lint + test"
echo " mise run ui:install # install frontend dependencies"
echo " mise run ui:build # build frontend + copy to embed"
echo " mise run ui:dev # Go API server + Vite dev server"
echo " mise run build:ui # ui:build + build (full binary)"
echo " mise run clean # remove build artifacts"
"""
[tasks.build]
description = "Build the skillshare binary"
run = """
if [ ! -f internal/server/dist/index.html ]; then
mkdir -p internal/server/dist
printf '<!DOCTYPE html><html><body><h1>UI not built</h1><p>Run: mise run build:ui</p></body></html>' > internal/server/dist/index.html
fi
mkdir -p bin && go build -o bin/skillshare ./cmd/skillshare
"""
[tasks."build:meta"]
description = "Build with version metadata"
run = "./scripts/build.sh"
[tasks.run]
description = "Run skillshare help using the local binary"
depends = ["build"]
run = "./bin/skillshare --help"
[tasks.test]
description = "Run unit and integration tests"
run = "./scripts/test.sh"
[tasks."test:unit"]
description = "Run unit tests only"
run = "./scripts/test.sh --unit"
[tasks."test:int"]
description = "Run integration tests only"
run = "./scripts/test.sh --int"
[tasks."test:cover"]
description = "Run tests with coverage"
run = "./scripts/test.sh --cover"
[tasks."test:install"]
description = "Run install.sh sandbox tests"
run = "./scripts/test_install.sh"
[tasks."test:docker"]
description = "Run tests in offline docker sandbox"
run = "./scripts/test_docker.sh"
[tasks."test:docker:online"]
description = "Run optional network-dependent tests in docker sandbox"
run = "./scripts/test_docker_online.sh"
[tasks."sandbox:up"]
description = "Start persistent docker playground container"
run = "./scripts/sandbox_playground_up.sh"
[tasks."sandbox:shell"]
description = "Enter persistent docker playground shell"
run = "./scripts/sandbox_playground_shell.sh"
[tasks."sandbox:down"]
description = "Stop and remove persistent docker playground container"
run = "./scripts/sandbox_playground_down.sh"
[tasks.lint]
description = "Run go vet"
run = "go vet ./..."
[tasks.fmt]
description = "Format Go files"
run = "gofmt -w ./cmd ./internal ./tests"
[tasks."fmt:check"]
description = "Check Go formatting (no changes)"
run = "test -z \"$(gofmt -l ./cmd ./internal ./tests)\""
[tasks.check]
description = "Run formatting check, lint, and tests"
depends = ["fmt:check", "lint", "test"]
[tasks.install]
description = "Install skillshare to GOPATH/bin"
run = "go install ./cmd/skillshare"
[tasks."ui:install"]
description = "Install frontend dependencies"
run = "cd ui && pnpm install"
[tasks."ui:build"]
description = "Build frontend and copy to embed directory"
depends = ["ui:install"]
run = """
(cd ui && pnpm run build)
rm -rf internal/server/dist
cp -r ui/dist internal/server/dist
"""
[tasks."ui:dev"]
description = "Go API server + Vite dev server"
run = """
trap 'kill 0' EXIT
go run -tags dev ./cmd/skillshare ui --no-open &
cd ui && pnpm run dev
"""
[tasks."build:ui"]
description = "Build frontend + Go binary (full build)"
depends = ["ui:build", "build"]
[tasks.clean]
description = "Clean build artifacts"
run = "rm -rf bin coverage.out"
[tasks.default]
description = "Show task help"
depends = ["help"]