1#!/usr/bin/env bash 2# 3# Copyright 2025 The Hafnium Authors. 4# 5# Use of this source code is governed by a BSD-style 6# license that can be found in the LICENSE file or at 7# https://opensource.org/licenses/BSD-3-Clause. 8 9set -euo pipefail 10 11SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 12ROOT_DIR="$(dirname "$SCRIPT_DIR")" 13 14FROM="${1:-HEAD~1}" 15TO="${2:-HEAD}" 16 17# Install commitlint only if not already available. 18if [ ! -d "node_modules/@commitlint/cli" ]; then 19 export npm_config_cache=/tmp/.npm 20 npm install -D @commitlint/cli @commitlint/config-conventional 21fi 22 23# Execute the commitlint command. 24npx commitlint --from=$FROM --to=$TO --verbose 25