Install the Open Source metapackage
While PWA uses the standard GraphQL workflow, the metapackage adds capabilities for some PWA Studio features.
You must install this metapackage in all projects using PWA Studio 12.1.0 and higher.
Installation as a git-based composer package
To set up and develop your PWA extension modules locally, use the following instructions.
-
Clone the
magento2-pwarepository into yourvendordirectory name:git clone git@github.com:magento/magento2-pwa.git ext/magento/magento2-pwa -
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 "./vendor/ext/*/*/*"
-
-
Install the
pwametapackage:composer require magento/pwa
At this point, you should see symlinks for all the pwa 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_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.com as a composer repository by adding the following to the
composer.jsonfile of your cloud instances."repositories": { "repo": { "type": "composer", "url": "https://repo.magento.com" } }, -
Require the
magento/pwaextension by adding the following to thecomposer.jsonfile of your cloud instances."require": { "magento/pwa": "0.2.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.