Magento PWA Studio is a collection of tools that lets developers build complex Progressive Web Applications on top of Magento 2 stores.
The PWA Studio project welcomes all codebase and documentation contributions. We would like to recognize the following community members for their efforts on improving the PWA Studio project:
mage2pratik | vdiachenko | jissereitsma | rossmc |
bobmotor | gavin2point0 | neeta-wagento | mtbottens |
Jakhotiya | JStein92 | bgkavinga | philwinkle |
bobbyshaw | matthewhaworth | shakyShane | Igloczek |
mhhansen | rowan-m | artKozinets | camdixon |
For more information about contributing to this repository, see the Contribution guide.
To ease local development, testing, and versioning, the PWA Studio project uses a monorepo, with package management orchestrated by lerna.
All packages are versioned in a single repo, but released to npm
as independent packages.
This repository includes the following packages managed by lerna:
- venia-concept - Reference/Concept Storefront
- pwa-buildpack - Build tooling
- peregrine - eCommerce Component Library
- upward-js - Reference implementation of the UPWARD specification
- upward-spec - UPWARD specification and test suite
This repository also includes modules that are not managed by Lerna, because they are not meant to be distributed via NPM, and/or they should not have their dependencies centrally managed by Lerna.
- pwa-devdocs - Project source for the documentation site
PWA Studio 2.0 requires much less setup than PWA Studio 1.0. The UPWARD architecture means that the Magento instance does not need to be configured to use your project as a theme. Instead, you connect to your Magento instance by simply specifying its URL in your environment.
-
Make sure the Magento instance you're using is set to development mode, and has the latest 2.3.
- You need development mode for GraphQL introspection queries to work.
- The latest codebase will have the most up-to-date GraphQL schema.
-
Ensure that the Venia sample data is installed on the Magento instance. (TODO: painless instructions for the Composer commands to do that)
One simple way to obtain Magento 2.3 is using the Core Contributor Vagrant box.
-
Clone the https://github.com/paliarush/magento2-vagrant-for-developers/ repository and follow the setup instructions.
-
Make sure that all sample data auto-installation parameters in the config.yaml file are disabled.
-
When installation is complete, then install the Venia sample data. Copy this shell script and save it in your Magento root directory as
installVeniaSampleData.sh
. -
Run
vagrant ssh
to login to the Magento VM. -
Run
bash installVeniaSampleData.sh
. The Venia sample data should install, and the Vagrant host is ready to use. -
Update your
.env
file in PWA Studio to setMAGENTO_BACKEND_URL
to the URL of the Vagrant box.
Note: You must have a version of node.js
>= 8.0.0
, and a version of npm
>= 5.0.0
. The latest LTS versions of both are recommended.
Follow these steps to install the dependencies for all the packages in the project:
- Clone the repository.
- Navigate to the root of the repository from the command line
- Run
npm install
- Copy
packages/venia-concept/.env.dist
topackages/venia-concept/.env
- Uncomment the line for
MAGENTO_BACKEND_URL
inpackages/venia-concept/.env
, and setMAGENTO_BACKEND_URL
to the fully-qualified URL of a Magento store running2.3
. - On your first install, run
npm run build
from package root. - To run the Venia storefront development experience, run
npm run watch:venia
from package root.
Make sure you have created a .env
file in packages/venia-concept
which specifies variables for your local development environment. You can copy from the template packages/venia-concept/.env.dist
.
Venia and its GraphQL queries may be out of sync with the schema of your connected Magento instance. Make sure the Magento instance is up to date with the 2.3 development branch, and your copy of this repository (or your dependency on it) is up to date.
Generating certificates is handled by devcert. If you're on a Linux machine make sure that libnss3-tools
(or whatever the equivalent is) is installed on your system. Further information provided in this section of the devcert readme.
To test whether your queries are up to date, run npm run validate-queries
at project root.
- Our monorepo is set up so that
npm install
can cross-link dependencies (such as Venia's dependency on Buildpack) without any extra tools. Do not runlerna bootstrap
. - All devDependencies are installed in the repository root. This means that all scripts must be run from repository root; otherwise, the locally installed CLI commands they use will not be available.
- Production dependencies are sometimes installed in child packages, but for some projects, such as Venia, it makes no sense to have production dependencies, because of bundling.
- Don't check in a big change to
package-lock.json
, and don't check in anypackage-lock.json
files but the root one. - Make sure to run
npm run prettier
andnpm run lint
before any commit you intend to push. You may want to set up a Git hook for this.