-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate-locktest.sh
More file actions
executable file
·121 lines (108 loc) · 3.75 KB
/
Copy pathupdate-locktest.sh
File metadata and controls
executable file
·121 lines (108 loc) · 3.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/bin/bash
# =============================================================================
# UPDATE LOCKTEST SCRIPT
# =============================================================================
#
# PURPOSE: This script updates the locktest frontend by copying files from
# token-lock-ui to liberdus.github.io/locktest.
#
# PREREQUISITES:
# 1. This script must be located in the liberdus.github.io directory
# 2. The token-lock-ui repository must be in the same parent directory as liberdus.github.io
# example structure:
# /path/to/parent/
# ├── liberdus.github.io/ (this repo, contains this script)
# └── token-lock-ui/ (source repo)
# 3. The script must have execute permissions: chmod +x update-locktest.sh
#
# USAGE:
# 1. Run the script from anywhere: ./update-locktest.sh
# (or: cd liberdus.github.io && ./update-locktest.sh)
#
# WHAT IT DOES:
# - Copies all files from token-lock-ui/* to liberdus.github.io/locktest/
# - Excludes build artifacts, tests, docs, package files, patches, local scripts, git files, and editor junk
# - Replaces existing files in the locktest folder
# - Preserves directory structure
# - Removes files that no longer exist in the source and removes excluded dev files from the target
#
# =============================================================================
# Get the directory where this script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# The script should be in liberdus.github.io, so that's our repo root
REPO_DIR="$SCRIPT_DIR"
# Source directory is in the sibling token-lock-ui directory
SOURCE_DIR="$(dirname "$REPO_DIR")/token-lock-ui"
# Target directory is the locktest folder in this repo
TARGET_DIR="$REPO_DIR/locktest"
# Change to the repo directory
cd "$REPO_DIR" || exit 1
# Check if source directory exists
if [ ! -d "$SOURCE_DIR" ]; then
echo "Error: Source directory not found: $SOURCE_DIR"
echo "Please ensure token-lock-ui exists in the same parent directory as liberdus.github.io"
exit 1
fi
# Check if source directory is empty
if [ -z "$(ls -A "$SOURCE_DIR")" ]; then
echo "Error: Source directory is empty: $SOURCE_DIR"
exit 1
fi
# Create target directory if missing
if [ ! -d "$TARGET_DIR" ]; then
mkdir -p "$TARGET_DIR"
echo "Created target directory: $TARGET_DIR"
fi
echo "Updating locktest frontend..."
echo "Source: $SOURCE_DIR"
echo "Target: $TARGET_DIR"
# Copy all files and directories from source to target
rsync -av --delete --delete-excluded \
--exclude='node_modules' \
--exclude='.git' \
--exclude='.gitignore' \
--exclude='.github' \
--exclude='.github/' \
--exclude='.idea' \
--exclude='.DS_Store' \
--exclude='.vscode' \
--exclude='.cursor' \
--exclude='.cursor/' \
--exclude='.cursorrles' \
--exclude='.next' \
--exclude='dist' \
--exclude='build' \
--exclude='out' \
--exclude='coverage' \
--exclude='coverage/' \
--exclude='playwright-report' \
--exclude='playwright-report/' \
--exclude='test-results' \
--exclude='test-results/' \
--exclude='tests' \
--exclude='tests/' \
--exclude='scripts' \
--exclude='scripts/' \
--exclude='patches' \
--exclude='patches/' \
--exclude='*.patch' \
--exclude='*.diff' \
--exclude='*.md' \
--exclude='*.MD' \
--exclude='package.json' \
--exclude='package-lock.json' \
--exclude='playwright.config.*' \
--exclude='*.log' \
"$SOURCE_DIR/" "$TARGET_DIR/"
# Verify the copy operation
if [ $? -eq 0 ]; then
echo "Locktest update completed successfully!"
echo "Files copied from: $SOURCE_DIR"
echo "Files copied to: $TARGET_DIR"
# Show some statistics
file_count=$(find "$TARGET_DIR" -type f | wc -l)
echo "Total files in locktest folder: $file_count"
else
echo "Error: Copy operation failed"
exit 1
fi