esa-cli 0.0.2-beta.15 → 0.0.2-beta.16
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.
|
@@ -51,6 +51,7 @@ export const transferTemplatesToSelectItem = (configs, templateInstanceList, lan
|
|
|
51
51
|
return {
|
|
52
52
|
label: lang === 'en' ? config.Title_EN : config.Title_ZH,
|
|
53
53
|
value: value,
|
|
54
|
+
hint: lang === 'en' ? config.Desc_EN : config.Desc_ZH,
|
|
54
55
|
children
|
|
55
56
|
};
|
|
56
57
|
});
|
|
@@ -234,11 +235,19 @@ export const configProjectName = (initParams) => __awaiter(void 0, void 0, void
|
|
|
234
235
|
log.step(`Project name configured ${initParams.name}`);
|
|
235
236
|
return;
|
|
236
237
|
}
|
|
238
|
+
const HaikunatorCtor = Haikunator;
|
|
239
|
+
const haikunator = new HaikunatorCtor();
|
|
240
|
+
const defaultName = haikunator.haikunate();
|
|
237
241
|
const name = (yield promptParameter({
|
|
238
242
|
type: 'text',
|
|
239
243
|
question: `${t('init_input_name').d('Enter the name of edgeRoutine:')}`,
|
|
240
244
|
label: 'Project name',
|
|
245
|
+
defaultValue: defaultName,
|
|
241
246
|
validate: (input) => {
|
|
247
|
+
if (input === '' || input === undefined) {
|
|
248
|
+
initParams.name = defaultName;
|
|
249
|
+
return true;
|
|
250
|
+
}
|
|
242
251
|
const regex = /^[a-z0-9-]{2,}$/;
|
|
243
252
|
if (!regex.test(input)) {
|
|
244
253
|
return t('init_name_error').d('Error: The project name must be at least 2 characters long and can only contain lowercase letters, numbers, and hyphens.');
|
|
@@ -373,8 +382,8 @@ export const createProject = (initParams) => __awaiter(void 0, void 0, void 0, f
|
|
|
373
382
|
const full = `${command} ${initParams.name} ${templateFlag} ${extraParams}`.trim();
|
|
374
383
|
const res = yield execCommand(['sh', '-lc', full], {
|
|
375
384
|
interactive: true,
|
|
376
|
-
startText: `Starting to execute framework command
|
|
377
|
-
doneText: `Framework command executed
|
|
385
|
+
startText: `Starting to execute framework command ${chalk.gray(full)}`,
|
|
386
|
+
doneText: `Framework command executed ${chalk.gray(full)}`
|
|
378
387
|
});
|
|
379
388
|
if (!res.success) {
|
|
380
389
|
outro(`Framework command execution failed`);
|
|
@@ -563,7 +572,10 @@ export const initGit = (initParams) => __awaiter(void 0, void 0, void 0, functio
|
|
|
563
572
|
if (initParams.git) {
|
|
564
573
|
const targetPath = path.join(process.cwd(), initParams.name);
|
|
565
574
|
const res = yield execCommand(['git', 'init'], {
|
|
566
|
-
cwd: targetPath
|
|
575
|
+
cwd: targetPath,
|
|
576
|
+
silent: true,
|
|
577
|
+
startText: 'Initializing git',
|
|
578
|
+
doneText: 'Git initialized'
|
|
567
579
|
});
|
|
568
580
|
if (!res.success) {
|
|
569
581
|
outro(`Git initialization failed`);
|
|
@@ -11,7 +11,7 @@ import { exit } from 'process';
|
|
|
11
11
|
import { intro, outro } from '@clack/prompts';
|
|
12
12
|
import t from '../../i18n/index.js';
|
|
13
13
|
import { promptParameter } from '../../utils/prompt.js';
|
|
14
|
-
import { applyFileEdits, buildProject, configCategory, configLanguage, configProjectName, configTemplate, createProject, deployProject, getInitParamsFromArgv, initGit, installDependencies, installESACli, updateConfigFile } from './helper.js';
|
|
14
|
+
import { applyFileEdits, buildProject, checkAndUpdatePackage, configCategory, configLanguage, configProjectName, configTemplate, createProject, deployProject, getInitParamsFromArgv, initGit, installDependencies, installESACli, updateConfigFile } from './helper.js';
|
|
15
15
|
import { displayDeploySuccess } from '../common/utils.js';
|
|
16
16
|
import chalk from 'chalk';
|
|
17
17
|
const init = {
|
|
@@ -63,7 +63,7 @@ const init = {
|
|
|
63
63
|
};
|
|
64
64
|
export default init;
|
|
65
65
|
const handleInit = (argv) => __awaiter(void 0, void 0, void 0, function* () {
|
|
66
|
-
|
|
66
|
+
yield checkAndUpdatePackage('esa-template');
|
|
67
67
|
const initParams = getInitParamsFromArgv(argv);
|
|
68
68
|
yield create(initParams);
|
|
69
69
|
yield config(initParams);
|
|
@@ -26,7 +26,8 @@ export default function multiLevelSelect(items_1) {
|
|
|
26
26
|
options: [
|
|
27
27
|
...currentItems.map((item) => ({
|
|
28
28
|
label: item.label,
|
|
29
|
-
value: item.value
|
|
29
|
+
value: item.value,
|
|
30
|
+
hint: item.hint
|
|
30
31
|
})),
|
|
31
32
|
...(stack.length > 0 ? [{ label: 'Back', value: '__back__' }] : [])
|
|
32
33
|
]
|
|
@@ -15,7 +15,7 @@ esa init [name]
|
|
|
15
15
|
- -f, --framework string:选择前端框架(react/vue/nextjs...)
|
|
16
16
|
- -l, --language string:选择语言(typescript/javascript)。可选:typescript | javascript
|
|
17
17
|
- -t, --template string:指定模板名称
|
|
18
|
-
- -y, --yes boolean:对所有交互询问选择“是”(默认 false
|
|
18
|
+
- -y, --yes boolean:对所有交互询问选择“是”(默认 false),模版采用helloworld
|
|
19
19
|
- --git boolean:在项目中初始化 git
|
|
20
20
|
- --deploy boolean:初始化完成后自动部署
|
|
21
21
|
|
|
@@ -65,10 +65,8 @@ esa commit [entry]
|
|
|
65
65
|
esa deploy [entry]
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
- 位置参数:
|
|
69
|
-
- entry:(可选的)边缘函数入口文件
|
|
70
|
-
|
|
71
68
|
- 选项:
|
|
69
|
+
- entry 可选参数,默认以`esa.jsonc`中entry配置为准
|
|
72
70
|
- -v, --version string:指定要部署的版本(跳过交互选择)
|
|
73
71
|
- -e, --environment string:部署环境。可选:staging | production
|
|
74
72
|
- -n, --name string:边缘函数名称
|
|
@@ -117,7 +115,7 @@ esa site list
|
|
|
117
115
|
```
|
|
118
116
|
|
|
119
117
|
- 子命令:
|
|
120
|
-
- list
|
|
118
|
+
- list:列出所有站点
|
|
121
119
|
|
|
122
120
|
---
|
|
123
121
|
|