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:
- Installed Node.js (supported version: v20.9.0/v20.18.0)
- Installed Git
- Installed the newest version Shoplazza CLI
npm i -g shoplazza-cliApp Command Overview
Command | Function Description | Usage Scenario |
|---|---|---|
Initialize a new application project | Create a new application project, | |
Generate an extension template | Add new extensions to an existing application | |
Start a local development server | Local development and debugging | |
Deploy the application to the | Publish the application to production. | |
Link an application configuration file | Connect an existing application to a local project | |
Switch between application configuration files | Switch between multiple application configurations | |
View the list of application versions | Manage application version history |
App Command Descriptions
shoplazza app init - Initialize Application Project
shoplazza app init - Initialize Application ProjectFunction:
- 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-idshoplazza app generate extension - Generate Extension Template
shoplazza app generate extension - Generate Extension TemplateFunction:
- 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-appshoplazza app dev - Local Development
shoplazza app dev - Local DevelopmentFunction:
- 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
shoplazza app deploy - Deploy ApplicationFunction:
- 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-appshoplazza app config link - Link Application Configuration
shoplazza app config link - Link Application ConfigurationFunction:
- 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-projectshoplazza 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-projectshoplazza app versions list - View Application Versions
shoplazza app versions list - View Application VersionsFunction:
- 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-appConfiguration Files Explanation
shoplazza.app.toml Application Configuration File
shoplazza.app.toml Application Configuration FileThis 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
shoplazza.extension.toml Extension Configuration FileEach 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"Updated about 1 month ago
