Skip to content

Commit 3f2f8d1

Browse files
committed
ci: fix logic for sub folders
1 parent 20adfad commit 3f2f8d1

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

scripts/patch-repo.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,17 @@ if [ ! -d "$TARGET_DIR" ]; then
2525
exit 1
2626
fi
2727

28-
# Extract tar archive
29-
tar zxvvf "$TAR_FILE" -C "$(dirname "$TARGET_DIR")"
28+
# Determine how many leading components to strip from the tarball
29+
# We count the number of directory separators in the first entry
30+
# e.g., "vue/v2/" -> 2 slashes -> strip 2, "react/" -> 1 slash -> strip 1
31+
STRIP_COMPONENTS=$(tar -tf "$TAR_FILE" | head -n 1 | tr -cd '/' | wc -c)
32+
33+
# Clean up target directory except for .git and node_modules to ensure a clean sync
34+
# This allows 'git add -A' to detect deletions
35+
find "$TARGET_DIR" -mindepth 1 -maxdepth 1 ! -name ".git" ! -name "node_modules" -exec rm -rf {} +
36+
37+
# Extract tar archive directly into the target directory, stripping the prefix
38+
tar zxvf "$TAR_FILE" -C "$TARGET_DIR" --strip-components="${STRIP_COMPONENTS// /}"
3039

3140
# Add all changes and commit
3241
cd "$TARGET_DIR"

src/static/react/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/static/react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-onesignal",
3-
"version": "3.4.0",
3+
"version": "3.4.1",
44
"description": "React OneSignal Module: Make it easy to integrate OneSignal with your React App!",
55
"contributors": [
66
{

0 commit comments

Comments
 (0)