跳到主要内容

Shoplazza CLI 命令参考

本参考文档列出了 Shoplazza CLI 中用于 app、theme、结账扩展及相关开发流程的命令。

这些命令使用语法 shoplazza [topic] [command]

命令概览

Topic 命令 说明
theme init Nova 2023 的 Git 仓库克隆到本地,作为构建 theme 的起点。
serve 将当前 theme 上传至店铺以便预览。
list 列出店铺中的所有 theme。
pull 从 Shoplazza 获取 theme 文件。
push 将本地 theme 文件上传至 Shoplazza,如指定则覆盖远程 theme。
share 将您的 theme 作为新的未发布 theme 上传至 theme 库。
publish 从 theme 库发布一个未发布的 theme。
package 将本地 theme 文件打包为可上传至 Shoplazza 的 ZIP 文件。
delete 从店铺中删除一个 theme。
none login 通过 Shoplazza CLI 对指定店铺进行身份验证并登录。
logout 退出 Shoplazza 账号。
switch 无需退出并重新登录即可切换店铺。
store 显示当前连接的店铺。
version 显示当前运行的 Shoplazza CLI 版本。
help 列出可用命令并说明其功能。
app init 初始化新应用项目。创建新应用项目,或连接现有应用项目。
generate extension 生成 extension template。为现有应用添加新 extension。
dev 启动本地开发服务器。本地开发与调试。
deploy 将应用部署到生产环境。将应用发布到生产环境。
app config link 链接应用配置文件。将现有应用连接到本地项目。
config use 切换应用配置文件。在多个应用配置之间切换。
versions list 查看应用版本列表。管理应用版本历史。

Theme 命令详情

init

Nova 2023 的 Git 仓库克隆到本地,作为构建 theme 的起点。

shoplazza theme init

serve

将当前 theme 作为指定 theme 或开发 theme 上传至店铺以便预览。

此命令返回以下信息:

  • 可与其他开发者共享的预览链接。
  • Shoplazza 管理后台中该 theme 的编辑器链接。

此命令只能在符合 Shoplazza 默认 theme 文件夹结构的目录中运行。

shoplazza theme serve

serve 参数

参数说明
--theme <THEME_ID>要预览的 theme ID。若未使用此参数,则使用新建或现有的开发 theme 进行预览。

list

列出店铺中的所有 theme,以及其 ID 和状态。

shoplazzza theme list

pull

从 Shoplazza 获取 theme 文件。

如果未指定 theme,系统会提示您从店铺的 theme 列表中选择要拉取的 theme。

shoplazza theme pull

pull 参数

参数说明
--theme <THEME_ID>要拉取的 theme 的 ID

push

将本地 theme 文件上传至 Shoplazza,如指定则覆盖远程版本。

如果未指定 theme,系统会提示您从店铺的 theme 列表中选择要覆盖的 theme。

此命令只能在符合 Shoplazza 默认 theme 文件夹结构的目录中运行。

shoplazza theme push

push 参数

参数说明
--theme <THEME_ID>要覆盖的 theme 的 ID

share

将您的 theme 作为新的未发布 theme 上传至 theme 库。该 theme 将获得随机名称。

此命令返回一个可与他人共享的预览链接。

shoplazza theme share

publish

从 theme 库发布一个未发布的 theme。

如果未指定 theme ID,系统会提示您从店铺的 theme 列表中选择要发布的 theme。

此命令只能在符合 Shoplazza 默认 theme 文件夹结构的目录中运行。

如果您想发布本地 theme,需先运行 shoplazza theme push。系统会要求您确认是否发布指定的 theme。

shoplazza theme publish

publish 参数

参数说明
--theme <THEME_ID>要发布的 theme 的 ID

package

将本地 theme 文件打包为可上传至 Shoplazza 的 ZIP 文件。

所有文件夹都会包含在包中。

ZIP 文件名格式为 theme_name-theme_version.zip,基于 settings_schema.json 文件中的参数。

shoplazza theme package

delete

从店铺中删除一个 theme。

您可以通过 ID 指定 theme。如果未指定 theme,系统会提示您从店铺的 theme 列表中选择要删除的 theme。

在删除前,系统会要求您确认是否删除指定的 theme。

shoplazza theme delete

delete 参数

参数说明
--theme <THEME_ID>要删除的 theme 的 ID

App 命令详情

app Init

创建新应用项目,或连接现有应用项目。

shoplazza app init

Init 参数

参数 说明
--path <path> 指定项目创建路径(默认:当前目录)
--client-id <client-id> 指定要连接的现有应用的 client ID
--name <name> 指定应用名称

generate extension

为现有应用生成新的 extension template,支持多种 extension 类型。

shoplazza app generate extension

generate extension 参数

参数 说明
--path <path> 指定项目路径(默认:当前目录)

dev

启动本地开发服务器。

shoplazza app dev

dev 参数

参数 说明
--path <path> 指定项目路径(默认:当前目录)

deploy

将应用部署到生产环境。

shoplazza app deploy

deploy 参数

参数 说明
--path <path> 指定项目路径(默认:当前目录)

将现有 Shoplazza 应用链接到本地项目,创建配置文件。

shoplazza app config link
参数 说明
--path <path> 指定项目路径(默认:当前目录)
--client-id <client-id> 指定要链接的应用的 client ID

config use

在项目中的多个应用配置文件之间切换,激活指定配置。

shoplazza app config use

config use 参数

参数 说明
--path <path> 指定项目路径(默认:当前目录)

versions list

查看应用所有已部署版本,支持分页和详细信息展示。

shoplazza app versions list

versions list 参数

参数 说明
--path <path> 指定项目路径(默认:当前目录)
--page-size <number> 每页显示的版本数量(默认:10)

无前缀命令详情

login

登录 Shoplazza 账号。

shoplazza login

login 参数

参数 说明
--store <store>
用于预览 theme 的开发店铺。
--store 参数接受以下输入:
  • 店铺前缀,例如 my-store.myshoplaza.com
  • Shoplazza URL,例如 https://my-store.myshoplaza.com

logout

退出 Shoplazza 账号。

shoplazza logout

switch

无需退出并重新登录即可切换店铺。

如果不带 --store 参数输入此命令,系统会提示您选择与账号关联的店铺。

shoplazza switch

switch 参数

参数 说明
--store <store>
用于切换 theme 的开发店铺。
--store 参数接受以下输入:
  • 店铺前缀,例如 my-store.myshoplaza.com
  • Shoplazza URL,例如 https://my-store.myshoplaza.com

store

显示当前连接的店铺。

shoplazza store

version

显示当前运行的 Shoplazza CLI 版本。

shoplazza version

help

列出可用命令并说明其功能。

shoplazza help

您还可以使用 help 命令或选项获取特定命令的详细信息:

shoplazza help [command]

或者,

shoplazza [command] --help

或者,

shoplazza [command] -h