Merge commit 'd803bfe2b1fe7f5e219e50ac20d6801a0a58ac75' as 'vendor/ruvector'
This commit is contained in:
38
vendor/ruvector/scripts/ci/ci-sync-lockfile.sh
vendored
Executable file
38
vendor/ruvector/scripts/ci/ci-sync-lockfile.sh
vendored
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
# CI/CD script to auto-fix package-lock.json and create a commit
|
||||
# Use this in GitHub Actions to automatically fix lock file issues
|
||||
|
||||
set -e
|
||||
|
||||
echo "🔍 Checking package-lock.json sync for CI/CD..."
|
||||
|
||||
cd npm
|
||||
|
||||
# Try npm ci first to check if lock file is in sync
|
||||
if npm ci --dry-run 2>&1 | grep -q "can only install packages when your package.json and package-lock.json"; then
|
||||
echo "❌ Lock file out of sync - fixing automatically..."
|
||||
|
||||
# Update lock file
|
||||
npm install
|
||||
|
||||
# Check if we're in a git repository and have changes
|
||||
if git diff --quiet npm/package-lock.json; then
|
||||
echo "✅ Lock file is now in sync (no changes needed)"
|
||||
else
|
||||
echo "✅ Lock file updated"
|
||||
|
||||
# If running in GitHub Actions, commit and push
|
||||
if [ -n "$GITHUB_ACTIONS" ]; then
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add npm/package-lock.json
|
||||
git commit -m "chore: Auto-sync package-lock.json [skip ci]"
|
||||
git push
|
||||
echo "✅ Lock file committed and pushed"
|
||||
else
|
||||
echo "⚠️ Lock file updated but not committed (not in GitHub Actions)"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "✅ Lock file is already in sync"
|
||||
fi
|
||||
28
vendor/ruvector/scripts/ci/install-hooks.sh
vendored
Executable file
28
vendor/ruvector/scripts/ci/install-hooks.sh
vendored
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
# Install git hooks for automatic lock file syncing
|
||||
|
||||
set -e
|
||||
|
||||
echo "🔧 Installing git hooks..."
|
||||
|
||||
# Create .git/hooks directory if it doesn't exist
|
||||
mkdir -p .git/hooks
|
||||
|
||||
# Install pre-commit hook
|
||||
if [ -f ".githooks/pre-commit" ]; then
|
||||
ln -sf ../../.githooks/pre-commit .git/hooks/pre-commit
|
||||
chmod +x .git/hooks/pre-commit
|
||||
chmod +x .githooks/pre-commit
|
||||
echo "✅ Pre-commit hook installed"
|
||||
else
|
||||
echo "❌ Pre-commit hook file not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "✨ Git hooks installed successfully!"
|
||||
echo ""
|
||||
echo "The following hooks are now active:"
|
||||
echo " • pre-commit: Automatically syncs package-lock.json when package.json changes"
|
||||
echo ""
|
||||
echo "To disable, run: rm .git/hooks/pre-commit"
|
||||
51
vendor/ruvector/scripts/ci/sync-lockfile.sh
vendored
Executable file
51
vendor/ruvector/scripts/ci/sync-lockfile.sh
vendored
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
# Automatically sync package-lock.json with package.json changes
|
||||
# Can be used as git hook, CI/CD step, or manual script
|
||||
|
||||
set -e
|
||||
|
||||
echo "🔍 Checking package-lock.json sync..."
|
||||
|
||||
# Change to npm directory (if it exists)
|
||||
NPM_DIR="$(dirname "$0")/../npm"
|
||||
if [ ! -d "$NPM_DIR" ]; then
|
||||
echo "✅ No npm directory found, skipping sync"
|
||||
exit 0
|
||||
fi
|
||||
cd "$NPM_DIR"
|
||||
|
||||
# Check if package.json or any workspace package.json changed
|
||||
CHANGED_PACKAGES=$(git diff --cached --name-only | grep -E 'package\.json$' || true)
|
||||
|
||||
if [ -n "$CHANGED_PACKAGES" ]; then
|
||||
echo "📦 Package.json changes detected:"
|
||||
echo "$CHANGED_PACKAGES"
|
||||
echo ""
|
||||
echo "🔄 Running npm install to sync lock file..."
|
||||
|
||||
# Run npm install to update lock file
|
||||
# Use --ignore-optional to skip platform-specific optional deps (darwin-arm64 on linux, etc.)
|
||||
npm install --ignore-optional || {
|
||||
echo "⚠️ npm install had warnings (likely platform-specific optional deps)"
|
||||
echo " Continuing with lock file sync..."
|
||||
}
|
||||
|
||||
# Check if lock file changed
|
||||
if git diff --name-only | grep -q 'package-lock.json'; then
|
||||
echo "✅ Lock file updated successfully"
|
||||
|
||||
# If running as pre-commit hook, add the lock file
|
||||
if [ "${GIT_HOOK}" = "pre-commit" ]; then
|
||||
cd ..
|
||||
git add npm/package-lock.json
|
||||
echo "✅ Lock file staged for commit"
|
||||
else
|
||||
echo "⚠️ Lock file modified but not staged"
|
||||
echo " Run: git add npm/package-lock.json"
|
||||
fi
|
||||
else
|
||||
echo "✅ Lock file already in sync"
|
||||
fi
|
||||
else
|
||||
echo "✅ No package.json changes detected"
|
||||
fi
|
||||
Reference in New Issue
Block a user