Template
35 lines
1.1 KiB
Bash
35 lines
1.1 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
project_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
cd "$project_dir"
|
|
|
|
stylua --check src tests tools
|
|
argon sourcemap default.project.json --output sourcemap.json
|
|
|
|
definitions="${ROBLOX_TYPES:-$project_dir/.cache/globalTypes.d.luau}"
|
|
|
|
if [[ -n "${ROBLOX_TYPES:-}" ]]; then
|
|
if [[ ! -s "$definitions" ]]; then
|
|
printf 'ROBLOX_TYPES must point to a nonempty Roblox definitions file: %s\n' "$definitions" >&2
|
|
exit 1
|
|
fi
|
|
elif [[ ! -s "$definitions" ]]; then
|
|
mkdir -p .cache
|
|
temporary_definitions="$(mktemp "$project_dir/.cache/globalTypes.XXXXXX")"
|
|
trap 'rm -f -- "$temporary_definitions"' EXIT
|
|
curl -fL --retry 2 --max-time 60 -sS \
|
|
https://raw.githubusercontent.com/JohnnyMorganz/luau-lsp/main/scripts/globalTypes.d.luau \
|
|
-o "$temporary_definitions"
|
|
mv -- "$temporary_definitions" "$definitions"
|
|
fi
|
|
|
|
luau-lsp analyze --platform=roblox --definitions="$definitions" --sourcemap=sourcemap.json src
|
|
|
|
for test_file in tests/*.luau; do
|
|
[[ -f "$test_file" ]] || continue
|
|
luau "$test_file"
|
|
done
|
|
|
|
printf 'Checks passed.\n'
|