Compare commits
2 commits
8e55df37ae
...
043803e041
Author | SHA1 | Date | |
---|---|---|---|
043803e041 | |||
842711825b |
7 changed files with 229 additions and 114 deletions
46
.air.toml
46
.air.toml
|
@ -1,46 +0,0 @@
|
||||||
root = "."
|
|
||||||
testdata_dir = "testdata"
|
|
||||||
tmp_dir = "tmp"
|
|
||||||
|
|
||||||
[build]
|
|
||||||
args_bin = ["-ip", "127.0.0.1", "-port", "3000"]
|
|
||||||
bin = "./tmp/main"
|
|
||||||
pre_cmd = []
|
|
||||||
cmd = "cd lib/stylegen && ./gen.sh -e html -d ../../pages/templates -o ../../public/css && cd ../.. && go build -o ./tmp/main ."
|
|
||||||
delay = 1000
|
|
||||||
exclude_dir = ["assets", "tmp", "vendor", "testdata", "lib/stylegen"]
|
|
||||||
exclude_file = []
|
|
||||||
exclude_regex = ["_test.go"]
|
|
||||||
exclude_unchanged = false
|
|
||||||
follow_symlink = false
|
|
||||||
full_bin = ""
|
|
||||||
include_dir = []
|
|
||||||
include_ext = ["go", "tpl", "tmpl", "html"]
|
|
||||||
include_file = []
|
|
||||||
kill_delay = "0s"
|
|
||||||
log = "build-errors.log"
|
|
||||||
poll = false
|
|
||||||
poll_interval = 0
|
|
||||||
post_cmd = []
|
|
||||||
rerun = false
|
|
||||||
rerun_delay = 500
|
|
||||||
send_interrupt = false
|
|
||||||
stop_on_error = false
|
|
||||||
|
|
||||||
[color]
|
|
||||||
app = ""
|
|
||||||
build = "yellow"
|
|
||||||
main = "magenta"
|
|
||||||
runner = "green"
|
|
||||||
watcher = "cyan"
|
|
||||||
|
|
||||||
[log]
|
|
||||||
main_only = false
|
|
||||||
time = false
|
|
||||||
|
|
||||||
[misc]
|
|
||||||
clean_on_exit = false
|
|
||||||
|
|
||||||
[screen]
|
|
||||||
clear_on_rebuild = false
|
|
||||||
keep_scroll = true
|
|
25
Dockerfile
25
Dockerfile
|
@ -2,18 +2,26 @@ FROM golang:1.23.2-alpine AS builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Download dependencies
|
# Download dependencies and install required tools
|
||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
RUN go mod download
|
RUN go mod download && \
|
||||||
|
go install github.com/swaggo/swag/cmd/swag@latest
|
||||||
|
|
||||||
# Copy source code
|
# Copy source code and Makefile
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Install UPX
|
# Install required tools and make scripts executable
|
||||||
RUN apk add --no-cache upx
|
RUN apk add --no-cache upx make bash && \
|
||||||
|
chmod +x /app/lib/stylegen/gen.sh && \
|
||||||
|
chmod +x /app/lib/stylegen/tw/*
|
||||||
|
|
||||||
# Build with optimizations
|
# Create necessary directories
|
||||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
|
RUN mkdir -p /app/public/css
|
||||||
|
|
||||||
|
# Generate assets and build with optimizations
|
||||||
|
SHELL ["/bin/bash", "-c"]
|
||||||
|
RUN cd /app && make generate && \
|
||||||
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
|
||||||
-ldflags='-s -w -extldflags "-static"' \
|
-ldflags='-s -w -extldflags "-static"' \
|
||||||
-tags netgo,osusergo \
|
-tags netgo,osusergo \
|
||||||
-o /go/bin/app
|
-o /go/bin/app
|
||||||
|
@ -21,6 +29,9 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
|
||||||
# Final stage
|
# Final stage
|
||||||
FROM scratch
|
FROM scratch
|
||||||
|
|
||||||
|
# Copy static files and assets
|
||||||
|
COPY --from=builder /app/public/css/styles.css /public/css/styles.css
|
||||||
|
COPY --from=builder /app/docs /docs
|
||||||
COPY --from=builder /go/bin/app /app
|
COPY --from=builder /go/bin/app /app
|
||||||
|
|
||||||
ENTRYPOINT ["/app"]
|
ENTRYPOINT ["/app"]
|
||||||
|
|
142
Makefile
Normal file
142
Makefile
Normal file
|
@ -0,0 +1,142 @@
|
||||||
|
# Colors
|
||||||
|
CYAN := \033[36m
|
||||||
|
YELLOW := \033[33m
|
||||||
|
GREEN := \033[32m
|
||||||
|
RED := \033[31m
|
||||||
|
RESET := \033[0m
|
||||||
|
|
||||||
|
# Emoji
|
||||||
|
CHECK := ✅
|
||||||
|
BUILD := 🔨
|
||||||
|
CLEAN := 🧹
|
||||||
|
RUN := 🚀
|
||||||
|
CSS := 🎨
|
||||||
|
TEST := 🧪
|
||||||
|
DOCKER := 🐳
|
||||||
|
WARN := ⚠️
|
||||||
|
DOCS := 📚
|
||||||
|
|
||||||
|
# Variables
|
||||||
|
BINARY_NAME := goth.stack
|
||||||
|
DOCKER_IMAGE := goth-stack
|
||||||
|
GO_FILES := $(wildcard *.go)
|
||||||
|
CSS_INPUT := lib/stylegen/base.css
|
||||||
|
CSS_OUTPUT := public/css/styles.css
|
||||||
|
|
||||||
|
# Docker detection
|
||||||
|
DOCKER_ENV := $(shell if [ -f /.dockerenv ]; then echo true; else echo false; fi)
|
||||||
|
ifeq ($(DOCKER_ENV),true)
|
||||||
|
BASE_PATH := /app
|
||||||
|
else
|
||||||
|
BASE_PATH := $(CURDIR)
|
||||||
|
endif
|
||||||
|
|
||||||
|
.PHONY: all build clean run dev stylegen docker-dev docker-build docker-run test help reset ensure-swag
|
||||||
|
|
||||||
|
help:
|
||||||
|
@echo "$(CYAN)Available commands:$(RESET)"
|
||||||
|
@echo "$(YELLOW)make clean$(RESET) - Remove build artifacts"
|
||||||
|
@echo "$(YELLOW)make reset$(RESET) - Clean and reset the project to initial state"
|
||||||
|
@echo "$(YELLOW)make build$(RESET) - Generate CSS, docs, and build Go binary"
|
||||||
|
@echo "$(YELLOW)make run$(RESET) - Build and run the binary"
|
||||||
|
@echo "$(YELLOW)make dev$(RESET) - Run in development mode"
|
||||||
|
@echo "$(YELLOW)make docker-dev$(RESET)- Run development environment in Docker"
|
||||||
|
@echo "$(YELLOW)make docker-run$(RESET)- Run production container"
|
||||||
|
@echo "$(YELLOW)make test$(RESET) - Run tests"
|
||||||
|
@echo "$(YELLOW)make prod$(RESET) - Full production build"
|
||||||
|
|
||||||
|
# Check if swag is installed
|
||||||
|
ensure-swag:
|
||||||
|
@command -v swag >/dev/null 2>&1 || { \
|
||||||
|
echo "$(WARN) $(RED)Swagger CLI (swag) is not installed. Installing...$(RESET)"; \
|
||||||
|
go install github.com/swaggo/swag/cmd/swag@latest; \
|
||||||
|
}
|
||||||
|
|
||||||
|
reset:
|
||||||
|
@echo "$(CLEAN) $(CYAN)Performing complete project reset...$(RESET)"
|
||||||
|
@rm -f $(BINARY_NAME)
|
||||||
|
@rm -f $(CSS_OUTPUT)
|
||||||
|
@rm -rf public/css/*
|
||||||
|
@rm -f tailwind.config.js
|
||||||
|
@rm -rf docs/docs.go docs/swagger.json docs/swagger.yaml
|
||||||
|
@go clean -cache -testcache -modcache
|
||||||
|
@echo "$(CHECK) $(GREEN)Project reset complete$(RESET)"
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@echo "$(CLEAN) $(CYAN)Cleaning build artifacts...$(RESET)"
|
||||||
|
@rm -f $(BINARY_NAME)
|
||||||
|
@rm -f $(CSS_OUTPUT)
|
||||||
|
@echo "$(CHECK) $(GREEN)Cleanup complete$(RESET)"
|
||||||
|
|
||||||
|
stylegen:
|
||||||
|
@echo "$(CSS) $(CYAN)Generating CSS styles...$(RESET)"
|
||||||
|
@echo "Current working directory: $$(pwd)"
|
||||||
|
@echo "Contents of current directory:"
|
||||||
|
@ls -la
|
||||||
|
@echo "\nContents of lib/stylegen:"
|
||||||
|
@ls -la lib/stylegen
|
||||||
|
@echo "\nContents of lib/stylegen/tw:"
|
||||||
|
@ls -la lib/stylegen/tw
|
||||||
|
@chmod +x $(BASE_PATH)/lib/stylegen/gen.sh
|
||||||
|
@chmod +x $(BASE_PATH)/lib/stylegen/tw/*
|
||||||
|
@$(BASE_PATH)/lib/stylegen/gen.sh \
|
||||||
|
-e "html" \
|
||||||
|
-d "$(BASE_PATH)/pages/templates" \
|
||||||
|
-o "$(BASE_PATH)/public/css"
|
||||||
|
@echo "$(CHECK) $(GREEN)CSS generation complete$(RESET)"
|
||||||
|
|
||||||
|
swaggergen: ensure-swag
|
||||||
|
@echo "$(DOCS) $(CYAN)Generating Swagger documentation...$(RESET)"
|
||||||
|
@swag init
|
||||||
|
@echo "$(CHECK) $(GREEN)Swagger docs generated$(RESET)"
|
||||||
|
|
||||||
|
# Combined generation target
|
||||||
|
generate: stylegen swaggergen
|
||||||
|
|
||||||
|
build: generate
|
||||||
|
@echo "$(BUILD) $(CYAN)Building binary...$(RESET)"
|
||||||
|
@go build -o $(BINARY_NAME)
|
||||||
|
@echo "$(CHECK) $(GREEN)Build complete: $(BINARY_NAME)$(RESET)"
|
||||||
|
|
||||||
|
test:
|
||||||
|
@echo "$(TEST) $(CYAN)Running tests...$(RESET)"
|
||||||
|
@go test ./...
|
||||||
|
@echo "$(CHECK) $(GREEN)Tests complete$(RESET)"
|
||||||
|
|
||||||
|
dev: generate
|
||||||
|
@echo "$(RUN) $(CYAN)Starting development server...$(RESET)"
|
||||||
|
@go run main.go
|
||||||
|
|
||||||
|
run: build
|
||||||
|
@echo "$(RUN) $(CYAN)Running server...$(RESET)"
|
||||||
|
@./$(BINARY_NAME)
|
||||||
|
|
||||||
|
docker-dev:
|
||||||
|
@echo "$(DOCKER) $(CYAN)Starting development container...$(RESET)"
|
||||||
|
@docker-compose -f docker-compose.dev.yml up --build
|
||||||
|
|
||||||
|
docker-build: generate
|
||||||
|
@echo "$(DOCKER) $(CYAN)Building production Docker image...$(RESET)"
|
||||||
|
@docker build -t $(DOCKER_IMAGE) .
|
||||||
|
@echo "$(CHECK) $(GREEN)Docker image build complete$(RESET)"
|
||||||
|
|
||||||
|
docker-run: docker-build
|
||||||
|
@echo "$(DOCKER) $(CYAN)Running production container...$(RESET)"
|
||||||
|
@docker-compose up
|
||||||
|
|
||||||
|
deps:
|
||||||
|
@echo "$(BUILD) $(CYAN)Installing dependencies...$(RESET)"
|
||||||
|
@go mod download
|
||||||
|
@go install github.com/swaggo/swag/cmd/swag@latest
|
||||||
|
@echo "$(CHECK) $(GREEN)Dependencies installed$(RESET)"
|
||||||
|
|
||||||
|
fmt:
|
||||||
|
@echo "$(BUILD) $(CYAN)Formatting code...$(RESET)"
|
||||||
|
@go fmt ./...
|
||||||
|
@echo "$(CHECK) $(GREEN)Code formatting complete$(RESET)"
|
||||||
|
|
||||||
|
# Full production build
|
||||||
|
prod: clean generate build
|
||||||
|
@echo "$(CHECK) $(GREEN)Production build complete$(RESET)"
|
||||||
|
|
||||||
|
.DEFAULT_GOAL := help
|
6
docker-compose.yml
Normal file
6
docker-compose.yml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
image: ${IMAGE}
|
||||||
|
command: ["/app"]
|
||||||
|
ports:
|
||||||
|
- "${APP_PORT}:3000"
|
19
go.mod
19
go.mod
|
@ -6,7 +6,7 @@ require (
|
||||||
github.com/alecthomas/chroma/v2 v2.14.0
|
github.com/alecthomas/chroma/v2 v2.14.0
|
||||||
github.com/swaggo/echo-swagger v1.4.1
|
github.com/swaggo/echo-swagger v1.4.1
|
||||||
github.com/swaggo/swag v1.16.4
|
github.com/swaggo/swag v1.16.4
|
||||||
golang.org/x/image v0.21.0
|
golang.org/x/image v0.23.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
@ -17,19 +17,18 @@ require (
|
||||||
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
||||||
github.com/go-openapi/spec v0.21.0 // indirect
|
github.com/go-openapi/spec v0.21.0 // indirect
|
||||||
github.com/go-openapi/swag v0.23.0 // indirect
|
github.com/go-openapi/swag v0.23.0 // indirect
|
||||||
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
|
|
||||||
github.com/josharian/intern v1.0.0 // indirect
|
github.com/josharian/intern v1.0.0 // indirect
|
||||||
github.com/labstack/gommon v0.4.2 // indirect
|
github.com/labstack/gommon v0.4.2 // indirect
|
||||||
github.com/mailru/easyjson v0.7.7 // indirect
|
github.com/mailru/easyjson v0.9.0 // indirect
|
||||||
github.com/rogpeppe/go-internal v1.12.0 // indirect
|
github.com/rogpeppe/go-internal v1.12.0 // indirect
|
||||||
github.com/swaggo/files/v2 v2.0.1 // indirect
|
github.com/swaggo/files/v2 v2.0.1 // indirect
|
||||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||||
github.com/valyala/fasttemplate v1.2.2 // indirect
|
github.com/valyala/fasttemplate v1.2.2 // indirect
|
||||||
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
|
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
|
||||||
golang.org/x/net v0.30.0 // indirect
|
golang.org/x/net v0.33.0 // indirect
|
||||||
golang.org/x/text v0.19.0 // indirect
|
golang.org/x/text v0.21.0 // indirect
|
||||||
golang.org/x/time v0.7.0 // indirect
|
golang.org/x/time v0.8.0 // indirect
|
||||||
golang.org/x/tools v0.26.0 // indirect
|
golang.org/x/tools v0.28.0 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -37,12 +36,12 @@ require (
|
||||||
github.com/gookit/color v1.5.4
|
github.com/gookit/color v1.5.4
|
||||||
github.com/gorilla/feeds v1.2.0
|
github.com/gorilla/feeds v1.2.0
|
||||||
github.com/joho/godotenv v1.5.1
|
github.com/joho/godotenv v1.5.1
|
||||||
github.com/labstack/echo/v4 v4.12.0
|
github.com/labstack/echo/v4 v4.13.2
|
||||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
github.com/yuin/goldmark v1.7.8
|
github.com/yuin/goldmark v1.7.8
|
||||||
github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc
|
github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc
|
||||||
golang.org/x/crypto v0.28.0 // indirect
|
golang.org/x/crypto v0.31.0 // indirect
|
||||||
golang.org/x/sys v0.26.0 // indirect
|
golang.org/x/sys v0.28.0 // indirect
|
||||||
gopkg.in/yaml.v2 v2.4.0
|
gopkg.in/yaml.v2 v2.4.0
|
||||||
)
|
)
|
||||||
|
|
50
go.sum
50
go.sum
|
@ -25,8 +25,6 @@ github.com/go-openapi/spec v0.21.0 h1:LTVzPc3p/RzRnkQqLRndbAzjY0d0BCL72A6j3CdL9Z
|
||||||
github.com/go-openapi/spec v0.21.0/go.mod h1:78u6VdPw81XU44qEWGhtr982gJ5BWg2c0I5XwVMotYk=
|
github.com/go-openapi/spec v0.21.0/go.mod h1:78u6VdPw81XU44qEWGhtr982gJ5BWg2c0I5XwVMotYk=
|
||||||
github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE=
|
github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE=
|
||||||
github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ=
|
github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ=
|
||||||
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
|
|
||||||
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
|
|
||||||
github.com/gookit/color v1.5.4 h1:FZmqs7XOyGgCAxmWyPslpiok1k05wmY3SJTytgvYFs0=
|
github.com/gookit/color v1.5.4 h1:FZmqs7XOyGgCAxmWyPslpiok1k05wmY3SJTytgvYFs0=
|
||||||
github.com/gookit/color v1.5.4/go.mod h1:pZJOeOS8DM43rXbp4AZo1n9zCU2qjpcRko0b6/QJi9w=
|
github.com/gookit/color v1.5.4/go.mod h1:pZJOeOS8DM43rXbp4AZo1n9zCU2qjpcRko0b6/QJi9w=
|
||||||
github.com/gorilla/feeds v1.2.0 h1:O6pBiXJ5JHhPvqy53NsjKOThq+dNFm8+DFrxBEdzSCc=
|
github.com/gorilla/feeds v1.2.0 h1:O6pBiXJ5JHhPvqy53NsjKOThq+dNFm8+DFrxBEdzSCc=
|
||||||
|
@ -41,12 +39,12 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
github.com/labstack/echo/v4 v4.12.0 h1:IKpw49IMryVB2p1a4dzwlhP1O2Tf2E0Ir/450lH+kI0=
|
github.com/labstack/echo/v4 v4.13.2 h1:9aAt4hstpH54qIcqkuUXRLTf+v7yOTfMPWzDtuqLmtA=
|
||||||
github.com/labstack/echo/v4 v4.12.0/go.mod h1:UP9Cr2DJXbOK3Kr9ONYzNowSh7HP0aG0ShAyycHSJvM=
|
github.com/labstack/echo/v4 v4.13.2/go.mod h1:uc9gDtHB8UWt3FfbYx0HyxcCuvR4YuPYOxF/1QjoV/c=
|
||||||
github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0=
|
github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0=
|
||||||
github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU=
|
github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU=
|
||||||
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
|
github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4=
|
||||||
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
|
github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
|
||||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||||
|
@ -58,8 +56,8 @@ github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU
|
||||||
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
|
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
github.com/swaggo/echo-swagger v1.4.1 h1:Yf0uPaJWp1uRtDloZALyLnvdBeoEL5Kc7DtnjzO/TUk=
|
github.com/swaggo/echo-swagger v1.4.1 h1:Yf0uPaJWp1uRtDloZALyLnvdBeoEL5Kc7DtnjzO/TUk=
|
||||||
github.com/swaggo/echo-swagger v1.4.1/go.mod h1:C8bSi+9yH2FLZsnhqMZLIZddpUxZdBYuNHbtaS1Hljc=
|
github.com/swaggo/echo-swagger v1.4.1/go.mod h1:C8bSi+9yH2FLZsnhqMZLIZddpUxZdBYuNHbtaS1Hljc=
|
||||||
github.com/swaggo/files/v2 v2.0.1 h1:XCVJO/i/VosCDsJu1YLpdejGsGnBE9deRMpjN4pJLHk=
|
github.com/swaggo/files/v2 v2.0.1 h1:XCVJO/i/VosCDsJu1YLpdejGsGnBE9deRMpjN4pJLHk=
|
||||||
|
@ -77,28 +75,28 @@ github.com/yuin/goldmark v1.7.8 h1:iERMLn0/QJeHFhxSt3p6PeN9mGnvIKSpG9YYorDMnic=
|
||||||
github.com/yuin/goldmark v1.7.8/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
|
github.com/yuin/goldmark v1.7.8/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
|
||||||
github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc h1:+IAOyRda+RLrxa1WC7umKOZRsGq4QrFFMYApOeHzQwQ=
|
github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc h1:+IAOyRda+RLrxa1WC7umKOZRsGq4QrFFMYApOeHzQwQ=
|
||||||
github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc/go.mod h1:ovIvrum6DQJA4QsJSovrkC4saKHQVs7TvcaeO8AIl5I=
|
github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc/go.mod h1:ovIvrum6DQJA4QsJSovrkC4saKHQVs7TvcaeO8AIl5I=
|
||||||
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw=
|
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
|
||||||
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
|
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
|
||||||
golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561 h1:MDc5xs78ZrZr3HMQugiXOAkSZtfTpbJLDr/lwfgO53E=
|
golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561 h1:MDc5xs78ZrZr3HMQugiXOAkSZtfTpbJLDr/lwfgO53E=
|
||||||
golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE=
|
golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE=
|
||||||
golang.org/x/image v0.21.0 h1:c5qV36ajHpdj4Qi0GnE0jUc/yuo33OLFaa0d+crTD5s=
|
golang.org/x/image v0.23.0 h1:HseQ7c2OpPKTPVzNjG5fwJsOTCiiwS4QdsYi5XU6H68=
|
||||||
golang.org/x/image v0.21.0/go.mod h1:vUbsLavqK/W303ZroQQVKQ+Af3Yl6Uz1Ppu5J/cLz78=
|
golang.org/x/image v0.23.0/go.mod h1:wJJBTdLfCCf3tiHa1fNxpZmUI4mmoZvwMCPP0ddoNKY=
|
||||||
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
|
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
|
||||||
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
|
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
|
||||||
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
|
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
|
||||||
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
|
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
|
||||||
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
|
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
|
||||||
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
|
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
|
||||||
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
|
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
|
||||||
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
|
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
|
||||||
golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ=
|
golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg=
|
||||||
golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
||||||
golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ=
|
golang.org/x/tools v0.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8=
|
||||||
golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0=
|
golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||||
|
|
|
@ -22,6 +22,10 @@ while [[ $# -gt 0 ]]; do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Get the directory where this script is located
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
echo "Script directory: $SCRIPT_DIR"
|
||||||
|
|
||||||
OS=$(uname -s)
|
OS=$(uname -s)
|
||||||
ARCH=$(uname -m)
|
ARCH=$(uname -m)
|
||||||
|
|
||||||
|
@ -46,7 +50,7 @@ case $ARCH in
|
||||||
"x86_64")
|
"x86_64")
|
||||||
ARCH="x64"
|
ARCH="x64"
|
||||||
;;
|
;;
|
||||||
"arm64")
|
"arm64"|"aarch64")
|
||||||
ARCH="arm64"
|
ARCH="arm64"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -54,28 +58,34 @@ case $ARCH in
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
# Construct the binary file name
|
|
||||||
BINARY="./tw/${OS}-${ARCH}"
|
echo "Detected OS: $OS"
|
||||||
|
echo "Detected Architecture: $ARCH"
|
||||||
|
|
||||||
|
# Use tw directory in script location
|
||||||
|
BINARY="${SCRIPT_DIR}/tw/${OS}-${ARCH}"
|
||||||
if [ "$OS" = "windows" ]; then
|
if [ "$OS" = "windows" ]; then
|
||||||
BINARY="${BINARY}.exe"
|
BINARY="${BINARY}.exe"
|
||||||
else
|
|
||||||
# Set execute permissions on the binary
|
|
||||||
chmod +x $BINARY
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Looking for binary at: $BINARY"
|
||||||
|
|
||||||
|
# Check if binary exists
|
||||||
|
if [ ! -f "$BINARY" ]; then
|
||||||
|
echo "Binary not found: $BINARY"
|
||||||
|
echo "Contents of ${SCRIPT_DIR}/tw/:"
|
||||||
|
ls -la "${SCRIPT_DIR}/tw/"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make binary executable
|
||||||
|
chmod +x "$BINARY"
|
||||||
|
|
||||||
|
echo "Using binary: $BINARY"
|
||||||
echo "Extensions: $EXTENSIONS"
|
echo "Extensions: $EXTENSIONS"
|
||||||
echo "Directory: $DIRECTORY"
|
echo "Directory: $DIRECTORY"
|
||||||
echo "Output Directory: $OUTPUT_DIR"
|
echo "Output Directory: $OUTPUT_DIR"
|
||||||
|
|
||||||
# Set default values if not provided
|
|
||||||
OUTPUT_DIR="${OUTPUT_DIR:-../../public/css}"
|
|
||||||
DIRECTORY="${DIRECTORY:-.}"
|
|
||||||
|
|
||||||
if [[ -z "$EXTENSIONS" ]]; then
|
|
||||||
echo "No extensions provided."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Initialize an array for name conditions
|
# Initialize an array for name conditions
|
||||||
name_conditions=()
|
name_conditions=()
|
||||||
|
|
||||||
|
@ -90,12 +100,10 @@ INCLUDE_FILES=$(find "$DIRECTORY" -type f \( "${name_conditions[@]}" \))
|
||||||
|
|
||||||
echo "Files found: $INCLUDE_FILES"
|
echo "Files found: $INCLUDE_FILES"
|
||||||
|
|
||||||
# Optionally, remove leading './' if necessary
|
|
||||||
INCLUDE_FILES=$(echo "$INCLUDE_FILES" | sed 's|^\./||')
|
|
||||||
|
|
||||||
INCLUDE_FILES_ARRAY=$(echo "$INCLUDE_FILES" | awk '{printf "\"%s\",", $0}' | sed 's/,$//')
|
INCLUDE_FILES_ARRAY=$(echo "$INCLUDE_FILES" | awk '{printf "\"%s\",", $0}' | sed 's/,$//')
|
||||||
|
|
||||||
# Generate Tailwind config
|
# Generate Tailwind config in script directory
|
||||||
|
CONFIG_FILE="${SCRIPT_DIR}/tailwind.config.js"
|
||||||
echo "module.exports = {
|
echo "module.exports = {
|
||||||
content: [$INCLUDE_FILES_ARRAY],
|
content: [$INCLUDE_FILES_ARRAY],
|
||||||
theme: {
|
theme: {
|
||||||
|
@ -105,13 +113,10 @@ echo "module.exports = {
|
||||||
themes: [\"night\"],
|
themes: [\"night\"],
|
||||||
},
|
},
|
||||||
plugins: [require('daisyui'), require('@tailwindcss/typography')],
|
plugins: [require('daisyui'), require('@tailwindcss/typography')],
|
||||||
}" > tailwind.config.js
|
}" > "$CONFIG_FILE"
|
||||||
|
|
||||||
# Delete original CSS file if it exists
|
|
||||||
rm -f "${OUTPUT_DIR}/styles.css"
|
|
||||||
|
|
||||||
# Run the binary with the generated config
|
# Run the binary with the generated config
|
||||||
$BINARY build -i ./base.css -c tailwind.config.js -o "${OUTPUT_DIR}/styles.css" --minify
|
"$BINARY" build -i "${SCRIPT_DIR}/base.css" -c "$CONFIG_FILE" -o "${OUTPUT_DIR}/styles.css" --minify
|
||||||
|
|
||||||
# Wait for all background processes to finish
|
# Wait for all background processes to finish
|
||||||
wait
|
wait
|
Loading…
Add table
Reference in a new issue