shoplazza-cli 1.0.7-beta.4 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -56,9 +56,9 @@ You can use Shoplazza CLI to develop checkout, customized checkout page as you
56
56
  #### Step 1: 创建一个项目模板
57
57
 
58
58
  创建过程会要求你输入店铺地址和token,token可以在后台中应用->管理私有应用->创建应用 获得。创建过程还要求你输入一个extension名字,一个项目下支持存在多个extension,这是为了方便管理,它们互不影响。
59
- ```
59
+ ```bash
60
60
  shoplazza checkout create
61
- // 安装依赖
61
+ # 安装依赖
62
62
  npm i
63
63
  ```
64
64
 
@@ -164,6 +164,87 @@ $ shoplazza theme list
164
164
 
165
165
  > You might want to use a theme's ID to pull, push, publish, or delete a theme using Shoplazza CLI.
166
166
 
167
+
168
+
169
+ ## Theme Extension Develop
170
+
171
+ ### Overview
172
+
173
+ Theme Extension is a method provided by Shoplazza for extending and customizing themes. Developers can use Theme Extensions to enhance and tailor theme pages.
174
+
175
+ ### Create an Extension
176
+
177
+ ```bash
178
+ shoplazza te create
179
+ ```
180
+
181
+ When creating a new Theme Extension, you will be prompted to choose between two types: **Basic Extension** and **Embed Extension**.
182
+
183
+ - **Basic Extension**: Allows modifying insertion positions via the theme editor.
184
+ - **Embed Extension**: Insertion positions are hard-coded within the Extension.
185
+
186
+ ### Start Development
187
+
188
+ ```bash
189
+ cd your-project # Navigate to the project directory
190
+ shoplazza te serve
191
+ ```
192
+
193
+ Since the Extension is displayed on theme pages, so you need to select a theme for preview. A preview link will be provided after selection.
194
+
195
+ - **First link**: Redirects to the theme editor. You can add the Extension to theme pages here. After adding, save the changes to preview on the client side.
196
+ - **Second link**: Redirects to the storefront preview page. After adding the Extension via the editor, any local code updates will take effect upon refreshing the storefront page.
197
+
198
+ ### Build for Production
199
+
200
+ ```bash
201
+ shoplazza te build
202
+ ```
203
+
204
+ Generates a deployable production build from the current project code. Multiple builds can be created, and one can be selected during deployment.
205
+
206
+ ### Deploy an Extension
207
+
208
+ To deploy an Extension to your store:
209
+
210
+ ```bash
211
+ shoplazza te deploy
212
+ ```
213
+
214
+ Once deployed, the Extension will be live in the store.
215
+
216
+ ### Connect Extension to an APP
217
+
218
+ An APP is the primary extension method of Shoplazza platform. A Theme Extension is part of an APP, and one APP can connect multiple Theme Extensions. To conect your Extension to an APP:
219
+
220
+ ```bash
221
+ shoplazza te connect
222
+ ```
223
+
224
+ You will be prompted to enter the APP's `client_id` and `client_secret`, which can be obtained from the Shoplazza Partner Dashboard.
225
+
226
+ ### Release an Extension
227
+ To update the Extension version connected to your app, run the release command:
228
+
229
+ ```bash
230
+ shoplazza te release
231
+ ```
232
+
233
+ The release will be based on the current production version of your store. Once published, the changes will take effect for **all stores that have installed your app**.
234
+
235
+ ### CLI Command Guide
236
+
237
+ | Command | Description |
238
+ | :-----------------------------------: | :--------------------------------------------: |
239
+ | `shoplazza te create` | Create a new Theme Extension project |
240
+ | `shoplazza te serve` | Start a local development server |
241
+ | `shoplazza te build` | Build a production version of the Extension |
242
+ | `shoplazza te versions` | View production version list of an Extension |
243
+ | `shoplazza te list` | List private Extensions in the store |
244
+ | `shoplazza te deploy` | Deploy a production build to the current store |
245
+ | `shoplazza te connect <extension-id>` | Bind an Extension to an APP |
246
+ | `shoplazza te release` | Publish an Extension to its bound APP |
247
+
167
248
  ## Core commands
168
249
 
169
250
  ### help
@@ -60,7 +60,7 @@ async function usePrompt(extensionId) {
60
60
  console.log(
61
61
  chalk.cyanBright(`\n🔍 Latest version: `) +
62
62
  chalk.yellow(`${latestVersion.version} `) +
63
- chalk.white(`(${latestVersion.description})`) +
63
+ chalk.white(`(${latestVersion.exts})`) +
64
64
  chalk.gray(` [Released on: ${latestVersion.created_at}]`)
65
65
  );
66
66
  }
@@ -26,6 +26,10 @@ async function usePrompt() {
26
26
  if (!projectName.trim()) {
27
27
  return 'Project name cannot be empty';
28
28
  }
29
+ // 禁止包含空格
30
+ if (projectName.includes(' ')) {
31
+ return 'Project name cannot contain spaces';
32
+ }
29
33
  return true;
30
34
  }
31
35
  }
@@ -1,22 +1,22 @@
1
1
  # Theme Basic App
2
2
 
3
- ## 概览
3
+ ## Overview
4
4
 
5
- 一个基础的主题插件项目
5
+ Basic Extension (a card that allows store owners to decide where to add it)
6
6
 
7
- ## 安装
7
+ ## Installation
8
8
 
9
- 首先,确保您安装了“Shoplazza CLI”。如果没有,您可以使用以下命令全局安装它:
9
+ First, ensure you have "Shoplazza CLI" installed. If not, you can install it globally using the following command:
10
10
 
11
11
  ```bash
