shoplazza-cli 1.0.8 → 1.0.9

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.
@@ -79,21 +79,28 @@ async function syncLocalFiles(extensionId) {
79
79
  * 交互选择预览主题
80
80
  */
81
81
  async function usePrompt() {
82
+ const spinner = ora('Fetching theme list...').start();
82
83
  const res = await getThemeList();
83
84
  const themeList = res.data?.data?.themes || [];
84
- const { selectedThemeId } = await inquirer.prompt([
85
- {
86
- type: 'list',
87
- name: 'selectedThemeId',
88
- message: 'Please select a theme to preview:',
89
- choices: themeList.map((theme) => ({
90
- name: theme.name,
91
- value: theme.id
92
- })),
93
- loop: false
94
- }
95
- ]);
96
- return selectedThemeId;
85
+ if (!themeList.length) {
86
+ spinner.succeed('Theme list loaded.');
87
+ throw new Error('Your store has no unpublished themes. Please add themes and try again.');
88
+ } else {
89
+ spinner.succeed('Theme list loaded.');
90
+ const { selectedThemeId } = await inquirer.prompt([
91
+ {
92
+ type: 'list',
93
+ name: 'selectedThemeId',
94
+ message: 'Please select a theme to preview:',
95
+ choices: themeList.map((theme) => ({
96
+ name: theme.name,
97
+ value: theme.id
98
+ })),
99
+ loop: false
100
+ }
101
+ ]);
102
+ return selectedThemeId;
103
+ }
97
104
  }
98
105
 
99
106
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shoplazza-cli",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "",
5
5
  "main": "bin/shoplazza",
6
6
  "engines": {