edge/Makefile

56 lines
1.1 KiB
Makefile
Raw Permalink Normal View History

2023-02-09 12:16:36 +01:00
LINT_ARGS ?= --timeout 5m
GITCHLOG_ARGS ?=
SHELL := /bin/bash
GOTEST_ARGS ?= -short
ESBUILD_VERSION ?= v0.17.5
build: build-edge-cli
watch:
go run -mod=readonly github.com/cortesi/modd/cmd/modd@latest
.PHONY: test
test: test-go
test-go:
go test -v -count=1 $(GOTEST_ARGS) ./...
lint:
golangci-lint run --enable-all $(LINT_ARGS)
build-edge-cli: build-sdk
CGO_ENABLED=0 go build \
-v \
-o ./bin/cli \
./cmd/cli
install-git-hooks:
git config core.hooksPath .githooks
tools/esbuild/bin/esbuild:
mkdir -p tools/esbuild/bin
curl -fsSL https://esbuild.github.io/dl/$(ESBUILD_VERSION) | sh
mv -f esbuild tools/esbuild/bin/esbuild
build-sdk: pkg/sdk/client/dist/client.js
.PHONY: pkg/sdk/client/dist/client.js
pkg/sdk/client/dist/client.js: tools/esbuild/bin/esbuild node_modules
mkdir -p pkg/sdk/client/dist
tools/esbuild/bin/esbuild \
pkg/sdk/client/src/index.ts \
--bundle \
--sourcemap \
--target=es2020 \
--format=iife \
--global-name=Arcad \
--define:global=window \
--platform=browser \
--footer:js="Arcad=Arcad.default;" \
--outfile=pkg/sdk/client/dist/client.js
node_modules:
npm ci