@zjex/git-workflow 0.2.11 → 0.2.15
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/dist/index.js +1 -1
- package/package.json +2 -2
- package/scripts/publish.js +59 -10
package/dist/index.js
CHANGED
|
@@ -2095,7 +2095,7 @@ process.on("SIGTERM", () => {
|
|
|
2095
2095
|
console.log("");
|
|
2096
2096
|
process.exit(0);
|
|
2097
2097
|
});
|
|
2098
|
-
var version = true ? "0.2.
|
|
2098
|
+
var version = true ? "0.2.15" : "0.0.0-dev";
|
|
2099
2099
|
async function mainMenu() {
|
|
2100
2100
|
console.log(
|
|
2101
2101
|
colors.green(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zjex/git-workflow",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.15",
|
|
4
4
|
"description": "🚀 极简的 Git 工作流 CLI 工具,让分支管理和版本发布变得轻松愉快",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"version": "node scripts/version.js",
|
|
18
18
|
"release": "./scripts/release.sh",
|
|
19
19
|
"release:dry": "./scripts/release.sh --dry-run",
|
|
20
|
-
"publish:npm": "node scripts/publish.js",
|
|
20
|
+
"publish:npm": "NODE_NO_WARNINGS=1 node scripts/publish.js",
|
|
21
21
|
"prepublishOnly": "npm run build",
|
|
22
22
|
"prepare": "husky"
|
|
23
23
|
},
|
package/scripts/publish.js
CHANGED
|
@@ -111,6 +111,14 @@ async function main() {
|
|
|
111
111
|
const currentVersion = pkg.version;
|
|
112
112
|
|
|
113
113
|
// [5] 选择新版本号
|
|
114
|
+
const spinner5 = ora({
|
|
115
|
+
text: `${colors.blue("[5/11]")} 选择新版本号...`,
|
|
116
|
+
spinner: "dots",
|
|
117
|
+
}).start();
|
|
118
|
+
|
|
119
|
+
// 停止 spinner,保持交互式
|
|
120
|
+
spinner5.stop();
|
|
121
|
+
|
|
114
122
|
console.log(`${colors.blue("[5/11]")} 选择新版本号...`);
|
|
115
123
|
console.log("");
|
|
116
124
|
|
|
@@ -132,13 +140,30 @@ async function main() {
|
|
|
132
140
|
}
|
|
133
141
|
|
|
134
142
|
// 清除上面的输出,重新显示步骤5
|
|
135
|
-
|
|
136
|
-
|
|
143
|
+
// npm run version 输出:
|
|
144
|
+
// - "> @zjex/git-workflow@x.x.x version" (1行)
|
|
145
|
+
// - "> node scripts/version.js" (1行)
|
|
146
|
+
// - 空行 (1行)
|
|
147
|
+
// - "? 选择版本升级类型:" (1行)
|
|
148
|
+
// - 选项列表 (4行: patch, minor, major, custom)
|
|
149
|
+
// - 空行 (1行)
|
|
150
|
+
// - "✔ 版本已更新: x.x.x → x.x.x" (1行)
|
|
151
|
+
// - 空行 (1行)
|
|
152
|
+
// 加上我们自己的:
|
|
153
|
+
// - "[5/11] 选择新版本号..." (1行)
|
|
154
|
+
// - 空行 (1行)
|
|
155
|
+
// 总共约 14 行
|
|
156
|
+
const linesToClear = 14;
|
|
157
|
+
|
|
158
|
+
for (let i = 0; i < linesToClear; i++) {
|
|
159
|
+
process.stdout.write("\x1b[1A"); // 向上移动一行
|
|
160
|
+
process.stdout.write("\x1b[2K"); // 清除整行
|
|
161
|
+
}
|
|
137
162
|
|
|
138
163
|
console.log(
|
|
139
|
-
`${colors.blue("[5/11]")}
|
|
140
|
-
|
|
141
|
-
)}
|
|
164
|
+
`${colors.green("✔")} ${colors.blue("[5/11]")} 选择新版本号 ${colors.dim(
|
|
165
|
+
`(${currentVersion} → ${newVersion})`
|
|
166
|
+
)}`
|
|
142
167
|
);
|
|
143
168
|
|
|
144
169
|
// [6] 构建项目
|
|
@@ -219,18 +244,42 @@ async function main() {
|
|
|
219
244
|
}
|
|
220
245
|
|
|
221
246
|
// [11] 发布到 npm
|
|
247
|
+
const spinner11 = ora({
|
|
248
|
+
text: `${colors.blue("[11/11]")} 发布到 npm...`,
|
|
249
|
+
spinner: "dots",
|
|
250
|
+
}).start();
|
|
251
|
+
|
|
252
|
+
// 停止 spinner,保持交互式
|
|
253
|
+
spinner11.stop();
|
|
254
|
+
|
|
222
255
|
console.log(`${colors.blue("[11/11]")} 发布到 npm...`);
|
|
223
256
|
console.log("");
|
|
224
257
|
|
|
225
258
|
try {
|
|
226
259
|
execSync("npm publish", { stdio: "inherit" });
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
)
|
|
260
|
+
|
|
261
|
+
// 清除 npm publish 的所有输出
|
|
262
|
+
// npm publish 输出包括:
|
|
263
|
+
// - prepublishOnly hook (build 输出,约30行)
|
|
264
|
+
// - prepare hook (husky 输出,约5行)
|
|
265
|
+
// - npm notice 信息 (约15行)
|
|
266
|
+
// - OTP 认证提示和输入 (约3行)
|
|
267
|
+
// - 发布成功信息 (约2行)
|
|
268
|
+
// 加上我们自己的:
|
|
269
|
+
// - "[11/11] 发布到 npm..." (1行)
|
|
270
|
+
// - 空行 (1行)
|
|
271
|
+
// 总共约 57 行,为了保险使用 60 行
|
|
272
|
+
const linesToClear = 60;
|
|
273
|
+
|
|
274
|
+
for (let i = 0; i < linesToClear; i++) {
|
|
275
|
+
process.stdout.write("\x1b[1A");
|
|
276
|
+
process.stdout.write("\x1b[2K");
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
console.log(`${colors.green("✔")} ${colors.blue("[11/11]")} 发布到 npm`);
|
|
231
280
|
} catch (error) {
|
|
232
281
|
console.log("");
|
|
233
|
-
console.log(`${colors.blue("[11/11]")} 发布到 npm
|
|
282
|
+
console.log(`${colors.red("✖")} ${colors.blue("[11/11]")} 发布到 npm`);
|
|
234
283
|
process.exit(1);
|
|
235
284
|
}
|
|
236
285
|
|