12
12
  npm install -g shoplazza-cli
13
13
  ```
14
14
 
15
- ## 可用的脚本
15
+ ## Available Scripts
16
16
 
17
17
  ### `create`
18
18
 
19
- 创建主题插件项目模版
19
+ Create a theme Extension project
20
20
 
21
21
  ```bash
22
22
  shoplazza te create
@@ -24,17 +24,17 @@ shoplazza te create
24
24
 
25
25
  ---
26
26
 
27
- 进入项目目录后,即可使用以下命令:
27
+ After entering the project directory, you can use the following commands:
28
28
 
29
29
  ### `start`
30
30
 
31
- 启动开发模式
31
+ Start development mode
32
32
 
33
33
  ```bash
34
34
  npm start
35
35
  ```
36
36
 
37
- 或者
37
+ or
38
38
 
39
39
  ```bash
40
40
  shoplazza te serve
@@ -42,13 +42,13 @@ shoplazza te serve
42
42
 
43
43
  ### `build`
44
44
 
45
- 基于当前的草稿生成对应正式版本的主题插件
45
+ Build a production version of the current Extension
46
46
 
47
47
  ```bash
48
48
  npm run build
49
49
  ```
50
50
 
51
- 或者
51
+ or
52
52
 
53
53
  ```bash
54
54
  shoplazza te build
@@ -56,13 +56,13 @@ shoplazza te build
56
56
 
57
57
  ### `deploy`
58
58
 
59
- 部署正式版本的主题插件(部署后插件在店铺的主题编辑器的app列表中可见)
59
+ Deploy a production version of an Extension to the current store
60
60
 
61
61
  ```bash
62
62
  npm run deploy
63
63
  ```
64
64
 
65
- 或者
65
+ or
66
66
 
67
67
  ```bash
68
68
  shoplazza te deploy
@@ -70,13 +70,13 @@ shoplazza te deploy
70
70
 
71
71
  ### `versions`
72
72
 
73
- 查询主题插件的历史正式版本列表
73
+ View the production version list of an Extension
74
74
 
75
75
  ```bash
76
76
  npm run versions
77
77
  ```
78
78
 
79
- 或者
79
+ or
80
80
 
81
81
  ```bash
82
82
  shoplazza te versions
@@ -84,15 +84,42 @@ shoplazza te versions
84
84
 
85
85
  ### `list`
86
86
 
87
- 查询店铺的私有主题插件列表
87
+ Query the list of private Extensions in the store
88
88
 
89
89
  ```bash
90
90
  npm run list
91
91
  ```
92
92
 
93
- 或者
93
+ or
94
94
 
95
95
  ```bash
96
96
  shoplazza te list
97
97
  ```
98
98
 
99
+ ### `connect`
100
+
101
+ Bind an Extension to a specific APP
102
+
103
+ ```bash
104
+ npm run connect
105
+ ```
106
+
107
+ or
108
+
109
+ ```bash
110
+ shoplazza te connect
111
+ ```
112
+
113
+ ### `release`
114
+
115
+ Release a production version of an Extension to the bound APP
116
+
117
+ ```bash
118
+ npm run release
119
+ ```
120
+
121
+ or
122
+
123
+ ```bash
124
+ shoplazza te release
125
+ ```
@@ -8,7 +8,9 @@
8
8
  "build": "shoplazza te build",
9
9
  "deploy": "shoplazza te deploy",
10
10
  "versions": "shoplazza te versions",
11
- "list": "shoplazza te list"
11
+ "list": "shoplazza te list",
12
+ "connect": "shoplazza te connect",
13
+ "release": "shoplazza te release"
12
14
  },
13
15
  "keywords": [],
14
16
  "author": "",
