Skip to content

Commit

Permalink
Merge pull request #1045 from YevhenZvieriev/feature/setup-pwa-sample…
Browse files Browse the repository at this point in the history
…data
  • Loading branch information
markshust authored Feb 24, 2024
2 parents 823c6e7 + 81386f3 commit 6e93776
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,8 @@ It is recommended to keep your root docker config files in one repository, and y
- `bin/setup-composer-auth`: Setup authentication credentials for Composer.
- `bin/setup-domain`: Setup Magento domain name. Ex: `bin/setup-domain magento.test`
- `bin/setup-grunt`: Install and configure Grunt JavaScript task runner to compile .less files
- `bin/setup-pwa-studio`: (BETA) Install PWA Studio (requires NodeJS and Yarn to be installed on the host machine). Pass in your base site domain, otherwise the default `master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud` will be used. Ex: `bin/setup-pwa-studio magento.test`
- `bin/setup-pwa-studio`: (BETA) Install PWA Studio (requires NodeJS and Yarn to be installed on the host machine). Pass in your base site domain, otherwise the default `master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud` will be used. Ex: `bin/setup-pwa-studio magento.test`.
- `bin/setup-pwa-studio-sampledata`: This script makes it easier to install Venia sample data. Pass in your base site domain, otherwise the default `master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud` will be used. Ex: `bin/setup-pwa-studio-sampledata magento.test`.
- `bin/setup-ssl`: Generate an SSL certificate for one or more domains. Ex. `bin/setup-ssl magento.test foo.test`
- `bin/setup-ssl-ca`: Generate a certificate authority and copy it to the host.
- `bin/start`: Start all containers, good practice to use this instead of `docker-compose up -d`, as it may contain additional helpers.
Expand Down
34 changes: 34 additions & 0 deletions compose/bin/setup-pwa-studio-sampledata
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
set +e

RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'

BASE_URL=${1:-master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud}

install_sampledata() {
echo -e "${GREEN}Setting up composer repository for Venia sample data.${NC}"
bin/composer config --no-interaction --ansi repositories.venia-sample-data composer https://repo.magento.com

echo -e "${GREEN}Requiring Venia sample data metapackage.${NC}"
bin/composer require --no-interaction --ansi magento/venia-sample-data:*

echo -e "${GREEN}Installing Venia sample data modules.${NC}"
bin/magento setup:upgrade

echo -e "${GREEN}Reindexing the data from the modules.${NC}"
bin/magento indexer:reindex
}

install_sampledata

ENV_DIST_FILE="packages/venia-concept/.env.dist"
if [ -f "$ENV_DIST_FILE" ]; then
cp "$ENV_DIST_FILE" packages/venia-concept/.env
else
echo -e "${RED}.env.dist file not found. Continuing without copying.${NC}"
fi

echo -e "${GREEN}Script completed successfully.${NC}"
echo "You may now access your Magento PWA Studio instance at https://${BASE_URL}/"

0 comments on commit 6e93776

Please sign in to comment.