Edit in GitHubLog an issue

Install the Commerce metapackage

This metapackage is only required for PWA projects that target Adobe Commerce as the backend.

Prerequisite

Installation as a git-based composer package

To setup and develop your PWA extension modules locally, use the following instructions.

  1. Clone the magento2-pwa-commerce repository into your Magento Commerce vendor directory name:

    Copied to your clipboard
    git clone git@github.com:magento/magento2-pwa-commerce.git ext/<vendor-directory-name>/magento2-pwa-commerce
  2. Update the magento2/composer.json settings to create a better development workflow for your extension modules:

    • Update the minimum-stability for packages to dev. This allows for the installation of development modules:

      Copied to your clipboard
      composer config minimum-stability dev
    • To work with stable packages, ensure that the prefer-stable property is true. This property should already be included in the composer.json file, right above the minimum-stability setting.

    • Configure composer to find new extension modules. The following command configures composer to treat any extension code inside the ext directory as a package and creates a symlink to the vendor directory:

      Copied to your clipboard
      composer config repositories.ext path "./ext/*/*/*"
  3. Install the pwa-commerce metapackage:

    Copied to your clipboard
    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:

Copied to your clipboard
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:

  1. Exclude all the ext directories in the project's .git configuration:

    Copied to your clipboard
    echo ext >> ./.git/info/exclude
  2. Skip your project's root directory composer.\* files to avoid committing them by mistake:

    Copied to your clipboard
    git update-index --skip-worktree composer.json && git update-index --skip-worktree composer.lock

    NOTE: You can reverse this operation anytime as needed:

    Copied to your clipboard
    git update-index --no-skip-worktree composer.json && git update-index --no-skip-worktree composer.lock

Cloud deployment extension installation

  1. Add https://repo.magento.com as a composer repository by adding the following to the composer.json file of your cloud instances.

    Copied to your clipboard
    "repositories": {
    "repo": {
    "type": "composer",
    "url": "https://repo.magento.com"
    }
    },
  2. Require in magento/magento2-pwa-commerce extension by adding the following to the composer.json file of your cloud instances.

    Copied to your clipboard
    "require": {
    "magento/magento2-pwa-commerce": "0.0.1"
    },
  3. Ensure your auth.json file has valid credentials for repo.magento.com.

  4. Run composer update to update your composer.lock file.

  5. Push the changes and deploy your cloud instance.

  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.