Code customization and local setup
You have full access to project source code through GitHub.
Access your GitHub repository
Code changes can only be done by making commits to your GitHub repository. It is not possible to make code changes through SSH or SFTP.
All your environment source code is managed in a single GitHub repository. Each environment has its own branch.
Log into your User Portal account by following the instructions here.
Select the instance you would like to know access details for in the instance drop-down.
Open the GitHub Management tab in the Application Management section.
Here you will find the URL to your project GitHub repository and the branch name where the source code for the selected instance is managed.
Only GitHub users added to the GitHub Management tab can access, clone, and make changes to the repository. You can select the access level of the user - Write, Read, or Triage.
Add a user by clicking Add User button in the GitHub Management tab in the Application Management section.
Enter the existing Git username and a select role that will control the access level of the user:
Write: Recommended for contributors who actively push code changes to your project Read: Recommended for non-code contributors who want to view or discuss your project
Triage: Recommended for contributors who need to proactively manage issues and pull requests without writing access If you plan to make code changes select the Write role.
Click Add User.
Set up Git locally
You must have Git set up locally to perform the local setup.
Go to the directory where you will perform the local setup.
Run the following commands:
git init
git config user.name “YOUR-GITHUB-USERNAME”
git config user.email “YOUR-EMAIL-ADDRESS”
ssh-keygen -t rsa -C "YOUR-EMAIL-ADDRESS"
Enter the file name in which to save the generated key.
Copy the content from the generated file with .pub type and save it in your GitHub profile following these instructions.
Local setup
Local setup is supported by Linux and Mac operating systems.
Important! You must use your project GitHub repository when following the instructions.
Installing prerequisites
Make sure that you have Node.js with a version higher or equal to 12.20 installed on your local development machine. You can check it by running this command from the terminal:
node -v
Install the following prerequisites.
Cloning repository
Clone project from your ReadyMage GitHub repository, for example:
git clone git@github.com:scandipwacloud/readymage-help-demo-1119750197.git
IMPORTANT! Make sure to clone the repository to an empty directory path.
How to set ScandiPWA locally
Open a terminal and navigate to cloned repository folder:
cd scandipwa
Run command
npm install
and wait for this process to finish.Run command
BUILD_MODE=magento npm run start
. Wait for this process to finish.
Setting up Magento 2 locally and connecting it with ScandiPWA
Open a new terminal window and navigate to the cloned repository folder.
Run command
npm install
Wait for this process to finish.Run command
npm i @scandipwa/magento-scripts@latest
Wait for this process to finish.Run command
npm run start
Run commands:
npm run cli magento in:rei magento c:c
You should now have URLs given in the terminal using which you can access Frontend and Admin Panel.
Import environment database and media in your local setup by following these instructions:
Known Issues and Solutions
fileinfo extension not available. Follow this guide to install the missing extension.
Add fileinfo to you cma.js file like this:
Run npm start
command.
Making code changes
Code changes can only be done by making commits to your GitHub repository. It is not possible to make code changes through SSH or SFTP.
Git must be installed on your local machine and you must have a Git account created. Follow these instructions to install Git.
Once the local setup is done you can make changes to your project files. Learn more on how to develop the ScandiPWA theme here.
Before making changes make sure to switch to the specific environment branch you want to make changes to by running the following commands. Switch to your environment branch (replace
master
with branch name you want to make changes to):git checkout master
Pull the latest code from the GitHub repository:git pull
When you are happy with your changes locally you must push them to your environment branch using the following instructions:
To add all changes to your commit:
To add specific files to your commit you need to specify a path to it, for example,
Commit your changes (replace Commit Message description for your changes):
Push your changes to GitHub:
4. After you push your changes to GitHub they will be deployed automatically to your environment. Automatic deployments can be disabled and manual deployments can be used instead if you don't want to deploy on every code push. Follow the instructions here to do it. 5. If you see a blank page on your frontend after deployment run the Magento cache clear command through SSH:
Follow these instructions to install extensions:
Deployments
ReadyMage provides 2 ways to deploy code changes to your environment - automatic and manual.
Automatic deployments
Automatic deployments are enabled by default. Code changes are deployed automatically to your environment on every push GitHub. You can disable or enable deployments by following these instructions:
Log into your User Portal account following these instructions.
Select the instance you would like to know access details for in the instance drop-down.
Open the Deployments tab in the Application Management section.
Use the Automatic Deployments toggle to enable or disable them.
Manual deployments
If you have disabled automatic deployments only way to deploy code changes is by initiating manual deployment.
Log into your User Portal account following these instructions.
Select the instance you would like to know access details for in the instance drop-down.
Open the Deployments tab in the Application Management section.
Click the Start Deployment button.
You can check your deployment status in the Deployments tab.
Last updated