-
Notifications
You must be signed in to change notification settings - Fork 28
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
Add --active-only flag to theme compile in watch-storefront.sh #55
Add --active-only flag to theme compile in watch-storefront.sh #55
Conversation
Thanks for the PR 😍 How to test these changes in your application
Diff between recipe versionsIn order to help with the review stage, I'm in charge of computing the diff between the various versions of patched recipes. shopware/storefront6.4 vs 6.6diff --git a/shopware/storefront/6.4/bin/build-storefront.sh b/shopware/storefront/6.6/bin/build-storefront.sh
index 0542288..af6f6e2 100755
--- a/shopware/storefront/6.4/bin/build-storefront.sh
+++ b/shopware/storefront/6.6/bin/build-storefront.sh
@@ -6,6 +6,9 @@ set -euo pipefail
export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
export PROJECT_ROOT="${PROJECT_ROOT:-"$(dirname "$CWD")"}"
+export NPM_CONFIG_FUND=false
+export NPM_CONFIG_AUDIT=false
+export NPM_CONFIG_UPDATE_NOTIFIER=false
if [[ -e "${PROJECT_ROOT}/vendor/shopware/platform" ]]; then
STOREFRONT_ROOT="${STOREFRONT_ROOT:-"${PROJECT_ROOT}/vendor/shopware/platform/src/Storefront"}"
@@ -47,7 +50,7 @@ if [[ $(command -v jq) ]]; then
if [[ -f "$path/package.json" && ! -d "$path/node_modules" && $name != "storefront" ]]; then
echo "=> Installing npm dependencies for ${name}"
- npm install --prefix "$path" --no-audit --prefer-offline
+ npm install --prefix "$path" --prefer-offline
fi
done
cd "$OLDPWD" || exit
@@ -55,8 +58,8 @@ else
echo "Cannot check extensions for required npm installations as jq is not installed"
fi
-npm --prefix "${STOREFRONT_ROOT}"/Resources/app/storefront install --no-audit --prefer-offline
+npm --prefix "${STOREFRONT_ROOT}"/Resources/app/storefront install --prefer-offline --production
node "${STOREFRONT_ROOT}"/Resources/app/storefront/copy-to-vendor.js
npm --prefix "${STOREFRONT_ROOT}"/Resources/app/storefront run production
[[ ${SHOPWARE_SKIP_ASSET_COPY-""} ]] ||"${BIN_TOOL}" assets:install
-[[ ${SHOPWARE_SKIP_THEME_COMPILE-""} ]] || "${BIN_TOOL}" theme:compile
+[[ ${SHOPWARE_SKIP_THEME_COMPILE-""} ]] || "${BIN_TOOL}" theme:compile --active-only
diff --git a/shopware/storefront/6.4/bin/watch-storefront.sh b/shopware/storefront/6.6/bin/watch-storefront.sh
index c7a38ed..8ff0079 100755
--- a/shopware/storefront/6.4/bin/watch-storefront.sh
+++ b/shopware/storefront/6.6/bin/watch-storefront.sh
@@ -4,6 +4,9 @@ CWD="$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
export PROJECT_ROOT="${PROJECT_ROOT:-"$(dirname "$CWD")"}"
export ENV_FILE=${ENV_FILE:-"${PROJECT_ROOT}/.env"}
+export NPM_CONFIG_FUND=false
+export NPM_CONFIG_AUDIT=false
+export NPM_CONFIG_UPDATE_NOTIFIER=false
# shellcheck source=functions.sh
source "${PROJECT_ROOT}/bin/functions.sh"
@@ -23,6 +26,16 @@ export PROXY_URL
export STOREFRONT_ASSETS_PORT
export STOREFRONT_PROXY_PORT
+if [[ -e "${PROJECT_ROOT}/vendor/shopware/platform" ]]; then
+ STOREFRONT_ROOT="${STOREFRONT_ROOT:-"${PROJECT_ROOT}/vendor/shopware/platform/src/Storefront"}"
+else
+ STOREFRONT_ROOT="${STOREFRONT_ROOT:-"${PROJECT_ROOT}/vendor/shopware/storefront"}"
+fi
+
+if [[ ! -d "${STOREFRONT_ROOT}"/Resources/app/storefront/node_modules/webpack-dev-server ]]; then
+ npm --prefix "${STOREFRONT_ROOT}"/Resources/app/storefront install --prefer-offline
+fi
+
DATABASE_URL="" "${CWD}"/console feature:dump
"${CWD}"/console theme:compile --active-only
"${CWD}"/console theme:dump
@@ -55,4 +68,4 @@ else
echo "Cannot check extensions for required npm installations as jq is not installed"
fi
-npm --prefix vendor/shopware/storefront/Resources/app/storefront/ run-script hot-proxy
+npm --prefix "${STOREFRONT_ROOT}"/Resources/app/storefront run-script hot-proxy |
We need to keep backwards compatibility in mind because |
@@ -23,7 +23,7 @@ export STOREFRONT_PROXY_PORT | |||
export ESLINT_DISABLE | |||
|
|||
DATABASE_URL="" "${CWD}"/console feature:dump | |||
"${CWD}"/console theme:compile | |||
"${CWD}"/console theme:compile --active-only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should run --help
and check for --active-only
there
I added it already for next major: 37fe3e3 |
373d319
to
60e24e0
Compare
@MelvinAchterhuis should we maybe close this as it will be anyway in 6.6? I don't see a really good way to check that this flag exists? |
When using watch-storefront.sh it makes sense to only compile the theme for active sales channels, because inactive sales can't be reached so no need to compile them.