Shoplazza CLI is a command-line interface tool that helps you build Shoplazza themes. It quickly generates Shoplazza themes. You can also use it to automate many common development tasks.
Shoplazza CLI is a cross-platform command line tool that you can use to build Shoplazza themes.
Shoplazza CLI accelerates your theme development process with the following features:
- Safely preview, test, and share changes to themes using unpublish themes
- Hot reload CSS and section changes, or automatically refresh a page on file change, when previewing a theme.
- Initialize a new theme using Nova 2023 as a starting point.
- Use workflow tools like Git to work with a team of theme developers.
- Upload themes to your store.
- Watch for local changes and upload them automatically to Shoplazza.
- Work on Linux, macOS, and Windows.
- Support customized Checkout page.
Installation shoplazza-cli
$ npm install shoplazza-cli -g
Before you start using Shoplazza CLI to develop themes, make sure that you do the following tasks:
- Install Node.js (20.18.0).
- Install Git.
- Make sure that you have a account with the Manage themes permission for the store that you want to work on, or you're the owner of the store.
- Note the URL of the store that you want to work on.
- Make sure that you're connected to the internet. Most Shoplazza CLI commands need an internet connection to run.
You can use Shoplazza CLI to develop checkout, customized checkout page as you want.
- 支持本地开发和调试,支持热更新。
- 支持预览,在推送到店铺之后,通过预览链接进入可以进行预览。
- 支持部署extension,部署后所有用户都能看到变更。
- 支持下线extension,下线之后extension将不在店铺中生效。
创建过程会要求你输入店铺地址和token,token可以在后台中应用->管理私有应用->创建应用 获得。创建过程还要求你输入一个extension名字,一个项目下支持存在多个extension,这是为了方便管理,它们互不影响。
shoplazza checkout create
// 安装依赖
npm i
extension支持本地开发,支持在线上店铺Checkout页面插入本地的extension代码,这仅在你的浏览器生效。 首先,先启动本地开发服务器:
shoplazza checkout dev
然后在checkout页面打开控制台切换为开发模式:
CheckoutAPI.extension.DEV_switchDevMode()
在checkout页面即可看到extension变更。
在完成本地开发之后,我们可以将extension推送到店铺进行预览。
shoplazza checkout push
访问预览url即可看到效果。
在预览测试完成之后,可以在店铺发布extension,发布之后所有用户都可以看到。
shoplazza checkout deploy
或者对将已发布的extension下线:
shoplazza checkout undeploy
shoplazza checkout list
// 查看所有
shoplazza checkout list -a
shoplazza checkout preview
$ shoplazza login --store developer.myshoplaza.com
In your browser window, log into the account that's attached to the store that you want to use for development.
$ shoplazza theme init
Use
shoplazza theme init
to create a new theme on your local machine. This command clones a Git repository to your local machine to use as the starting point for building a theme.
$ shoplazza theme pull
Pull the theme onto your local machine using
shoplazza theme pull
. You're prompted to select a theme from the list of themes on the store.
$ shoplazza theme serve
After you create or navigate to your theme, you can run
shoplazza theme serve
to interact with the theme in a browser.
$ shoplazza theme push
Use
shoplazza theme push
to upload your local theme files to Shoplazza, overwriting the remote versions.
$ shoplazza theme publish
Use
shoplazza theme publish
to select and publish an unpublished theme from your theme library. If you want to publish your local theme, then you need to runshoplazza theme push
first.
$ shoplazza theme list
You might want to use a theme's ID to pull, push, publish, or delete a theme using Shoplazza CLI.
$ shoplazza help
Lists the available commands and describes what they do.
$ shoplazza login --store developer.myshoplaza.com
$ shoplazza login --partner
--store: Authenticates and logs you into the specified store with Shoplazza CLI. --partner: Authenticates and logs you into the partner with Shoplazza CLI.
$ shoplazza logout
$ shoplazza logout --partner
Default to logout your store, logs you out of the Shoplazza account and store, the logout command clears credentials. You need to reauthenticate the next time that you connect to a store. --partner: Clear your partner info, and you need to reauthenticate the next time.
$ shoplazza switch --store developer.myshoplaza.com
Switches between stores without logging out and logging in again.
$ shoplazza store
Displays the store that you're currently connected to.
$ shoplazza version
Displays the version of Shoplazza CLI that you're running.
$ shoplazza theme init [--name]
Clones a Git repository to your local machine to use as the starting point for building a theme.
$ shoplazza theme serve [--theme]
Uploads the current theme to the store that you're connected to, and returns the preview link.
$ shoplazza theme list
Lists the themes in your store, along with their IDs and statuses.
$ shoplazza theme pull [--theme]
Retrieves theme files from Shoplazza, if no theme is specified, then you're prompted to select the theme to pull from the list of the themes in your store.
$ shoplazza theme push [--theme]
Uploads your local theme files to Shoplazza, overwriting the remote theme if specified, if no theme is specified, then you're prompted to select the theme to overwrite from the list of the themes in your store.
$ shoplazza theme share
Uploads your theme as a new, unpublished theme in your theme library. The command return a preview link that you can share with others.
$ shoplazza theme publish [--theme]
Publishes an unpublished theme from your theme library, if no theme ID is specified, then you're prompted to select the theme that you want to publish from the list of themes in your store.
$ shoplazza theme package
Packages your local theme files into a ZIP file that can be uploaded to Shoplazza. The ZIP file uses the name theme_name-theme_version.zip, based on parameters in your
settings_schema.json
file.
$ shoplazza theme delete [--theme]
Deletes a theme from your store, if no theme is specified, then you're prompted to select the theme that you want to delete from the list of themes in your store.
$ shoplazza app generate extension
Choose Your app type and download template.
$ shoplazza app build
Minify css / js files and generate manifest.json and zip.
$ shoplazza app deploy extension
Deploy your zip to oss for publish.
$ shoplazza app publish extension
Choose your extension version and publish to your store.
You can run certain theme commands, such as shoplazza theme serve, only if the directory you're using matches the default Shoplazza theme directory structure. This structure represents a buildless theme, or a theme that has already gone through any necessary file transformations. If you use build tools to generate theme files, then you might need to run commands from the directory where the generated files are stored.
The default Shoplazza theme directory structure is as follows:
└── project
├── assets
├── config
├── layout
├── locales
├── sections
├── snippets
└── templates
You should expect mostly good support for the CLI below. This does not mean we won't look at issues found on other command line - feel free to report any!
- Mac OS
- Terminal.app
- iTerm
- Windows (Known issues):
- ConEmu
- cmd.exe
- Powershell
- Cygwin
- Linux (Ubuntu, openSUSE, Arch Linux, etc):
- gnome-terminal (Terminal GNOME)
- konsole