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.
- package/lib/app/commands/serve.js +20 -13
- package/package.json +1 -1
|
@@ -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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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
|
/**
|