qdmp-cli 0.1.10 → 0.1.12
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/api.js +3 -0
- package/constants.js +9 -2
- package/package.json +1 -1
- package/utils/gitClone.js +10 -3
- package/utils/logHandler.js +1 -1
package/api.js
CHANGED
|
@@ -51,6 +51,9 @@ export const request = async (
|
|
|
51
51
|
if (response.status === 401) {
|
|
52
52
|
throw new Error("未授权,执行 qdmp-cli login 完成登录");
|
|
53
53
|
}
|
|
54
|
+
if (response.status === 403) {
|
|
55
|
+
throw new Error("你没有该小程序的开发权限,请联系管理员开通后重试");
|
|
56
|
+
}
|
|
54
57
|
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
55
58
|
}
|
|
56
59
|
|
package/constants.js
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
export const TEMPLATES = [
|
|
2
2
|
{
|
|
3
3
|
name: "default",
|
|
4
|
-
value: "
|
|
5
|
-
desc: "千岛小程序默认模版",
|
|
4
|
+
value: "git@github.com:EchoTechFE/qdmp-taro-template.git",
|
|
5
|
+
desc: "千岛小程序默认模版(2.0)",
|
|
6
6
|
emoji: "🟢",
|
|
7
|
+
fullUrl: true,
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
name: "qdmp",
|
|
11
|
+
value: "frontend/miniapp-taro-template",
|
|
12
|
+
desc: "千岛小程序默认模版(1.0)",
|
|
13
|
+
emoji: "🟡",
|
|
7
14
|
},
|
|
8
15
|
{
|
|
9
16
|
name: "h5",
|
package/package.json
CHANGED
package/utils/gitClone.js
CHANGED
|
@@ -38,10 +38,13 @@ export const download = async (projectName, repo) => {
|
|
|
38
38
|
const clone = async (repo, name) => {
|
|
39
39
|
const spinner = ora("正在拉取项目......").start();
|
|
40
40
|
try {
|
|
41
|
+
const repoUrl = repo.includes(":")
|
|
42
|
+
? repo
|
|
43
|
+
: `git@g.echo.tech:${repo}.git`;
|
|
41
44
|
await new Promise((resolve, reject) => {
|
|
42
45
|
const child = spawn(
|
|
43
46
|
"git",
|
|
44
|
-
["clone", "--depth", "1",
|
|
47
|
+
["clone", "--depth", "1", repoUrl, name],
|
|
45
48
|
{
|
|
46
49
|
stdio: ["ignore", "pipe", "pipe"],
|
|
47
50
|
env: {
|
|
@@ -55,12 +58,16 @@ const clone = async (repo, name) => {
|
|
|
55
58
|
if (code === 0) {
|
|
56
59
|
resolve();
|
|
57
60
|
} else {
|
|
61
|
+
const isGitHub = repoUrl.includes("github.com");
|
|
58
62
|
reject(
|
|
59
63
|
new Error(
|
|
60
64
|
`git clone 失败 (退出码: ${code}),请检查:\n` +
|
|
61
65
|
` 1. 是否已配置 SSH 密钥:ssh-keygen -t ed25519\n` +
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
(isGitHub
|
|
67
|
+
? ` 2. 是否已将公钥添加到 GitHub:https://github.com/settings/keys\n` +
|
|
68
|
+
` 3. 网络是否能访问 github.com`
|
|
69
|
+
: ` 2. 是否已将公钥添加到 GitLab:cat ~/.ssh/id_ed25519.pub\n` +
|
|
70
|
+
` 3. 网络是否能访问 g.echo.tech`)
|
|
64
71
|
)
|
|
65
72
|
);
|
|
66
73
|
}
|
package/utils/logHandler.js
CHANGED