@opentapd/tplugin-cli 0.32.0 → 0.32.1-alpha.0
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/cli.js +1 -2
- package/lib/create.js +9 -22
- package/package.json +2 -2
package/cli.js
CHANGED
|
@@ -27,9 +27,8 @@ program.version(packageJson.version)
|
|
|
27
27
|
.usage('<command> [options]');
|
|
28
28
|
|
|
29
29
|
// create <code> 创建插件
|
|
30
|
-
program.command('create <
|
|
30
|
+
program.command('create <name>')
|
|
31
31
|
.description('通过CLI创建一个TAPD插件')
|
|
32
|
-
.option('-n, --name <name>', '插件名字')
|
|
33
32
|
.action(actionRunner((code, opts) => require('./lib/create')(code, opts)));
|
|
34
33
|
|
|
35
34
|
// login 登录
|
package/lib/create.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Author: terrysxu@tencent.com
|
|
4
4
|
* Author: raferzeng@tencent.com
|
|
5
5
|
*
|
|
6
|
-
* The implementation of CLI: create <
|
|
6
|
+
* The implementation of CLI: create <name>
|
|
7
7
|
*/
|
|
8
8
|
const inquirer = require('inquirer');
|
|
9
9
|
const chalk = require('chalk');
|
|
@@ -21,22 +21,16 @@ const { downloadAndUnzip } = require('../util/tools');
|
|
|
21
21
|
const { promisify } = require('util');
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
* @description
|
|
25
|
-
* @param
|
|
26
|
-
* @param options 选择的创建配置
|
|
24
|
+
* @description 根据名称创建插件
|
|
25
|
+
* @param name 插件名称
|
|
27
26
|
*/
|
|
28
|
-
module.exports = async (
|
|
27
|
+
module.exports = async (name) => {
|
|
29
28
|
// 初始化Session
|
|
30
29
|
const session = new Session();
|
|
31
30
|
|
|
32
31
|
// 校验登录态
|
|
33
32
|
session.checkAuth();
|
|
34
33
|
|
|
35
|
-
await checkAppParams({
|
|
36
|
-
code,
|
|
37
|
-
name: options.name || code,
|
|
38
|
-
});
|
|
39
|
-
|
|
40
34
|
spinner.start('加载应用模板...');
|
|
41
35
|
// 加载创建模板
|
|
42
36
|
const createTmpl = await getCreateTmpl();
|
|
@@ -67,8 +61,7 @@ module.exports = async (code, options) => {
|
|
|
67
61
|
const entranceConfigs = supportEntrances ? await selectEntrances() : {};
|
|
68
62
|
|
|
69
63
|
const params = {
|
|
70
|
-
|
|
71
|
-
name: options.name || code,
|
|
64
|
+
name,
|
|
72
65
|
template: selectedTmpl.template,
|
|
73
66
|
...entranceConfigs,
|
|
74
67
|
async: true,
|
|
@@ -79,15 +72,6 @@ module.exports = async (code, options) => {
|
|
|
79
72
|
await create(params);
|
|
80
73
|
};
|
|
81
74
|
|
|
82
|
-
/**
|
|
83
|
-
* checkAppParams(): 检查插件参数
|
|
84
|
-
* @return array data
|
|
85
|
-
*/
|
|
86
|
-
async function checkAppParams(params) {
|
|
87
|
-
const { data } = await tapdsdk.request({ url: '/open_user_app/check_app_params', method: 'POST', params });
|
|
88
|
-
return data;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
75
|
/**
|
|
92
76
|
* getCreateTmpl(): 获取创建模板列表
|
|
93
77
|
* @return array data
|
|
@@ -134,7 +118,9 @@ async function create(params) {
|
|
|
134
118
|
return ;
|
|
135
119
|
}
|
|
136
120
|
|
|
137
|
-
|
|
121
|
+
const { data: { code } } = data;
|
|
122
|
+
|
|
123
|
+
await getAppCreateStatus(code);
|
|
138
124
|
}
|
|
139
125
|
|
|
140
126
|
async function getAppCreateStatus(code) {
|
|
@@ -322,3 +308,4 @@ async function selectEntrances() {
|
|
|
322
308
|
}))),
|
|
323
309
|
};
|
|
324
310
|
}
|
|
311
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentapd/tplugin-cli",
|
|
3
|
-
"version": "0.32.0",
|
|
3
|
+
"version": "0.32.1-alpha.0",
|
|
4
4
|
"description": "tplugin-cli",
|
|
5
5
|
"bin": {
|
|
6
6
|
"tplugin-cli": "index.js"
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"node": ">=14.13.0"
|
|
80
80
|
},
|
|
81
81
|
"main": "index.js",
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "c6df83f3d786c9c116636824ca4a878e9f6a1405"
|
|
83
83
|
}
|