Created
          January 1, 2024 07:57 
        
      - 
      
 - 
        
Save iamntz/499478074504a9727569a664c54055fb to your computer and use it in GitHub Desktop.  
    quickly update bedrock-related files
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/bin/bash | |
| ## Description: Update bedrock packages | |
| ## Usage: update-bedrock [wp|plugins|themes] | |
| ## Example: "ddev update-bedrock" or "ddev update-bedrock wp" or "ddev update-bedrock plugins" or "ddev update-bedrock themes" | |
| ## ExecRaw: true | |
| ## HostWorkingDir: true | |
| case $1 in | |
| wp) | |
| what='roots/' | |
| ;; | |
| plugins) | |
| what='wpackagist-plugin/' | |
| ;; | |
| themes) | |
| what='wpackagist-theme/' | |
| ;; | |
| *) | |
| what='(wpackagist-theme|wpackagist-plugin|roots)/' | |
| ;; | |
| esac | |
| __packages=$(composer show -s | sed -n '/requires$/,/^$/p' | cut -d ' ' -f1) | |
| IFS=$'\n' read -ra packages -d $'\0' <<< "$__packages" | |
| toUpdate='' | |
| for package in "${packages[@]}" | |
| do | |
| if [[ "$package" =~ ^$what.* ]]; then | |
| toUpdate="$toUpdate $package" | |
| fi | |
| done | |
| composer require $toUpdate | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment