feat: sqlc, nix formatting

This commit is contained in:
2025-04-16 00:58:44 -04:00
parent 32f85fd0be
commit 967e2650ad
74 changed files with 1962 additions and 6811 deletions

24
.scripts/build.sh Executable file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env bash
git_root=$(git rev-parse --show-toplevel)
url=$(git config --get remote.origin.url)
name=$(basename -s .git "${url}")
git_version=$(git describe --tags --abbrev=0)
version=${git_version#v}
echo "building client"
cd "${git_root}"
nix build .#trevstack-client
cp -a result/. server/client
chmod -R u+w server/client
echo "building server"
cd "${git_root}/server"
echo "Building ${name}-windows-amd64-${version}.exe"
GOOS=windows GOARCH=amd64 go build -o "./build/${name}-windows-amd64-${version}.exe" .
echo "Building ${name}-linux-amd64-${version}"
GOOS=linux GOARCH=amd64 go build -o "./build/${name}-linux-amd64-${version}" .
echo "Building ${name}-linux-amd64-${version}"
GOOS=linux GOARCH=arm64 go build -o "./build/${name}-linux-arm64-${version}" .
echo "Building ${name}-linux-arm-${version}"
GOOS=linux GOARCH=arm go build -o "./build/${name}-linux-arm-${version}" .

22
.scripts/bump.sh Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env bash
git_root=$(git rev-parse --show-toplevel)
git_version=$(git describe --tags --abbrev=0)
version=${git_version#v}
next_version=$(echo "${version}" | awk -F. -v OFS=. '{$NF += 1 ; print}')
echo "bumping client"
cd "${git_root}/client"
npm version "${next_version}"
git add package-lock.json
git add package.json
echo "bumping nix"
cd "${git_root}"
nix-update --flake --version "${next_version}" default
git add flake.nix
git commit -m "bump: v${version} -> v${next_version}"
git push origin main
git tag -a "v${next_version}" -m "bump: v${version} -> v${next_version}"
git push origin "v${next_version}"

23
.scripts/lint.sh Executable file
View File

@ -0,0 +1,23 @@
#!/usr/bin/env bash
git_root=$(git rev-parse --show-toplevel)
echo "linting client"
cd "${git_root}/client"
npx prettier --check .
npx eslint .
npx svelte-check
echo "linting server"
cd "${git_root}/server"
revive -config revive.toml -set_exit_status ./...
sqlfluff lint
echo "linting protobuf"
cd "${git_root}"
buf lint
echo "linting nix"
cd "${git_root}"
nix fmt -- flake.nix --check
nix flake check --all-systems

30
.scripts/update.sh Executable file
View File

@ -0,0 +1,30 @@
#!/usr/bin/env bash
git_root=$(git rev-parse --show-toplevel)
echo "updating client"
cd "${git_root}/client"
npm update --save
if ! git diff --exit-code package.json package-lock.json; then
git add package-lock.json
git add package.json
git commit -m "build(client): updated npm dependencies"
fi
echo "updating server"
cd "${git_root}/server"
go get -u
go mod tidy
if ! git diff --exit-code go.mod go.sum; then
git add go.mod
git add go.sum
git commit -m "build(go): updated go dependencies"
fi
echo "updating nix"
cd "${git_root}"
nix-update --flake --version=skip default
if ! git diff --exit-code flake.nix; then
git add flake.nix
git commit -m "build(nix): updated nix hashes"
fi