diff --git a/README.md b/README.md index 329738afe..1c9c2facb 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/compose/bin/setup-pwa-studio-sampledata b/compose/bin/setup-pwa-studio-sampledata new file mode 100755 index 000000000..ead888e42 --- /dev/null +++ b/compose/bin/setup-pwa-studio-sampledata @@ -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}/"