From 66946c8db5352ebcdde6d4c844999b26a003a54f Mon Sep 17 00:00:00 2001 From: MareStare <mare.stare.official@gmail.com> Date: Sat, 29 Mar 2025 15:01:09 +0000 Subject: [PATCH] Add better logs to repo init script --- .githooks/pre-commit | 2 ++ scripts/init.sh | 12 +++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.githooks/pre-commit b/.githooks/pre-commit index cd8c73fb..5387bd9f 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -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() { diff --git a/scripts/init.sh b/scripts/init.sh index ea351a16..8cdf1277 100755 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -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