Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

To discuss: add flag to watch-administration.sh to watch singe plugin #81

Open
MelvinAchterhuis opened this issue Jan 24, 2024 · 1 comment

Comments

@MelvinAchterhuis
Copy link
Contributor

MelvinAchterhuis commented Jan 24, 2024

Currently we have a custom .sh file because in our setup shopware-cli does't seem to work and we can't use shopware-cli extension admin-watch.

This results in a unusable admin watcher for large projects.

So we came up with this:

#!/bin/bash

CWD="$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"

set -euo pipefail

# We need to have the original plugin.json, so dump it and filter it afterwards
BIN_TOOL="${CWD}/console"
"${BIN_TOOL}" bundle:dump

# Extract the plugin name from the parameters
while [[ $# -gt 0 ]]; do
  key="$1"

  case $key in
    --plugin)
    plugin="$2"
    shift # past argument
    shift # past value
    ;;
    *)    # unknown option
    shift # past argument
    ;;
  esac
done

# Define the list of keys to keep
keys_to_keep=('Framework' 'System' 'Content' 'Checkout' 'Profiling' 'Administration' 'Storefront' 'Maintenance' $plugin)

# Read the JSON file and filter it with jq
filtered_json=$(jq -c 'with_entries(select(.key as $k | ["Framework", "System", "Content", "Checkout", "Profiling", "Administration", "Storefront", "Maintenance", "'$plugin'"] | index($k)))' var/plugins.json)

# Overwrite the original file with the filtered JSON
echo $filtered_json > var/plugins.json

# Run the watcher without dumping the bundles again, so we only use our own plugins
APP_ENV=prod SHOPWARE_SKIP_BUNDLE_DUMP=1 bin/watch-administration.sh

This makes something like this (bin/watch-administration.sh):
Screenshot 2024-01-24 at 22 08 40

Into this (bin/watch-admin-plugin.sh --plugin AdyenPaymentShopware6):
Screenshot 2024-01-24 at 22 09 49

Just for discussion, perhaps there are downsides. I don't know :)

@shyim
Copy link
Member

shyim commented Feb 13, 2024

Sounds good. Let's integrate it directly inside watch-administration.sh 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants