App Command Usage Guide

Overview

The shoplazza app command is the core command group within the Shoplazza CLI, designed for developing and managing Shoplazza applications. It provides comprehensive support for the entire application development lifecycle, from project initialization to deployment and publishing.

Prerequisites

Before using the shoplazza app commands, ensure that you have:

  1. Installed Node.js (supported version: v20.9.0/v20.18.0)
  2. Installed Git
  3. Installed the newest version Shoplazza CLI
npm i -g shoplazza-cli

App Command Overview

Command

Function Description

Usage Scenario

shoplazza app init

Initialize a new application project

Create a new application project,
or connect an existing application project.

shoplazza app generate extension

Generate an extension template

Add new extensions to an existing application

shoplazza app dev

Start a local development server

Local development and debugging

shoplazza app deploy

Deploy the application to the
production environment

Publish the application to production.

shoplazza app config link

Link an application configuration file

Connect an existing application to a local project

shoplazza app config use

Switch between application configuration files

Switch between multiple application configurations

shoplazza app versions list

View the list of application versions

Manage application version history

App Command Descriptions

shoplazza app init - Initialize Application Project

Function:

  • Create a new Shoplazza application project, including project templates and configuration files. Or connect an existing application project.

Usage Scenarios:

  • Starting development of a new Shoplazza application, andcreate an application project from scratch
  • Connect to an existing application project

Command Format:

shoplazza app init [options]

Flags:

Flag Description
--path <path> Specify the project creation path (Default: Current directory)
--client-id <client-id> Specify the client ID of the existing application to connect to
--name <name> Specify the application name

Usage Examples:

# Create a new application in the current directory:  
shoplazza app init  

# Create a new application in a specified directory:  
shoplazza app init --path ./my-new-app  

# Create a new application with a specified name:  
shoplazza app init --name "your_app_name"  

# Connect to an existing application:  
shoplazza app init --client-id your-client-id

shoplazza app generate extension - Generate Extension Template

Function:

  • Generate a new extension template for an existing application, supporting various types of extensions.
    Usage Scenarios:
  • Adding new features to an existing application
  • Creating theme extensions, checkout extensions, or function extensions

Command Format:

shoplazza app generate extension [options]

Flags:

Flag Description
--path <path> Specify the project path (Default: Current directory)

Supported Extension Types:

  • Theme Extension:
    Provide a way to extend and customize theme pages, integrating with Online Store themes. Theme App Extensions act as a replacement for using Script to integrate apps with online stores.
  • Checkout Extension:
    Allow developers to customize the checkout page, including hiding certain modules, modifying product information, address details, shipping information, payment details, and order result information. You can also insert custom content.
  • Function Extension:
    Allow developers to define custom logic for calculating shopping cart prices. When a cart-transformfunction is bound to a cart price modification point, Shoplazza automatically executes the bound function code during the cart or checkout phase, dynamically adjusting pricing strategies through update operations.

Usage Examples:

# Generate a new extension in the current project:  
shoplazza app generate extension

# Generate a new extension in a specified project:  
shoplazza app generate extension --path ./my-app

shoplazza app dev - Local Development

Function:

  • Start a local development server

Usage Scenarios:

  • Local development and debugging of applications
  • Testing extension functionalities

Command Format:

shoplazza app dev  

Flag

Flag Description
--path <path> Specify the project path (Default: Current directory)

shoplazza app deploy - Deploy Application

Function:

  • Deploy the application to the production environment, making it live in the Shoplazza Store.

Usage Scenarios:

  • Publishing a completed application to the production environment
  • Updating existing application versions

Command Format:

shoplazza app deploy [options]

Flag

Flag Description
--path <path> Specify the project path (Default: Current directory)

Usage Examples:

# Deploy the application:  
shoplazza app deploy

# Deploy a specified project:  
shoplazza app deploy --path ./my-app

shoplazza app config link - Link Application Configuration

Function:

  • Link an existing Shoplazza application to a local project, creating a configuration file.

Usage Scenarios:

  • Connecting an existing application to the local development environment
  • Creating a local configuration file for an existing application
  • Managing multiple application configurations within a local project

Command Format:

shoplazza app config link [options]

Flag

Flag Description
--path <path> Specify the project path (Default: Current directory)
--client-id <client-id> Specify the client ID of the application to link

Usage Examples:

# Link an application configuration:  
shoplazza app config link

# Link a specified application:  
shoplazza app config link --client-id your-client-id

#Link in a specified directory:  
shoplazza app config link --path ./my-project

shoplazza app config use - Switch Application Configuration

Function:

  • Switch between multiple application configuration files within a project, activating the specified configuration.

Usage Scenarios:

  • Managing multiple application configurations within a project
  • Switching between different applications for development

Command Format:

shoplazza app config use [options]

Flag

Flag Description
--path <path> Specify the project path (Default: Current directory)

Usage Examples:

# Switch application configuration:  
shoplazza app config use

# Switch configuration in a specified project:  
shoplazza app config use --path ./my-project

shoplazza app versions list - View Application Versions

Function:

  • View all deployed versions of the application, supporting pagination and detailed information display.

Usage Scenarios:

  • Viewing application version history
  • Understanding version deployment status

Command Format:

shoplazza app versions list [options]

Flag

Flag Description
--path <path> Specify the project path (Default: Current directory)
--page-size <number> Number of versions to display per page (Default: 10)

Usage Examples:

# View the version list:  
shoplazza app versions list

# Specify the number of versions displayed per page:  
shoplazza app versions list --page-size 50

# View versions of a specified project:  
shoplazza app versions list --path ./my-app

Configuration Files Explanation

shoplazza.app.toml Application Configuration File

This is the core configuration file for the application, containing essential application information:


# Application Client ID (Required)

client_id = "your-client-id"

# Application Permission Scopes

scopes = "read_customer write_cart_transform"

shoplazza.extension.toml Extension Configuration File

Each extension has its own configuration file:

# Extension ID (Generated by the system)

id = "extension-id"

# Extension Name

name = "My Extension"

# Extension Type (theme/checkout/function)

type = "theme"