waveterm/Taskfile.yml

226 lines
7.1 KiB
YAML
Raw Normal View History

# 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
RM: '{{if eq OS "windows"}}cmd --% /c del /S{{else}}rm {{end}}'
2024-08-13 08:37:08 +02:00
RMRF: '{{if eq OS "windows"}}powershell Remove-Item -Force -Recurse{{else}}rm -rf{{end}}'
DATE: '{{if eq OS "windows"}}powershell Get-Date -UFormat{{else}}date{{end}}'
2024-06-12 02:42:10 +02:00
tasks:
electron:dev:
desc: Run the Electron application via the Vite dev server (enables hot reloading).
cmds:
2024-07-19 00:16:49 +02:00
- yarn dev
deps:
- yarn
- build:backend
2024-08-09 03:24:54 +02:00
env:
WCLOUD_ENDPOINT: "https://ot2e112zx5.execute-api.us-west-2.amazonaws.com/dev"
WCLOUD_WS_ENDPOINT: "wss://5lfzlg5crl.execute-api.us-west-2.amazonaws.com/dev/"
electron:start:
desc: Run the Electron application directly.
cmds:
2024-07-19 00:16:49 +02:00
- yarn start
deps:
- yarn
- build:backend
package:
desc: Package the application for the current platform.
cmds:
2024-08-13 08:37:08 +02:00
- cmd: '{{.RMRF}} "make"'
2024-07-19 00:16:49 +02:00
ignore_error: true
- yarn build:prod && yarn electron-builder -c electron-builder.config.cjs -p never
deps:
- yarn
- build:backend
build:backend:
desc: Build the wavesrv and wsh components.
cmds:
- task: build:server
- task: build:wsh
2024-06-12 02:42:10 +02:00
build:server:
desc: Build the wavesrv component.
deps:
- generate
- build:server:linux
- build:server:macos
- build:server:windows
build:server:macos:
desc: Build the wavesrv component for macOS (Darwin) platforms (generates artifacts for both arm64 and amd64).
status:
2024-07-19 00:53:20 +02:00
- exit {{if eq OS "darwin"}}1{{else}}0{{end}}
cmds:
- cmd: "{{.RM}} dist/bin/wavesrv*"
2024-07-19 00:16:49 +02:00
ignore_error: true
- task: build:server:internal
vars:
ARCHS: arm64,amd64
build:server:windows:
desc: Build the wavesrv component for Windows platforms (only generates artifacts for the current architecture).
status:
- exit {{if eq OS "windows"}}1{{else}}0{{end}}
cmds:
- cmd: "{{.RM}} dist/bin/wavesrv*"
ignore_error: true
- task: build:server:internal
vars:
ARCHS:
sh: echo {{if eq "arm" ARCH}}arm64{{else}}{{ARCH}}{{end}}
build:server:linux:
desc: Build the wavesrv component for Linux platforms (only generates artifacts for the current architecture).
status:
- exit {{if eq OS "linux"}}1{{else}}0{{end}}
cmds:
- cmd: "{{.RM}} dist/bin/wavesrv*"
2024-07-19 00:16:49 +02:00
ignore_error: true
- task: build:server:internal
vars:
ARCHS:
2024-07-19 00:53:20 +02:00
sh: echo {{if eq "arm" ARCH}}arm64{{else}}{{ARCH}}{{end}}
GO_LDFLAGS: -linkmode 'external' -extldflags=-static
build:server:internal:
requires:
vars:
- ARCHS
cmds:
- cmd: 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.{{if eq .GOARCH "amd64"}}x64{{else}}{{.GOARCH}}{{end}}{{exeExt}} cmd/server/main-server.go
for:
var: ARCHS
split: ","
as: GOARCH
sources:
2024-06-12 02:42:10 +02:00
- "cmd/server/*.go"
- "pkg/**/*.go"
generates:
- dist/bin/wavesrv.*{{exeExt}}
deps:
2024-06-12 02:42:10 +02:00
- go:mod:tidy
internal: true
2024-06-21 23:44:11 +02:00
build:wsh:
desc: Build the wsh component for all possible targets.
2024-07-19 00:16:49 +02:00
cmds:
- cmd: "{{.RM}} dist/bin/wsh*"
2024-07-19 00:16:49 +02:00
ignore_error: true
- task: build:wsh:internal
vars:
2024-07-19 00:53:20 +02:00
GOOS: darwin
GOARCH: arm64
- task: build:wsh:internal
vars:
2024-07-19 00:53:20 +02:00
GOOS: darwin
GOARCH: amd64
- task: build:wsh:internal
vars:
2024-07-19 00:53:20 +02:00
GOOS: linux
GOARCH: arm64
- task: build:wsh:internal
vars:
2024-07-19 00:53:20 +02:00
GOOS: linux
GOARCH: amd64
- task: build:wsh:internal
vars:
2024-07-19 00:53:20 +02:00
GOOS: windows
GOARCH: amd64
- task: build:wsh:internal
vars:
2024-07-19 00:53:20 +02:00
GOOS: windows
GOARCH: arm64
deps:
- generate
dev:installwsh:
desc: quick shortcut to rebuild wsh and install for macos arm64
requires:
vars:
- VERSION
cmds:
- task: build:wsh:internal
vars:
GOOS: darwin
GOARCH: arm64
- cp dist/bin/wsh-{{.VERSION}}-darwin.arm64 ~/.w2-dev/bin/wsh
build:wsh:internal:
vars:
2024-07-19 00:53:20 +02:00
EXT:
sh: echo {{if eq .GOOS "windows"}}.exe{{end}}
NORMALIZEDARCH:
sh: echo {{if eq .GOARCH "amd64"}}x64{{else}}{{.GOARCH}}{{end}}
requires:
vars:
- GOOS
- GOARCH
- VERSION
2024-06-21 23:44:11 +02:00
sources:
- "cmd/wsh/**/*.go"
- "pkg/**/*.go"
generates:
- dist/bin/wsh-{{.VERSION}}-{{.GOOS}}.{{.NORMALIZEDARCH}}{{.EXT}}
cmds:
- (CGO_ENABLED=0 GOOS={{.GOOS}} GOARCH={{.GOARCH}} go build -ldflags="-s -w -X main.BuildTime=$({{.DATE}} +'%Y%m%d%H%M') -X main.WaveVersion={{.VERSION}}" -o dist/bin/wsh-{{.VERSION}}-{{.GOOS}}.{{.NORMALIZEDARCH}}{{.EXT}} cmd/wsh/main-wsh.go)
2024-06-21 23:44:11 +02:00
deps:
- go:mod:tidy
internal: true
2024-06-21 23:44:11 +02:00
generate:
desc: Generate Typescript bindings for the Go backend.
cmds:
2024-08-28 03:49:49 +02:00
- go run cmd/generatets/main-generatets.go
- go run cmd/generatego/main-generatego.go
sources:
2024-08-28 03:49:49 +02:00
- "cmd/generatego/*.go"
- "cmd/generatets/*.go"
- "pkg/service/**/*.go"
2024-08-30 20:33:04 +02:00
- "pkg/waveobj/*.go"
- "pkg/wconfig/**/*.go"
- "pkg/wstore/*.go"
- "pkg/wshrpc/**/*.go"
- "pkg/tsgen/**/*.go"
2024-08-28 03:49:49 +02:00
- "pkg/gogen/**/*.go"
- "pkg/wconfig/**/*.go"
- "pkg/eventbus/eventbus.go"
generates:
- frontend/types/gotypes.d.ts
- pkg/wshrpc/wshclient/wshclient.go
- frontend/app/store/services.ts
- frontend/app/store/wshserver.ts
yarn:
desc: Runs `yarn`
internal: true
generates:
- node_modules/**/*
- yarn.lock
- .yarn/*
sources:
- yarn.lock
- package.json
2024-08-26 22:35:10 +02:00
- .yarnrc.yml
cmds:
- yarn
go:mod:tidy:
desc: Runs `go mod tidy`
internal: true
generates:
- go.sum
sources:
- go.mod
cmds:
- go mod tidy