How To Contribute
Last updated
Last updated
Topics covered in this tutorial:
The first thing you need to do is make sure you have forked and cloned the scandipwa-base
project.
First, let’s open up the terminal and navigate to the project’s directory.
Previously, in the Linux Docker set-up we already created aliases for docker-compose
commands. Here’s a little refresher:
We can also look for a specific alias by piping:
If we want to contribute we run:
Instead of the docker-compose.frontend.yml
we use docker-compose.core.yml
, where core
stands for contribution.
Before this, though, we need to make sure that we’ve cloned our theme in the correct place.
Let’s make a new folder in the scandipwa-base/src
folder. We’ll use this later for composer packages in order to locally connect to them.
Next, we need to fork the ScandiPWA base theme and clone it in the src/localmodules
folder.
After returning to the scandipwa-base
folder we need to run one of our previously aliased commands in order to recreate the docker set-up without front-end:
You can read more about the docker-compose up
command here.
Next, we use applogs
to check-out the last 100 lines of app container logs.
If you see the Connection to Redis failed
error, you need to force-recreate:
Next we run the inapp
alias to get inside of the app container and execute an interactive bash
shell in it:
Let’s go to the localmodules/base-theme/
folder and run npm ci
to get a clean install of the necessary dependencies.
After installing the modules we can exit
the app for now. Now, back in the scandipwa-base
folder run the following to compose the core contribution file:
The docker-compose.core.yml
and docker-compose.frontend.yml
files are the same except for the command pm2-watch
, which in the core
file is replaced by dev-server-core
.
In frontend
the vendor folders are mapped, however, in core
only the base-theme
is mapped.
This is because a fall-back mechanism is not needed when you’re contributing - every file in the theme is present.
Note:
Never use docker-compose.core.yml
and docker-compose.frontend.yml
at the same time.
Next, use frontlogs
to see if core
has compiled and type scandipwa.local
in your browser to check-out if everything is working.
Next, using whatever text editor you fancy, open the folder src/local-modules/base-theme
and start customising!
Note:
Your feature branches must be made from the stable branch
Note that any contributions must be made to the stable branch, which at this point is 2.x-stable
.
So, after you’ve made the changes save them, checkout
to the latest stable branch and git stash pop
The standard sequence after making changes:
Check-out the git reference here.
After doing this you can commit as usual:
After this you should see in your GitHub account and create a pull request. Then the pull request will be reviewed by our fabulous maintainers and either be approved or closed.
Clone the repo the same way as previously, you can choose e.g. store-graphql
.
If you want to contribute to one of the back-end features, you have to select a one patch number higher than that of the available ones.
So if the latest release is 1.0.2, yours will be 1.0.3
First we need to find out which version we currently have, so let’s enter the container:
At this current time latest version is 1.0.2
Or in this specific case:
So now we need to make sure that store is installed on our local system as a higher version.
Using a text editor open src/localmodules/store-graphql
open composer.json
file and specify a new version, in this case 1.0.3
.
Note:
Do not commit the composer.json
changes.
Next, let’s update:
After this the src/localmodules/store-graphql
will be symlinked with the vendor folders. This way any change you perform on the origin folder will be reflected in Magento.
After making changes, exit
the container and go to the store-graphql
directory.
We can check out if our changes are registered by using git status
, in fact can use git status
any time to see what the state of our commit is.
After this we can use a similar sequence as previously:
After this we can go to our GitHub account and open a pull request.