|
1 |
| -# Magento 2 PWA |
| 1 | +# PWA Metapackage for Magento Open Source Extensions |
2 | 2 |
|
3 |
| -Welcome to the Magento 2 PWA Open Source Extensions |
| 3 | +Welcome to PWA metapackage for Magento Open Source extensions. |
| 4 | +As a metapackage for Magento Open Source, this repo enables PWA extension developers to add any additional Magento Open Source features they need to support their PWA modules. |
4 | 5 |
|
5 |
| -## Modules |
6 |
| -### [Magento_ContactGraphQlPwa (magento/module-contact-graph-ql-pwa)](ContactGraphQlPwa/README.md) |
7 |
| -Provides GraphQl functionality for the contact-us form. |
| 6 | +## Current Modules |
8 | 7 |
|
9 |
| -### [Magento_NewsletterGraphQlPwa (magento/module-newsletter-graph-ql-pwa)](NewsletterGraphQlPwa/README.md) |
10 |
| -Provides additional GraphQl functionality for the newsletter subscriptions in PWA. |
| 8 | +- [Magento_ContactGraphQlPwa (magento/module-contact-graph-ql-pwa)](ContactGraphQlPwa) — Provides GraphQl functionality for the contact-us form. |
| 9 | + |
| 10 | +- [Magento_NewsletterGraphQlPwa (magento/module-newsletter-graph-ql-pwa)](NewsletterGraphQlPwa) — Provides additional GraphQl functionality for the newsletter subscriptions in PWA. |
| 11 | + |
| 12 | +## Development setup |
| 13 | + |
| 14 | +To setup and develop your PWA extension modules locally, use the following instructions: |
| 15 | + |
| 16 | +### Installation as a git-based composer package |
| 17 | + |
| 18 | +1. Clone and/or navigate to your [`magento2` git repository](https://github.com/magento/magento2) and check out the latest develop branch, e.g. `2.4-develop`. You may also check out and use any `2.4` release tags. |
| 19 | + |
| 20 | + ```bash |
| 21 | + git clone git@github.com:magento/magento2.git |
| 22 | + cd magento2 |
| 23 | + ``` |
| 24 | + |
| 25 | +1. Create an `ext` directory within the root of your `magento2` project: |
| 26 | + |
| 27 | + ```bash |
| 28 | + mkdir ext |
| 29 | + ``` |
| 30 | + |
| 31 | +1. Clone the `magento2-pwa` repository into your vendor directory name: |
| 32 | + |
| 33 | + ```bash |
| 34 | + git clone git@github.com:magento-commerce/magento2-pwa.git ext/magento/magento2-pwa |
| 35 | + ``` |
| 36 | + |
| 37 | +1. Update the `magento2/composer.json` settings to create a better development workflow for your extension modules: |
| 38 | + |
| 39 | + - Update the `minimum-stability` for packages to `dev`. This allows for the installation of development modules: |
| 40 | + |
| 41 | + ```bash |
| 42 | + composer config minimum-stability dev |
| 43 | + ``` |
| 44 | + |
| 45 | + - 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. |
| 46 | + |
| 47 | + - 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: |
| 48 | + |
| 49 | + ```bash |
| 50 | + composer config repositories.ext path "./ext/*/*/*" |
| 51 | + ``` |
| 52 | + |
| 53 | +1. Install the `pwa` metapackage: |
| 54 | + |
| 55 | + ```bash |
| 56 | + composer require magento/pwa |
| 57 | + ``` |
| 58 | + |
| 59 | +At this point, you should see symlinks for all the `pwa` modules inside the `vendor` directory. These symlinks allow you to: |
| 60 | + |
| 61 | +- Run a Magento installation with additional modules. |
| 62 | +- Develop locally using the standard git workflow. |
| 63 | + |
| 64 | +You may need to ensure that there are no `Magento_PWA*` modules listed as `enabled` when you run `bin/magento module:status`. If there are, [follow the docs on how to enable modules](https://devdocs.magento.com/guides/v2.3/extension-dev-guide/build/enable-module.html). |
| 65 | + |
| 66 | +### Setting up the Git workflow |
| 67 | + |
| 68 | +To improve the developer experience even further, you can add these configurations as well: |
| 69 | + |
| 70 | +1. Exclude all the `ext` directories in the project's `.git` configuration: |
| 71 | +
|
| 72 | + ```bash |
| 73 | + echo ext >> ./.git/info/exclude |
| 74 | + ``` |
| 75 | +
|
| 76 | +1. Skip your project's root directory `composer.\*` files to avoid committing them by mistake: |
| 77 | + |
| 78 | + ```bash |
| 79 | + git update-index --skip-worktree composer.json |
| 80 | + git update-index --skip-worktree composer.lock |
| 81 | + ``` |
| 82 | + |
| 83 | + NOTE: You can reverse this operation anytime as needed: |
| 84 | + |
| 85 | + ```bash |
| 86 | + git update-index --no-skip-worktree composer.json |
| 87 | + git update-index --no-skip-worktree composer.lock |
| 88 | + ``` |
| 89 | + |
| 90 | +## Cloud deployment extension installation |
| 91 | + |
| 92 | +1. Add https://repo.magento.com as a composer repository by adding the following to your cloud instances `composer.json` file. |
| 93 | + |
| 94 | + ```json |
| 95 | + "repositories": { |
| 96 | + "repo": { |
| 97 | + "type": "composer", |
| 98 | + "url": "https://repo.magento.com" |
| 99 | + } |
| 100 | + }, |
| 101 | + ``` |
| 102 | + |
| 103 | +1. Require in `magento/magento2-pwa` extension by adding the following to your cloud instances `composer.json` file. |
| 104 | + |
| 105 | + ```json |
| 106 | + "require": { |
| 107 | + "magento/magento2-pwa": "0.0.1" |
| 108 | + }, |
| 109 | + ``` |
| 110 | + |
| 111 | +1. Ensure your `auth.json` file has valid credential for `repo.magento.com`. |
| 112 | + |
| 113 | +1. Run `composer update` to update your `composer.lock` file. |
| 114 | + |
| 115 | +1. Push the changes and deploy your cloud instance. |
0 commit comments