Skip to content
Last update: October 7, 2024

Deploy Module from Source Code

This guide provides step-by-step instructions on how to deploy a Virto Commerce module from its source code. Follow the steps to set up the module locally, build it, configure it, and test it properly.

Install

To get started with the module locally, ensure the following steps are completed:

  1. Ensure that Virto Commerce Platform is installed.
  2. Fork the latest version of the module source code from the repository:
    https://github.com/VirtoCommerce/{module-name}.git
    
  3. Clone the repository to your local machine using git:
    git clone https://github.com/VirtoCommerce/{module-name}.git
    

Build module

This section explains how to build the module for both backend and frontend components.

Build backend

You can build the backend either using the command line or through Visual Studio.

  1. Open your console and navigate to the backend project folder:

    cd src/VirtoCommerce.{module-name}.Web
    
  2. Build the project using the following command:

    dotnet build -c Development
    
  1. Open the VirtoCommerce.{module-name}.sln file in Visual Studio.
  2. Build the solution using the Build Solution option.

Build frontend

When building the module for the first time in Visual Studio, npm references will be installed, and Webpack will be executed automatically. This is managed by the VirtoCommerce.BuildWebpack NuGet package, which adds Webpack build targets to the project.

If you modify the frontend, you will need to manually rebuild the frontend to create the necessary style and script bundles.

To build the frontend locally:

  1. Open the console and navigate to the frontend project folder:
    cd src/VirtoCommerce.{module-name}.Web
    
  2. Install all required dependencies:
    npm ci
    
  3. Build the frontend application:
    npm run webpack:build
    
  4. To watch for changes during development:
    npm run webpack:watch
    

Perform initial configuration

After building the module, configure it by linking the module directory to the platform. This allows the platform to read the module's manifest and load it:

mklink /d VirtoCommerce.Platform.Web\Modules\VirtoCommerce.{module-name} src\VirtoCommerce.{module-name}.Web

Run module

Restart the Virto Commerce Platform to load the newly built module into the platform's application process.

Debug backend

To debug backend:

  1. Make sure the platform is installed and running.
  2. Open the module solution in Visual Studio.
  3. Attach the debugger to the VirtoCommerce.Platform.Web.exe process.

image

Debug frontend

Frontend debugging can be done in Chrome Developer Tools:

  1. Open Chrome and access the Developer Console.
  2. Navigate to the Sources tab.
  3. In the file navigator, go to {module-name}/./Script/ to view the source files.

image

Test

You can run tests for the module locally. The test suites are located in the tests folder, where you can execute them as needed.