Skip to content

Commit

Permalink
Update script that namespaces Laravel's helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcasual committed Apr 29, 2023
1 parent 78ff7d6 commit d2aabfe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,13 @@
"post_update_install": "./composer_post_update_install.sh",
"post-install-cmd": [
"@prefix_vendor",
"@post_update_install"
"@post_update_install",
"composer dump-autoload -o"
],
"post-update-cmd": [
"@prefix_vendor",
"@post_update_install"
"@post_update_install",
"composer dump-autoload -o"
]
},
"config": {
Expand Down
5 changes: 2 additions & 3 deletions composer_post_update_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ VENDOR_FOLDERS_TO_KEEP=("composer")
if [ -f "vendor_prefixed/illuminate/support/helpers.php" ]; then
insertion="${FOUNDATION_NAMESPACE}\Foundation\ThirdParty\Illuminate\Support"
insertion="\nnamespace ${insertion//\\/\\\\\\};\n" # Escape backslashes for sed
[[ "$(uname)" = "Darwin" ]] && in_place_edit=(-i '') || in_place_edit=(-i)

sed -i ''$([ "$(uname)" = "Darwin" ] && echo '') \
sed "${in_place_edit[@]}" \
-e "1s/^//p; 1s/^.*/${insertion}/" \
vendor_prefixed/illuminate/support/helpers.php
fi
Expand All @@ -17,5 +18,3 @@ fi
if [[ -d "vendor" && "${COMPOSER_DEV_MODE}" -eq 0 ]]; then
find ./vendor -mindepth 1 -maxdepth 1 -type d $(printf -- "-not -name %s " "${VENDOR_FOLDERS_TO_KEEP[@]}") -exec rm -rf '{}' \;
fi

composer dump-autoload -o

0 comments on commit d2aabfe

Please sign in to comment.