@@ -1,22 +1,22 @@
1
- # Theme Embed App
1
+ # Theme Embed App
2
2
 
3
- ## 概览
3
+ ## Overview
4
4
 
5
- 一个 embed 的主题插件项目
5
+ Embed Extension (a card that does not require manual addition)
6
6
 
7
- ## 安装
7
+ ## Installation
8
8
 
9
- 首先,确保您安装了“Shoplazza CLI”。如果没有,您可以使用以下命令全局安装它:
9
+ First, ensure you have "Shoplazza CLI" installed. If not, you can install it globally using the following command:
10
10
 
11
11
  ```bash
12
12
  npm install -g shoplazza-cli
13
13
  ```
14
14
 
15
- ## 可用的脚本
15
+ ## Available Scripts
16
16
 
17
17
  ### `create`
18
18
 
19
- 创建主题插件项目模版
19
+ Create a theme Extension project
20
20
 
21
21
  ```bash
22
22
  shoplazza te create
@@ -24,17 +24,17 @@ shoplazza te create
24
24
 
25
25
  ---
26
26
 
27
- 进入项目目录后,即可使用以下命令:
27
+ After entering the project directory, you can use the following commands:
28
28
 
29
29
  ### `start`
30
30
 
31
- 启动开发模式
31
+ Start development mode
32
32
 
33
33
  ```bash
34
34
  npm start
35
35
  ```
36
36
 
37
- 或者
37
+ or
38
38
 
39
39
  ```bash
40
40
  shoplazza te serve
@@ -42,13 +42,13 @@ shoplazza te serve
42
42
 
43
43
  ### `build`
44
44
 
45
- 基于当前的草稿生成对应正式版本的主题插件
45
+ Build a production version of the current Extension
46
46
 
47
47
  ```bash
48
48
  npm run build
49
49
  ```
50
50
 
51
- 或者
51
+ or
52
52
 
53
53
  ```bash
54
54
  shoplazza te build
@@ -56,13 +56,13 @@ shoplazza te build
56
56
 
57
57
  ### `deploy`
58
58
 
59
- 部署正式版本的主题插件
59
+ Deploy a production version of an Extension to the current store
60
60
 
61
61
  ```bash
62
62
  npm run deploy
63
63
  ```
64
64
 
65
- 或者
65
+ or
66
66
 
67
67
  ```bash
68
68
  shoplazza te deploy
@@ -70,13 +70,13 @@ shoplazza te deploy
70
70
 
71
71
  ### `versions`
72
72
 
73
- 查询主题插件的历史正式版本列表
73
+ View the production version list of an Extension
74
74
 
75
75
  ```bash
76
76
  npm run versions
77
77
  ```
78
78
 
79
- 或者
79
+ or
80
80
 
81
81
  ```bash
82
82
  shoplazza te versions
@@ -84,14 +84,42 @@ shoplazza te versions
84
84
 
85
85
  ### `list`
86
86
 
87
- 查询店铺的私有主题插件列表
87
+ Query the list of private Extensions in the store
88
88
 
89
89
  ```bash
90
90
  npm run list
91
91
  ```
92
92
 
93
- 或者
93
+ or
94
94
 
95
95
  ```bash
96
96
  shoplazza te list
97
97
  ```
98
+
99
+ ### `connect`
100
+
101
+ Bind an Extension to a specific APP
102
+
103
+ ```bash
104
+ npm run connect
105
+ ```
106
+
107
+ or
108
+
109
+ ```bash
110
+ shoplazza te connect
111
+ ```
112
+
113
+ ### `release`
114
+
115
+ Release a production version of an Extension to the bound APP
116
+
117
+ ```bash
118
+ npm run release
119
+ ```
120
+
121
+ or
122
+
123
+ ```bash
124
+ shoplazza te release
125
+ ```
@@ -8,7 +8,9 @@
8
8
  "build": "shoplazza te build",
9
9
  "deploy": "shoplazza te deploy",
10
10
  "versions": "shoplazza te versions",
11
- "list": "shoplazza te list"
11
+ "list": "shoplazza te list",
12
+ "connect": "shoplazza te connect",
13
+ "release": "shoplazza te release"
12
14
  },
13
15
  "keywords": [],
14
16
  "author": "",
@@ -1,5 +1,6 @@
1
1
  const api = require('./api');
2
2
  const { verifyConfig } = require('./verify');
3
+ const { consoleError } = require('../utils/console');
3
4
 
4
5
  module.exports = async (commands = {}) => {
5
6
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shoplazza-cli",
3
- "version": "1.0.7-beta.4",
3
+ "version": "1.0.8",
4
4
  "description": "",
5
5
  "main": "bin/shoplazza",
6
6
  "engines": {