@itbox/cli 0.0.1 → 0.0.2
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/README.md +0 -9
- package/bin/index.js +23 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -194,15 +194,6 @@ itbox config help
|
|
|
194
194
|
- 安装选择的包管理器:`npm install -g npm` 或 `npm install -g pnpm`
|
|
195
195
|
- 检查包管理器是否在系统PATH中
|
|
196
196
|
|
|
197
|
-
## 更新日志
|
|
198
|
-
|
|
199
|
-
### v1.0.0
|
|
200
|
-
- 初始版本发布
|
|
201
|
-
- 支持从Gitee动态获取模板分支
|
|
202
|
-
- 支持npm/pnpm包管理器选择
|
|
203
|
-
- 实现配置管理功能
|
|
204
|
-
- 支持 `pnpm create itbox` 调用方式
|
|
205
|
-
|
|
206
197
|
## License
|
|
207
198
|
|
|
208
199
|
MIT
|
package/bin/index.js
CHANGED
|
@@ -100,9 +100,21 @@ function getRemoteBranches(repoUrl) {
|
|
|
100
100
|
|
|
101
101
|
|
|
102
102
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
let TEMPLATE_REPO = getConfig('templateRepo');
|
|
104
|
+
|
|
105
|
+
// 检查模板仓库配置
|
|
106
|
+
function checkTemplateRepoConfig() {
|
|
107
|
+
if (!TEMPLATE_REPO) {
|
|
108
|
+
console.error('❌ 模板仓库地址未配置');
|
|
109
|
+
console.error('\n请使用以下命令配置模板仓库地址:');
|
|
110
|
+
console.error(' itbox config set templateRepo <仓库地址>');
|
|
111
|
+
console.error('\n示例:');
|
|
112
|
+
console.error(' itbox config set templateRepo https://gitee.com/username/template.git');
|
|
113
|
+
console.error('\n配置完成后,重新运行命令即可。');
|
|
114
|
+
process.exit(1);
|
|
115
|
+
}
|
|
116
|
+
return TEMPLATE_REPO;
|
|
117
|
+
}
|
|
106
118
|
|
|
107
119
|
// 从package.json获取项目信息
|
|
108
120
|
const packagePath = path.resolve(path.dirname(new URL(import.meta.url).pathname), '../package.json');
|
|
@@ -125,9 +137,12 @@ program
|
|
|
125
137
|
process.exit(1);
|
|
126
138
|
}
|
|
127
139
|
|
|
140
|
+
// 检查模板仓库配置
|
|
141
|
+
const templateRepo = checkTemplateRepoConfig();
|
|
142
|
+
|
|
128
143
|
// 获取远程仓库分支(模板)
|
|
129
144
|
const spinner = ora('正在获取可用模板列表...').start();
|
|
130
|
-
const branches = getRemoteBranches(
|
|
145
|
+
const branches = getRemoteBranches(templateRepo);
|
|
131
146
|
spinner.succeed('✅ 模板列表获取完成');
|
|
132
147
|
|
|
133
148
|
// 显示模板列表
|
|
@@ -162,9 +177,12 @@ program
|
|
|
162
177
|
process.exit(1);
|
|
163
178
|
}
|
|
164
179
|
|
|
180
|
+
// 检查模板仓库配置
|
|
181
|
+
const templateRepo = checkTemplateRepoConfig();
|
|
182
|
+
|
|
165
183
|
// 获取远程仓库分支
|
|
166
184
|
const spinner = ora('正在获取模板列表...').start();
|
|
167
|
-
const branches = getRemoteBranches(
|
|
185
|
+
const branches = getRemoteBranches(templateRepo);
|
|
168
186
|
spinner.succeed('✅ 模板列表获取完成');
|
|
169
187
|
|
|
170
188
|
// 如果没有分支
|