# Copyright 2024, Command Line Inc. # SPDX-License-Identifier: Apache-2.0 version: "3" vars: APP_NAME: "TheNextWave" BIN_DIR: "bin" VERSION: sh: node version.cjs tasks: electron:dev: desc: Run the Electron application directly. cmds: - WAVETERM_DEV=1 yarn dev deps: - generate - build:server - build:wsh electron:start: desc: Run the Electron application via the Vite dev server (enables hot reloading). cmds: - WAVETERM_DEV=1 yarn start deps: - generate - build:server - build:wsh package: desc: Package the application for the current platform. cmds: - yarn build:prod && yarn electron-builder -c electron-builder.config.cjs -p never deps: - generate - build:server - build:wsh generate: desc: Generate Typescript bindings for the Go backend. cmds: - go run cmd/generate/main-generate.go - go run cmd/generatewshclient/main-generatewshclient.go sources: - "cmd/generate/*.go" - "pkg/service/**/*.go" - "pkg/wstore/*.go" - "pkg/wshrpc/**/*.go" generates: - frontend/types/gotypes.d.ts - pkg/wshrpc/wshclient/wshclient.go build:server: desc: Build the wavesrv component. deps: - build:server:darwin - build:server:other build:server:darwin: desc: Build the wavesrv component for Darwin platforms (generates artifacts for both arm64 and amd64). status: - exit {{if eq OS "darwin"}}1{{else}}0{{end}} cmds: - task: build:server:internal vars: GOARCH: arm64 - task: build:server:internal vars: GOARCH: amd64 build:server:other: desc: Build the wavesrv component for non-Darwin platforms (only generates artifacts for the current architecture). status: - exit {{if eq OS "darwin"}}0{{else}}1{{end}} cmds: - task: build:server:internal vars: GOARCH: sh: echo {{if eq "arm" ARCH}}arm64{{else}}{{ARCH}}{{end}} GO_LDFLAGS: -linkmode 'external' -extldflags=-static build:server:internal: requires: vars: - GOARCH cmds: - CGO_ENABLED=1 GOARCH={{.GOARCH}} go build -tags "osusergo,netgo,sqlite_omit_load_extension" -ldflags "{{.GO_LDFLAGS}} -X main.BuildTime=$(date +'%Y%m%d%H%M') -X main.WaveVersion={{.VERSION}}" -o dist/bin/wavesrv.{{.GOARCH}}{{exeExt}} cmd/server/main-server.go sources: - "cmd/server/*.go" - "pkg/**/*.go" generates: - dist/bin/wavesrv.{{.GOARCH}}{{exeExt}} deps: - go:mod:tidy internal: true build:wsh: desc: Build the wsh component for all possible targets. deps: - task: build:wsh:internal vars: GOOS: darwin GOARCH: arm64 - task: build:wsh:internal vars: GOOS: darwin GOARCH: amd64 - task: build:wsh:internal vars: GOOS: linux GOARCH: arm64 - task: build:wsh:internal vars: GOOS: linux GOARCH: amd64 - task: build:wsh:internal vars: GOOS: windows GOARCH: amd64 - task: build:wsh:internal vars: GOOS: windows GOARCH: arm64 build:wsh:internal: vars: EXT: sh: echo {{if eq .GOOS "windows"}}.exe{{end}} requires: vars: - GOOS - GOARCH - VERSION sources: - "cmd/wsh/**/*.go" - "pkg/**/*.go" generates: - dist/bin/wsh-{{.VERSION}}-{{.GOOS}}.{{.GOARCH}}{{.EXT}} cmds: - (CGO_ENABLED=0 GOOS={{.GOOS}} GOARCH={{.GOARCH}} go build -ldflags="-s -w -X main.BuildTime=$(date +'%Y%m%d%H%M')" -o dist/bin/wsh-{{.VERSION}}-{{.GOOS}}.{{.GOARCH}}{{.EXT}} cmd/wsh/main-wsh.go) deps: - go:mod:tidy internal: true go:mod:tidy: desc: Runs `go mod tidy` internal: true generates: - go.sum sources: - go.mod cmds: - go mod tidy