Add better logs to repo init script

This commit is contained in:
MareStare 2025-03-29 15:01:09 +00:00
parent d9d301f8c6
commit 66946c8db5
2 changed files with 9 additions and 5 deletions
.githooks
scripts

View file

@ -7,6 +7,8 @@
set -euo pipefail
# Using `readlink` because the pre-commit hook is installed via a symlink, so
# we need to resolve it before we can make path relative to this script's file.
. "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/../scripts/lib.sh"
function command_exists() {

View file

@ -1,11 +1,13 @@
#!/usr/bin/env bash
# Script to initialize the repo for development.
set -euxo pipefail
set -euo pipefail
. "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
function fetch {
local url="$1"
curl --fail --silent --show-error --location --retry 5 --retry-all-errors "$url"
step curl --fail --silent --show-error --location --retry 5 --retry-all-errors "$url"
}
function fetch_github_artifact_url {
@ -20,10 +22,10 @@ function fetch_github_artifact_url {
# Install `typos` CLI
typos_url=$(fetch_github_artifact_url crate-ci/typos x86_64-unknown-linux-musl)
fetch "$typos_url" | sudo tar -xzC /usr/local/bin ./typos
fetch "$typos_url" | step sudo tar -xzC /usr/local/bin ./typos
# Install prettier (see top-level package.json)
npm ci --ignore-scripts
step npm ci --ignore-scripts
# Install the pre-commit hook. It's a symlink, to make sure it stays always up-to-date.
ln -sf ../../.githooks/pre-commit .git/hooks/pre-commit
step ln -sf ../../.githooks/pre-commit .git/hooks/pre-commit