Skip to content

Commit

Permalink
Merge pull request #61 from shopware/next-30878/fix-admin-build-and-w…
Browse files Browse the repository at this point in the history
…atch

NEXT-30878 - fix admin build and watch
  • Loading branch information
jleifeld authored Oct 18, 2023
2 parents 2ed1bb1 + 03a64e3 commit 0615b18
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 5 deletions.
17 changes: 16 additions & 1 deletion shopware/administration/6.4/bin/build-administration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

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

export PROJECT_ROOT="${PROJECT_ROOT:-"$(dirname "$CWD")"}"
export ENV_FILE=${ENV_FILE:-"${PROJECT_ROOT}/.env"}

# shellcheck source=functions.sh
source "${PROJECT_ROOT}/bin/functions.sh"

curenv=$(declare -p -x)

load_dotenv "$ENV_FILE"

# Restore environment variables set globally
set -o allexport
eval "$curenv"
set +o allexport

set -euo pipefail

export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
Expand All @@ -21,6 +36,7 @@ fi

# build admin
[[ ${SHOPWARE_SKIP_BUNDLE_DUMP-""} ]] || "${BIN_TOOL}" bundle:dump
"${BIN_TOOL}" feature:dump || true

if [[ $(command -v jq) ]]; then
OLDPWD=$(pwd)
Expand Down Expand Up @@ -60,5 +76,4 @@ if [[ -z "${SHOPWARE_SKIP_ENTITY_SCHEMA_DUMP-""}" ]] && [[ -f "${ADMIN_ROOT}"/Re
fi

(cd "${ADMIN_ROOT}"/Resources/app/administration && npm run build)

[[ ${SHOPWARE_SKIP_ASSET_COPY-""} ]] ||"${BIN_TOOL}" assets:install
13 changes: 11 additions & 2 deletions shopware/administration/6.4/bin/watch-administration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ export ESLINT_DISABLE
export PORT
export APP_URL

bin/console bundle:dump
bin/console feature:dump || true
BIN_TOOL="${CWD}/console"

[[ ${SHOPWARE_SKIP_BUNDLE_DUMP-""} ]] || "${BIN_TOOL}" bundle:dump
"${BIN_TOOL}" feature:dump || true

if [[ $(command -v jq) ]]; then
OLDPWD=$(pwd)
Expand Down Expand Up @@ -57,4 +59,11 @@ if [ ! -d vendor/shopware/administration/Resources/app/administration/node_modul
npm install --prefix vendor/shopware/administration/Resources/app/administration/
fi

# Dump entity schema
if [[ -z "${SHOPWARE_SKIP_ENTITY_SCHEMA_DUMP-""}" ]] && [[ -f "${ADMIN_ROOT}"/Resources/app/administration/scripts/entitySchemaConverter/entity-schema-converter.ts ]]; then
mkdir -p "${ADMIN_ROOT}"/Resources/app/administration/test/_mocks_
"${BIN_TOOL}" -e prod framework:schema -s 'entity-schema' "${ADMIN_ROOT}"/Resources/app/administration/test/_mocks_/entity-schema.json
(cd "${ADMIN_ROOT}"/Resources/app/administration && npm run convert-entity-schema)
fi

npm run --prefix vendor/shopware/administration/Resources/app/administration/ dev
16 changes: 16 additions & 0 deletions shopware/platform/6.4/bin/build-administration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

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

export PROJECT_ROOT="${PROJECT_ROOT:-"$(dirname "$CWD")"}"
export ENV_FILE=${ENV_FILE:-"${PROJECT_ROOT}/.env"}

# shellcheck source=functions.sh
source "${PROJECT_ROOT}/bin/functions.sh"

curenv=$(declare -p -x)

load_dotenv "$ENV_FILE"

# Restore environment variables set globally
set -o allexport
eval "$curenv"
set +o allexport

set -euo pipefail

export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
Expand All @@ -21,6 +36,7 @@ fi

# build admin
[[ ${SHOPWARE_SKIP_BUNDLE_DUMP-""} ]] || "${BIN_TOOL}" bundle:dump
"${BIN_TOOL}" feature:dump || true

if [[ $(command -v jq) ]]; then
OLDPWD=$(pwd)
Expand Down
13 changes: 11 additions & 2 deletions shopware/platform/6.4/bin/watch-administration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ export ESLINT_DISABLE
export PORT
export APP_URL

bin/console bundle:dump
bin/console feature:dump || true
BIN_TOOL="${CWD}/console"

[[ ${SHOPWARE_SKIP_BUNDLE_DUMP-""} ]] || "${BIN_TOOL}" bundle:dump
"${BIN_TOOL}" feature:dump || true

if [[ $(command -v jq) ]]; then
OLDPWD=$(pwd)
Expand Down Expand Up @@ -57,4 +59,11 @@ if [ ! -d vendor/shopware/administration/Resources/app/administration/node_modul
npm install --prefix vendor/shopware/administration/Resources/app/administration/
fi

# Dump entity schema
if [[ -z "${SHOPWARE_SKIP_ENTITY_SCHEMA_DUMP-""}" ]] && [[ -f "${ADMIN_ROOT}"/Resources/app/administration/scripts/entitySchemaConverter/entity-schema-converter.ts ]]; then
mkdir -p "${ADMIN_ROOT}"/Resources/app/administration/test/_mocks_
"${BIN_TOOL}" -e prod framework:schema -s 'entity-schema' "${ADMIN_ROOT}"/Resources/app/administration/test/_mocks_/entity-schema.json
(cd "${ADMIN_ROOT}"/Resources/app/administration && npm run convert-entity-schema)
fi

npm run --prefix vendor/shopware/administration/Resources/app/administration/ dev

0 comments on commit 0615b18

Please sign in to comment.