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.

  1. Log into your User Portal account by following the instructions here.

  2. Select the instance you would like to know access details for in the instance drop-down.

  3. Open the GitHub Management tab in the Application Management section.

  4. 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.

  1. Add a user by clicking Add User button in the GitHub Management tab in the Application Management section.

  2. 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.

  3. Click Add User.

Set up Git locally

You must have Git set up locally to perform the local setup.

  1. Go to the directory where you will perform the local setup.

  2. 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"

  3. Enter the file name in which to save the generated key.

  4. 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

  1. 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

  2. Install the following prerequisites.

Cloning repository

  1. 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

  1. Open a terminal and navigate to cloned repository folder: cd scandipwa

  2. Run command npm install and wait for this process to finish.

  3. Run command BUILD_MODE=magento npm run start. Wait for this process to finish.

Setting up Magento 2 locally and connecting it with ScandiPWA

  1. Open a new terminal window and navigate to the cloned repository folder.

  2. Run command npm install Wait for this process to finish.

  3. Run command npm i @scandipwa/magento-scripts@latest Wait for this process to finish.

  4. Run command npm run start

  5. 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:

configuration: {
  extensions: {
    fileinfo: {}
  }
}

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.

  1. Once the local setup is done you can make changes to your project files. Learn more on how to develop the ScandiPWA theme here.

  2. 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

  3. 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:

git add .

To add specific files to your commit you need to specify a path to it, for example,

git add app/etc/config.php

Commit your changes (replace Commit Message description for your changes):

git commit -m "Commit Message"

Push your changes to GitHub:

git push

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:

bin/magento c:c

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:

  1. Log into your User Portal account following these instructions.

  2. Select the instance you would like to know access details for in the instance drop-down.

  3. Open the Deployments tab in the Application Management section.

  4. 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.

  1. Log into your User Portal account following these instructions.

  2. Select the instance you would like to know access details for in the instance drop-down.

  3. Open the Deployments tab in the Application Management section.

  4. Click the Start Deployment button.

  5. You can check your deployment status in the Deployments tab.

Last updated