Update precommit
This commit is contained in:
+1
-16
@@ -5,23 +5,8 @@ if git diff --cached --name-only | grep -q "^package.json$"; then
|
|||||||
git add pnpm-lock.yaml
|
git add pnpm-lock.yaml
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if entry needs rebuilding
|
# Check if entry needs rebuilding (entry.ts, esbuild.config.js, or any .ts files)
|
||||||
# Rebuild if: entry.ts/esbuild.config.js/.ts files are staged, OR if entry is out of date
|
|
||||||
NEEDS_REBUILD=false
|
|
||||||
|
|
||||||
# Check staged files
|
|
||||||
if git diff --cached --name-only | grep -qE "^(entry\.ts|esbuild\.config\.js|.*\.ts)$"; then
|
if git diff --cached --name-only | grep -qE "^(entry\.ts|esbuild\.config\.js|.*\.ts)$"; then
|
||||||
NEEDS_REBUILD=true
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if entry is out of date compared to entry.ts
|
|
||||||
if [ -f entry.ts ] && [ -f entry ]; then
|
|
||||||
if [ entry.ts -nt entry ] || [ esbuild.config.js -nt entry ]; then
|
|
||||||
NEEDS_REBUILD=true
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$NEEDS_REBUILD" = true ]; then
|
|
||||||
echo "🔨 Building action..."
|
echo "🔨 Building action..."
|
||||||
pnpm build
|
pnpm build
|
||||||
git add entry
|
git add entry
|
||||||
|
|||||||
Reference in New Issue
Block a user