Install the Commerce metapackage
This metapackage is only required for PWA projects that target Adobe Commerce as the backend.
Prerequisite
- GraphQL metapackage in all projects using PWA Studio 12.1.0 and higher.
Installation as a git-based composer package
To setup and develop your PWA extension modules locally, use the following instructions.
-
Clone the
magento2-pwa-commercerepository into your Magento Commerce vendor directory name:git clone git@github.com:magento/magento2-pwa-commerce.git ext/<vendor-directory-name>/magento2-pwa-commerce -
Update the
magento2/composer.jsonsettings to create a better development workflow for your extension modules:-
Update the
minimum-stabilityfor packages todev. This allows for the installation of development modules:composer config minimum-stability dev -
To work with
stablepackages, ensure that theprefer-stableproperty istrue. This property should already be included in thecomposer.jsonfile, right above theminimum-stabilitysetting. -
Configure
composerto find new extension modules. The following command configurescomposerto treat any extension code inside theextdirectory as a package and creates a symlink to thevendordirectory:composer config repositories.ext path "./ext/*/*/*"
-
-
Install the
pwa-commercemetapackage:composer require magento/pwa-commerce
At this point, you should see symlinks for all the pwa-commerce modules inside the vendor directory. These symlinks allow you to:
- Run a Magento installation with additional modules.
- Develop locally using the standard git workflow.
Make sure that all of the required modules are enabled when you run bin/magento module:status. See, Enable or disable a component in the PHP Developer Guide for instructions. The following modules should now be enabled:
Magento_BannerGraphQlAux
Magento_EavGraphQlAux
Magento_CatalogGraphQlAux
Magento_SalesGraphQlAux
Magento_WeeeGraphQlAux
Magento_ContactGraphQlPwa
Magento_NewsletterGraphQlPwa
Magento_PageBuilderPwa
Magento_ReCaptchaGraphQlPwa
Magento_ReCaptchaPwa
Magento_UrlRewriteGraphQlPwa
Setting up the Git workflow
To improve the developer experience even further, you can add these configurations as well:
-
Exclude all the
extdirectories in the project's.gitconfiguration:echo ext >> ./.git/info/exclude -
Skip your project's root directory
composer.\*files to avoid committing them by mistake:git update-index --skip-worktree composer.json && git update-index --skip-worktree composer.lockNOTE: You can reverse this operation anytime as needed:
git update-index --no-skip-worktree composer.json && git update-index --no-skip-worktree composer.lock
Cloud deployment extension installation
-
Add
https://repo.magento.comas a composer repository by adding the following to thecomposer.jsonfile of your cloud instances."repositories": { "repo": { "type": "composer", "url": "https://repo.magento.com" } }, -
Require in
magento/magento2-pwa-commerceextension by adding the following to thecomposer.jsonfile of your cloud instances."require": { "magento/magento2-pwa-commerce": "0.0.1" }, -
Ensure your
auth.jsonfile has valid credentials forrepo.magento.com. -
Run
composer updateto update yourcomposer.lockfile. -
Push the changes and deploy your cloud instance.