Skip to content

Project set up for development in a local environment

Eugene Shakhsuvarov edited this page Aug 12, 2019 · 7 revisions

Goal

Keeping extension modules in a repository with the whole Magento project creates additional challenges to support and maintain the codebase. It has to be continuously synchronized with the Magento core and all of the commits must be monitored, to make sure that none of the core components are affected at any time.

To combat these kind of issues, the new approach has been developed and documented in the Architecture repository [link]. The described technique allows to keep extension code separately, in a form of Composer metapackage containing a set of modules. This allows for simple installation and development in a local environment both for Git-based and Composer-based Magento deployments.

⚠️ This document describes set-up only for development purposes.

Setting Up Modules

  1. 📙 Magento git repository is cloned and 2.3-develop branch is checked out. Checking out any 2.3 release tags should work fine as well.

    git clone git@github.com:magento/magento2.git .
  2. 🆕 Create ext directory in the root directory of Magento:

    mkdir ext
  3. ⬇️ Git clone the aep-launch repository into the appropriate directory inside ext:

    git clone git@github.com:magento/aep-launch.git ext/adobe/aep-launch
  4. 🔧Update Composer settings for the project to allow a better development workflow:

    • minimum-stability for packages is updated to dev value. This allows to install development modules:

        composer config minimum-stability dev
      
    • Local package sources are configured, to let Composer know where to find the modules. The following command will configure the extension code, inside ext directory, to be treated as a package and symlinked to the vendor directory:

        composer config repositories.ext path "./ext/*/*/*"
      
  5. 🎉Finally, install the aep-launch metapackage:

    composer require adobe/aep-launch

✅ At this point, all of the aep-launch modules are symlinked to vendor directory, which allows both running Magento installation with additional modules and development using the git workflow.

Setting up Git workflow

In order to improve Developer Experience when working with this repository structure, a few additional items may be configured:

  1. Exclude ext directories from root directory Git:

    echo ext >> ./.git/info/exclude
  2. Skip root directory composer.* files to avoid committing them by mistake:

    git update-index --skip-worktree composer.json
    git update-index --skip-worktree composer.lock

    This operation is reversible, if needed:

    git update-index --no-skip-worktree composer.json
    git update-index --no-skip-worktree composer.lock

Adobe Experience Platform configuration

After installing, you need to create an integration and configure the Adobe Experience Platform extension. See the Setting up the Adobe Experience Platform Magento Extension guide.