@opentapd/tplugin-cli 0.20.0-beta.12 → 0.20.0-beta.14
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/create.js +22 -13
- package/package.json +1 -1
package/lib/create.js
CHANGED
|
@@ -75,18 +75,7 @@ module.exports = async (code, options) => {
|
|
|
75
75
|
|
|
76
76
|
spinner.start('稍等片刻,正在创建...');
|
|
77
77
|
// 调起创建插件
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (!res || !res.status) {
|
|
81
|
-
spinner.fail('创建插件失败');
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (res && res.status) {
|
|
86
|
-
spinner.stop();
|
|
87
|
-
// 创建完成后,拉取代码
|
|
88
|
-
await cloneRepo(res, code);
|
|
89
|
-
}
|
|
78
|
+
await create(params);
|
|
90
79
|
};
|
|
91
80
|
|
|
92
81
|
/**
|
|
@@ -139,7 +128,27 @@ async function getEntranceOpts() {
|
|
|
139
128
|
// create(params): 创建插件请求
|
|
140
129
|
async function create(params) {
|
|
141
130
|
const { data } = await tapdsdk.request({ url: '/open_user_app/create_app', method: 'POST', params });
|
|
142
|
-
|
|
131
|
+
if (!data || !data.status) {
|
|
132
|
+
spinner.fail('创建插件失败');
|
|
133
|
+
return ;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
await getAppCreateStatus(params.code);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
async function getAppCreateStatus(code) {
|
|
140
|
+
const { data } = await tapdsdk.request({ url: `/open_user_app/get_create_app_status/${code}`, method: 'GET' });
|
|
141
|
+
if (!data || data.data.status === '7') {
|
|
142
|
+
spinner.fail('创建插件失败');
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (data.data.status === '0') {
|
|
146
|
+
setTimeout(() => getAppCreateStatus(code), 1000);
|
|
147
|
+
} else if (data.data.status === '1') {
|
|
148
|
+
spinner.stop();
|
|
149
|
+
// 创建完成后,拉取代码
|
|
150
|
+
await cloneRepo(data, code);
|
|
151
|
+
}
|
|
143
152
|
}
|
|
144
153
|
|
|
145
154
|
/**
|