@zjex/git-workflow 0.2.10 → 0.2.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/dist/index.js +1 -1
- package/package.json +2 -2
- package/scripts/publish.js +300 -0
- package/scripts/publish.sh +41 -6
- package/scripts/README.md +0 -57
- package/test-box.sh +0 -18
- package/test-full-publish.sh +0 -30
- package/zjex.svg +0 -1
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.14" : "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.14",
|
|
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": "
|
|
20
|
+
"publish:npm": "node scripts/publish.js",
|
|
21
21
|
"prepublishOnly": "npm run build",
|
|
22
22
|
"prepare": "husky"
|
|
23
23
|
},
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
#!/usr/bin/env node --no-warnings
|
|
2
|
+
|
|
3
|
+
import { execSync } from "child_process";
|
|
4
|
+
import { readFileSync } from "fs";
|
|
5
|
+
import ora from "ora";
|
|
6
|
+
import boxen from "boxen";
|
|
7
|
+
|
|
8
|
+
const colors = {
|
|
9
|
+
blue: (str) => `\x1b[34m${str}\x1b[0m`,
|
|
10
|
+
green: (str) => `\x1b[32m${str}\x1b[0m`,
|
|
11
|
+
red: (str) => `\x1b[31m${str}\x1b[0m`,
|
|
12
|
+
yellow: (str) => `\x1b[33m${str}\x1b[0m`,
|
|
13
|
+
cyan: (str) => `\x1b[36m${str}\x1b[0m`,
|
|
14
|
+
dim: (str) => `\x1b[2m${str}\x1b[0m`,
|
|
15
|
+
bold: (str) => `\x1b[1m${str}\x1b[0m`,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const TOTAL_STEPS = 11;
|
|
19
|
+
|
|
20
|
+
function exec(command, silent = false) {
|
|
21
|
+
try {
|
|
22
|
+
return execSync(command, {
|
|
23
|
+
encoding: "utf-8",
|
|
24
|
+
stdio: silent ? "pipe" : "inherit",
|
|
25
|
+
});
|
|
26
|
+
} catch (error) {
|
|
27
|
+
if (!silent) throw error;
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function runStep(stepNum, stepName, command) {
|
|
33
|
+
const spinner = ora({
|
|
34
|
+
text: `${colors.blue(`[${stepNum}/${TOTAL_STEPS}]`)} ${stepName}...`,
|
|
35
|
+
spinner: "dots",
|
|
36
|
+
}).start();
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
execSync(command, { encoding: "utf-8", stdio: "pipe" });
|
|
40
|
+
spinner.succeed(
|
|
41
|
+
`${colors.blue(`[${stepNum}/${TOTAL_STEPS}]`)} ${stepName}`
|
|
42
|
+
);
|
|
43
|
+
return true;
|
|
44
|
+
} catch (error) {
|
|
45
|
+
spinner.fail(`${colors.blue(`[${stepNum}/${TOTAL_STEPS}]`)} ${stepName}`);
|
|
46
|
+
console.log("");
|
|
47
|
+
console.log(colors.red("错误详情:"));
|
|
48
|
+
console.log(error.stdout || error.message);
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async function main() {
|
|
54
|
+
console.log("");
|
|
55
|
+
console.log(colors.bold("🚀 开始发布流程"));
|
|
56
|
+
console.log("");
|
|
57
|
+
|
|
58
|
+
// [1] 检查 Git 仓库
|
|
59
|
+
if (!runStep(1, "检查 Git 仓库", "git rev-parse --git-dir")) {
|
|
60
|
+
console.log(colors.red("✖ 当前目录不是 git 仓库"));
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// [2] 检查工作区状态
|
|
65
|
+
const spinner2 = ora({
|
|
66
|
+
text: `${colors.blue("[2/11]")} 检查工作区状态...`,
|
|
67
|
+
spinner: "dots",
|
|
68
|
+
}).start();
|
|
69
|
+
|
|
70
|
+
const status = exec("git status --porcelain", true);
|
|
71
|
+
if (status && status.trim()) {
|
|
72
|
+
spinner2.fail(`${colors.blue("[2/11]")} 检查工作区状态`);
|
|
73
|
+
console.log("");
|
|
74
|
+
console.log(colors.red("✖ 检测到未提交的更改,请先提交后再发布"));
|
|
75
|
+
console.log("");
|
|
76
|
+
console.log(status);
|
|
77
|
+
console.log("");
|
|
78
|
+
console.log(colors.cyan("💡 提示: 可以使用 'gw c' 提交更改"));
|
|
79
|
+
process.exit(1);
|
|
80
|
+
}
|
|
81
|
+
spinner2.succeed(`${colors.blue("[2/11]")} 检查工作区状态`);
|
|
82
|
+
|
|
83
|
+
// [3] 检查 npm 登录状态
|
|
84
|
+
const spinner3 = ora({
|
|
85
|
+
text: `${colors.blue("[3/11]")} 检查 npm 登录状态...`,
|
|
86
|
+
spinner: "dots",
|
|
87
|
+
}).start();
|
|
88
|
+
|
|
89
|
+
const npmUser = exec("npm whoami", true);
|
|
90
|
+
if (!npmUser) {
|
|
91
|
+
spinner3.fail(`${colors.blue("[3/11]")} 检查 npm 登录状态`);
|
|
92
|
+
console.log(colors.red("✖ 未登录 npm,请先执行: npm login"));
|
|
93
|
+
process.exit(1);
|
|
94
|
+
}
|
|
95
|
+
spinner3.succeed(
|
|
96
|
+
`${colors.blue("[3/11]")} 检查 npm 登录状态 ${colors.dim(
|
|
97
|
+
`(${npmUser.trim()})`
|
|
98
|
+
)}`
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
// 获取当前分支
|
|
102
|
+
const currentBranch = exec("git branch --show-current", true).trim();
|
|
103
|
+
|
|
104
|
+
// [4] 拉取最新代码
|
|
105
|
+
if (!runStep(4, "拉取最新代码", `git pull origin ${currentBranch}`)) {
|
|
106
|
+
process.exit(1);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// 获取当前版本
|
|
110
|
+
const pkg = JSON.parse(readFileSync("./package.json", "utf-8"));
|
|
111
|
+
const currentVersion = pkg.version;
|
|
112
|
+
|
|
113
|
+
// [5] 选择新版本号
|
|
114
|
+
console.log(`${colors.blue("[5/11]")} 选择新版本号...`);
|
|
115
|
+
console.log("");
|
|
116
|
+
|
|
117
|
+
try {
|
|
118
|
+
execSync("npm run version", { stdio: "inherit" });
|
|
119
|
+
} catch (error) {
|
|
120
|
+
console.log("");
|
|
121
|
+
console.log(colors.yellow("已取消发布"));
|
|
122
|
+
process.exit(0);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// 获取新版本
|
|
126
|
+
const newPkg = JSON.parse(readFileSync("./package.json", "utf-8"));
|
|
127
|
+
const newVersion = newPkg.version;
|
|
128
|
+
|
|
129
|
+
if (newVersion === currentVersion) {
|
|
130
|
+
console.log(colors.cyan("版本号未更改,已取消发布"));
|
|
131
|
+
process.exit(0);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// 清除上面的输出,重新显示步骤5
|
|
135
|
+
// 需要清除:
|
|
136
|
+
// - "[5/11] 选择新版本号..." (1行)
|
|
137
|
+
// - 空行 (1行)
|
|
138
|
+
// - npm run version 的所有输出 (约11行)
|
|
139
|
+
// 总共 13 行
|
|
140
|
+
const linesToClear = 13;
|
|
141
|
+
|
|
142
|
+
for (let i = 0; i < linesToClear; i++) {
|
|
143
|
+
process.stdout.write("\x1b[1A"); // 向上移动一行
|
|
144
|
+
process.stdout.write("\x1b[2K"); // 清除整行
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
console.log(
|
|
148
|
+
`${colors.green("✔")} ${colors.blue("[5/11]")} 选择新版本号 ${colors.dim(
|
|
149
|
+
`(${currentVersion} → ${newVersion})`
|
|
150
|
+
)}`
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
// [6] 构建项目
|
|
154
|
+
if (!runStep(6, "构建项目", "npm run build")) {
|
|
155
|
+
process.exit(1);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// [7] 生成 CHANGELOG
|
|
159
|
+
if (!runStep(7, "生成 CHANGELOG", "npm run changelog")) {
|
|
160
|
+
process.exit(1);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// [8] 提交版本更新
|
|
164
|
+
const spinner8 = ora({
|
|
165
|
+
text: `${colors.blue("[8/11]")} 提交版本更新...`,
|
|
166
|
+
spinner: "dots",
|
|
167
|
+
}).start();
|
|
168
|
+
|
|
169
|
+
try {
|
|
170
|
+
execSync("git add package.json CHANGELOG.md", { stdio: "pipe" });
|
|
171
|
+
execSync(`git commit -m "🔖 chore(release): 发布 v${newVersion}"`, {
|
|
172
|
+
stdio: "pipe",
|
|
173
|
+
});
|
|
174
|
+
spinner8.succeed(
|
|
175
|
+
`${colors.blue("[8/11]")} 提交版本更新 ${colors.dim(
|
|
176
|
+
`(🔖 chore(release): 发布 v${newVersion})`
|
|
177
|
+
)}`
|
|
178
|
+
);
|
|
179
|
+
} catch (error) {
|
|
180
|
+
spinner8.fail(`${colors.blue("[8/11]")} 提交版本更新`);
|
|
181
|
+
console.log("");
|
|
182
|
+
console.log(colors.red("错误详情:"));
|
|
183
|
+
console.log(error.message);
|
|
184
|
+
process.exit(1);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// [9] 创建 Git Tag
|
|
188
|
+
const spinner9 = ora({
|
|
189
|
+
text: `${colors.blue("[9/11]")} 创建 Git Tag...`,
|
|
190
|
+
spinner: "dots",
|
|
191
|
+
}).start();
|
|
192
|
+
|
|
193
|
+
try {
|
|
194
|
+
execSync(`git tag -a "v${newVersion}" -m "Release v${newVersion}"`, {
|
|
195
|
+
stdio: "pipe",
|
|
196
|
+
});
|
|
197
|
+
spinner9.succeed(
|
|
198
|
+
`${colors.blue("[9/11]")} 创建 Git Tag ${colors.dim(`(v${newVersion})`)}`
|
|
199
|
+
);
|
|
200
|
+
} catch (error) {
|
|
201
|
+
spinner9.fail(`${colors.blue("[9/11]")} 创建 Git Tag`);
|
|
202
|
+
console.log("");
|
|
203
|
+
console.log(colors.red("错误详情:"));
|
|
204
|
+
console.log(error.message);
|
|
205
|
+
process.exit(1);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// [10] 推送到远程仓库
|
|
209
|
+
const spinner10 = ora({
|
|
210
|
+
text: `${colors.blue("[10/11]")} 推送到远程仓库...`,
|
|
211
|
+
spinner: "dots",
|
|
212
|
+
}).start();
|
|
213
|
+
|
|
214
|
+
try {
|
|
215
|
+
execSync(`git push origin ${currentBranch}`, { stdio: "pipe" });
|
|
216
|
+
execSync(`git push origin v${newVersion}`, { stdio: "pipe" });
|
|
217
|
+
spinner10.succeed(
|
|
218
|
+
`${colors.blue("[10/11]")} 推送到远程仓库 ${colors.dim(
|
|
219
|
+
`(${currentBranch}, v${newVersion})`
|
|
220
|
+
)}`
|
|
221
|
+
);
|
|
222
|
+
} catch (error) {
|
|
223
|
+
spinner10.fail(`${colors.blue("[10/11]")} 推送到远程仓库`);
|
|
224
|
+
console.log("");
|
|
225
|
+
console.log(colors.red("错误详情:"));
|
|
226
|
+
console.log(error.message);
|
|
227
|
+
process.exit(1);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// [11] 发布到 npm
|
|
231
|
+
const spinner11 = ora({
|
|
232
|
+
text: `${colors.blue("[11/11]")} 发布到 npm...`,
|
|
233
|
+
spinner: "dots",
|
|
234
|
+
}).start();
|
|
235
|
+
|
|
236
|
+
// 停止 spinner,保持交互式
|
|
237
|
+
spinner11.stop();
|
|
238
|
+
|
|
239
|
+
console.log(`${colors.blue("[11/11]")} 发布到 npm...`);
|
|
240
|
+
console.log("");
|
|
241
|
+
|
|
242
|
+
try {
|
|
243
|
+
execSync("npm publish", { stdio: "inherit" });
|
|
244
|
+
|
|
245
|
+
// 清除 npm publish 的所有输出
|
|
246
|
+
// 根据实际测试,npm publish 输出约 50-60 行
|
|
247
|
+
// 包括:prepublishOnly、build、prepare、husky、npm notice、认证等
|
|
248
|
+
// 为了确保清除干净,使用 60 行
|
|
249
|
+
const linesToClear = 60;
|
|
250
|
+
|
|
251
|
+
for (let i = 0; i < linesToClear; i++) {
|
|
252
|
+
process.stdout.write("\x1b[1A");
|
|
253
|
+
process.stdout.write("\x1b[2K");
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
console.log(`${colors.green("✔")} ${colors.blue("[11/11]")} 发布到 npm`);
|
|
257
|
+
} catch (error) {
|
|
258
|
+
console.log("");
|
|
259
|
+
console.log(`${colors.red("✖")} ${colors.blue("[11/11]")} 发布到 npm`);
|
|
260
|
+
process.exit(1);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// 成功总结
|
|
264
|
+
console.log("");
|
|
265
|
+
console.log(
|
|
266
|
+
boxen(
|
|
267
|
+
[
|
|
268
|
+
colors.bold("🎉 发布成功!"),
|
|
269
|
+
"",
|
|
270
|
+
`${colors.cyan("版本:")} ${colors.bold(`v${newVersion}`)}`,
|
|
271
|
+
].join("\n"),
|
|
272
|
+
{
|
|
273
|
+
padding: { top: 1, bottom: 1, left: 8, right: 8 },
|
|
274
|
+
margin: { top: 0, bottom: 1, left: 0, right: 0 },
|
|
275
|
+
borderStyle: "round",
|
|
276
|
+
borderColor: "green",
|
|
277
|
+
align: "center",
|
|
278
|
+
}
|
|
279
|
+
)
|
|
280
|
+
);
|
|
281
|
+
|
|
282
|
+
console.log(
|
|
283
|
+
` ${colors.dim("🔗")} ${colors.cyan("GitHub:")} ${colors.dim(
|
|
284
|
+
"\x1b[4mhttps://github.com/iamzjt-front-end/git-workflow/releases/tag/v" +
|
|
285
|
+
newVersion +
|
|
286
|
+
"\x1b[0m"
|
|
287
|
+
)}`
|
|
288
|
+
);
|
|
289
|
+
console.log(
|
|
290
|
+
` ${colors.dim("📦")} ${colors.cyan("npm:")} ${colors.dim(
|
|
291
|
+
"\x1b[4mhttps://www.npmjs.com/package/@zjex/git-workflow\x1b[0m"
|
|
292
|
+
)}`
|
|
293
|
+
);
|
|
294
|
+
console.log("");
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
main().catch((error) => {
|
|
298
|
+
console.error(error);
|
|
299
|
+
process.exit(1);
|
|
300
|
+
});
|
package/scripts/publish.sh
CHANGED
|
@@ -25,20 +25,46 @@ print_dim() {
|
|
|
25
25
|
echo -e "${DIM} ${1}${NC}"
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
#
|
|
28
|
+
# 执行步骤(带 loading 动画和完成标记,折叠输出)
|
|
29
29
|
run_step() {
|
|
30
30
|
local step_num=$1
|
|
31
31
|
local step_name=$2
|
|
32
32
|
local command=$3
|
|
33
33
|
|
|
34
|
+
# 显示初始状态
|
|
34
35
|
echo -ne "${BLUE}[${step_num}/${TOTAL_STEPS}]${NC} ${step_name}... "
|
|
35
36
|
|
|
36
|
-
#
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
# 创建临时文件存储输出
|
|
38
|
+
local tmp_output=$(mktemp)
|
|
39
|
+
local tmp_status=$(mktemp)
|
|
40
|
+
|
|
41
|
+
# 在后台执行命令
|
|
42
|
+
(eval "$command" > "$tmp_output" 2>&1; echo $? > "$tmp_status") &
|
|
43
|
+
local pid=$!
|
|
44
|
+
|
|
45
|
+
# 显示 loading 动画
|
|
46
|
+
local spin='⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏'
|
|
47
|
+
local i=0
|
|
48
|
+
|
|
49
|
+
while kill -0 $pid 2>/dev/null; do
|
|
50
|
+
i=$(( (i+1) % 10 ))
|
|
51
|
+
printf "\r${BLUE}[${step_num}/${TOTAL_STEPS}]${NC} ${step_name}... ${spin:$i:1} "
|
|
52
|
+
sleep 0.1
|
|
53
|
+
done
|
|
54
|
+
|
|
55
|
+
wait $pid
|
|
56
|
+
local exit_code=$(cat "$tmp_status")
|
|
57
|
+
local output=$(cat "$tmp_output")
|
|
58
|
+
|
|
59
|
+
# 清理临时文件
|
|
60
|
+
rm -f "$tmp_output" "$tmp_status"
|
|
61
|
+
|
|
62
|
+
# 显示结果
|
|
63
|
+
if [ "$exit_code" -eq 0 ]; then
|
|
64
|
+
printf "\r${BLUE}[${step_num}/${TOTAL_STEPS}]${NC} ${step_name}... ${GREEN}✅${NC}\n"
|
|
39
65
|
return 0
|
|
40
66
|
else
|
|
41
|
-
|
|
67
|
+
printf "\r${BLUE}[${step_num}/${TOTAL_STEPS}]${NC} ${step_name}... ${RED}❌${NC}\n"
|
|
42
68
|
echo ""
|
|
43
69
|
echo -e "${RED}错误详情:${NC}"
|
|
44
70
|
echo "$output"
|
|
@@ -186,7 +212,16 @@ else
|
|
|
186
212
|
fi
|
|
187
213
|
|
|
188
214
|
# [11] 发布到 npm
|
|
189
|
-
|
|
215
|
+
echo -e "${BLUE}[11/${TOTAL_STEPS}]${NC} 发布到 npm..."
|
|
216
|
+
echo ""
|
|
217
|
+
|
|
218
|
+
# 执行发布(保持交互式,允许 OTP 输入)
|
|
219
|
+
if npm publish; then
|
|
220
|
+
echo ""
|
|
221
|
+
echo -e "${BLUE}[11/${TOTAL_STEPS}]${NC} 发布到 npm... ${GREEN}✅${NC}"
|
|
222
|
+
else
|
|
223
|
+
echo ""
|
|
224
|
+
echo -e "${BLUE}[11/${TOTAL_STEPS}]${NC} 发布到 npm... ${RED}❌${NC}"
|
|
190
225
|
exit 1
|
|
191
226
|
fi
|
|
192
227
|
|
package/scripts/README.md
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
# 发布脚本
|
|
2
|
-
|
|
3
|
-
## 使用方法
|
|
4
|
-
|
|
5
|
-
```bash
|
|
6
|
-
# 预览发布流程(推荐先执行)
|
|
7
|
-
npm run release:dry
|
|
8
|
-
|
|
9
|
-
# 实际发布
|
|
10
|
-
npm run release
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## 优化特性
|
|
14
|
-
|
|
15
|
-
### ✅ 已实现的优化
|
|
16
|
-
|
|
17
|
-
1. **Dry-run 模式** - 预览发布流程,不实际执行
|
|
18
|
-
2. **自动回滚** - 出错时自动恢复 package.json、删除 tag、回退 commit
|
|
19
|
-
3. **多重确认** - 版本选择、CHANGELOG 预览、最终发布三次确认
|
|
20
|
-
4. **完整验证**
|
|
21
|
-
- npm 登录状态检查
|
|
22
|
-
- 版本号重复检查
|
|
23
|
-
- 构建产物验证
|
|
24
|
-
- 测试运行(如果有)
|
|
25
|
-
5. **CHANGELOG 预览** - 生成后显示最新内容并确认
|
|
26
|
-
6. **错误处理** - 完善的错误捕获和提示
|
|
27
|
-
7. **友好输出** - 带颜色的步骤提示和进度显示
|
|
28
|
-
|
|
29
|
-
## 前置条件
|
|
30
|
-
|
|
31
|
-
- 确保已登录 npm:`npm login`
|
|
32
|
-
- 确保有 GitHub 推送权限
|
|
33
|
-
- 确保在 main/master 分支(或确认在其他分支发布)
|
|
34
|
-
- 确保没有未提交的更改
|
|
35
|
-
|
|
36
|
-
## 发布流程
|
|
37
|
-
|
|
38
|
-
1. 检查必要命令(git, node, npm)
|
|
39
|
-
2. 检查 npm 登录状态
|
|
40
|
-
3. 检查 git 仓库状态
|
|
41
|
-
4. 拉取最新代码
|
|
42
|
-
5. 选择版本号
|
|
43
|
-
6. 检查版本是否已存在
|
|
44
|
-
7. 运行测试(如果有)
|
|
45
|
-
8. 构建项目
|
|
46
|
-
9. 验证构建产物
|
|
47
|
-
10. 生成 CHANGELOG
|
|
48
|
-
11. 预览并确认
|
|
49
|
-
12. 最终确认
|
|
50
|
-
13. 提交更改
|
|
51
|
-
14. 创建 tag
|
|
52
|
-
15. 推送到 GitHub
|
|
53
|
-
16. 发布到 npm
|
|
54
|
-
|
|
55
|
-
## 使用示例
|
|
56
|
-
|
|
57
|
-
详见主 README 的发布部分。
|
package/test-box.sh
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
GREEN='\033[0;32m'
|
|
4
|
-
CYAN='\033[0;36m'
|
|
5
|
-
BOLD='\033[1m'
|
|
6
|
-
NC='\033[0m'
|
|
7
|
-
|
|
8
|
-
NEW_VERSION="0.2.8"
|
|
9
|
-
|
|
10
|
-
echo ""
|
|
11
|
-
echo -e "${GREEN}╭──────────────────────────────╮${NC}"
|
|
12
|
-
echo -e "${GREEN}│ │${NC}"
|
|
13
|
-
echo -e "${GREEN}│${NC} ${BOLD}🎉 发布成功!${NC} ${GREEN}│${NC}"
|
|
14
|
-
echo -e "${GREEN}│ │${NC}"
|
|
15
|
-
echo -e "${GREEN}│${NC} ${CYAN}版本:${NC} ${BOLD}v${NEW_VERSION}${NC} ${GREEN}│${NC}"
|
|
16
|
-
echo -e "${GREEN}│ │${NC}"
|
|
17
|
-
echo -e "${GREEN}╰──────────────────────────────╯${NC}"
|
|
18
|
-
echo ""
|
package/test-full-publish.sh
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
BLUE='\033[0;34m'
|
|
4
|
-
GREEN='\033[0;32m'
|
|
5
|
-
CYAN='\033[0;36m'
|
|
6
|
-
DIM='\033[2m'
|
|
7
|
-
BOLD='\033[1m'
|
|
8
|
-
NC='\033[0m'
|
|
9
|
-
|
|
10
|
-
TOTAL_STEPS=11
|
|
11
|
-
NEW_VERSION="0.2.8"
|
|
12
|
-
CURRENT_BRANCH="main"
|
|
13
|
-
|
|
14
|
-
echo ""
|
|
15
|
-
echo -e "${BOLD}🚀 开始发布流程${NC}"
|
|
16
|
-
echo ""
|
|
17
|
-
|
|
18
|
-
echo -e "${BLUE}[1/${TOTAL_STEPS}]${NC} 检查 Git 仓库... ${GREEN}✅${NC}"
|
|
19
|
-
echo -e "${BLUE}[2/${TOTAL_STEPS}]${NC} 检查工作区状态... ${GREEN}✅${NC}"
|
|
20
|
-
echo -e "${BLUE}[3/${TOTAL_STEPS}]${NC} 检查 npm 登录状态... ${GREEN}✅${NC} ${DIM}(zjex)${NC}"
|
|
21
|
-
echo -e "${BLUE}[4/${TOTAL_STEPS}]${NC} 拉取最新代码... ${GREEN}✅${NC}"
|
|
22
|
-
echo -e "${BLUE}[5/${TOTAL_STEPS}]${NC} 选择新版本号... ${GREEN}✅${NC} ${DIM}(0.2.7 → 0.2.8)${NC}"
|
|
23
|
-
echo -e "${BLUE}[6/${TOTAL_STEPS}]${NC} 构建项目... ${GREEN}✅${NC}"
|
|
24
|
-
echo -e "${BLUE}[7/${TOTAL_STEPS}]${NC} 生成 CHANGELOG... ${GREEN}✅${NC}"
|
|
25
|
-
echo -e "${BLUE}[8/${TOTAL_STEPS}]${NC} 提交版本更新... ${GREEN}✅${NC} ${DIM}(🔖 chore(release): 发布 v${NEW_VERSION})${NC}"
|
|
26
|
-
echo -e "${BLUE}[9/${TOTAL_STEPS}]${NC} 创建 Git Tag... ${GREEN}✅${NC} ${DIM}(v${NEW_VERSION})${NC}"
|
|
27
|
-
echo -e "${BLUE}[10/${TOTAL_STEPS}]${NC} 推送到远程仓库... ${GREEN}✅${NC} ${DIM}(${CURRENT_BRANCH}, v${NEW_VERSION})${NC}"
|
|
28
|
-
echo -e "${BLUE}[11/${TOTAL_STEPS}]${NC} 发布到 npm... ${GREEN}✅${NC}"
|
|
29
|
-
|
|
30
|
-
node scripts/publish-success.js "${NEW_VERSION}"
|
package/zjex.svg
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg data-v-0dd9719b="" version="1.0" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%" viewBox="0 0 340.000000 250.000000" preserveAspectRatio="xMidYMid meet" color-interpolation-filters="sRGB" style="margin: auto;"> <rect data-v-0dd9719b="" x="0" y="0" width="100%" height="100%" fill="#fff" fill-opacity="1" class="background"></rect> <rect data-v-0dd9719b="" x="0" y="0" width="100%" height="100%" fill="url(#watermark)" fill-opacity="1" class="watermarklayer"></rect> <g data-v-0dd9719b="" fill="#333" class="icon-text-wrapper icon-svg-group iconsvg" transform="translate(62.92499542236328,95.46575355529785)"><g class="iconsvg-imagesvg" transform="translate(0,0)"><g><rect fill="#333" fill-opacity="0" stroke-width="2" x="0" y="0" width="60" height="59.06848991405534" class="image-rect"></rect> <svg x="0" y="0" width="60" height="59.06848991405534" filtersec="colorsb2691092612" class="image-svg-svg primary" style="overflow: visible;"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0.4385022521018982 -0.000009216904800268821 101.5615005493164 99.98497772216797"><path d="M69.3 59.41l-9.89 9.89L51 77.73 30.46 98.26A6 6 0 0 1 22 89.83L42.56 69.3 51 60.88l9.9-9.9zM102 24.28a6 6 0 0 1-1.75 4.21L77.72 51l-8.42-8.44 22.5-22.5a6 6 0 0 1 10.2 4.22z" fill="#0059cc"></path><path d="M83.64 6a5.94 5.94 0 0 1-1.74 4.21L41.08 51l-8.42-8.42 9.9-9.89L51 24.24 73.48 1.75A6 6 0 0 1 83.64 6zM32.66 59.41L12.13 79.93a6 6 0 0 1-8.42-8.42L24.24 51z" fill="#00dac7"></path><path d="M51 24.24l-8.42 8.43-22.5-22.5A6 6 0 0 1 24.28 0a5.89 5.89 0 0 1 4.2 1.75zM98.25 79.93a5.94 5.94 0 0 1-8.42 0L51 41.09l8.42-8.42 9.9 9.89 8.4 8.44 20.53 20.51a6 6 0 0 1 0 8.42z" fill="#00baec"></path><path d="M51 60.88l-8.44 8.42L1.74 28.49a6 6 0 0 1 8.43-8.43l22.49 22.5L41.08 51zM79.93 98.26a6 6 0 0 1-8.42 0L51 77.73l8.42-8.43 20.51 20.53a6 6 0 0 1 0 8.43z" fill="#00abd8"></path></svg></svg> <!----></g></g> <g transform="translate(67,0.3792438507080078)"><g data-gra="path-name" fill-rule="" class="tp-name iconsvg-namesvg"><g transform="scale(1)"><g><path d="M36.2-46.02L36.2-46.02 36.2-44.72 13.97-1.5 20.73-1.5Q22.95-1.5 25.19-2.21 27.43-2.93 29.35-4.55 31.27-6.17 32.63-8.87 34-11.57 34.45-15.6L34.45-15.6 35.95-15.6Q35.75-13.39 35.75-9.88L35.75-9.88Q35.75-8.38 35.81-5.66 35.88-2.93 36.2 0L36.2 0Q32.63-0.13 28.11-0.16 23.6-0.2 20.02-0.2L20.02-0.2Q15.79-0.2 11.18-0.16 6.57-0.13 2.54 0L2.54 0 2.54-1.3 24.83-44.52 17.81-44.52Q14.56-44.52 11.83-43.32 9.1-42.12 7.28-39.23 5.46-36.34 4.81-31.2L4.81-31.2 3.31-31.2Q3.45-32.11 3.48-33.41 3.51-34.71 3.51-36.14L3.51-36.14Q3.51-37.63 3.41-40.37 3.31-43.09 3.06-46.02L3.06-46.02Q6.31-45.89 10.37-45.86 14.43-45.83 17.68-45.83L17.68-45.83Q22.04-45.83 26.98-45.86 31.92-45.89 36.2-46.02ZM37.64 12.22L37.64 12.22 37.64 10.92Q40.23 10.66 42.05 9.39 43.88 8.13 44.85 5.07 45.83 2.02 45.83-3.51L45.83-3.51 45.83-39.13Q45.83-41.54 45.47-42.67 45.11-43.81 44.07-44.23 43.03-44.66 40.95-44.72L40.95-44.72 40.95-46.02Q42.58-45.95 45.21-45.89 47.84-45.83 50.77-45.83L50.77-45.83Q53.69-45.83 56.45-45.89 59.22-45.95 61.04-46.02L61.04-46.02 61.04-44.72Q59.02-44.66 57.95-44.23 56.88-43.81 56.52-42.67 56.16-41.54 56.16-39.13L56.16-39.13 56.16-15.34Q56.16-12.68 56.16-9.59 56.16-6.5 55.93-3.58 55.7-0.65 55.06 1.63L55.06 1.63Q53.76 6.11 49.43 9.17 45.11 12.22 37.64 12.22ZM99.78-46.02L99.78-46.02Q99.52-43.16 99.42-40.5 99.32-37.83 99.32-36.4L99.32-36.4Q99.32-35.1 99.39-33.93 99.45-32.76 99.52-31.98L99.52-31.98 98.02-31.98Q97.37-36.73 96.01-39.49 94.64-42.25 92.46-43.39 90.29-44.52 87.36-44.52L87.36-44.52 84.7-44.52Q82.75-44.52 81.8-44.2 80.86-43.88 80.54-42.93 80.21-41.99 80.21-39.91L80.21-39.91 80.21-6.11Q80.21-4.09 80.54-3.12 80.86-2.15 81.8-1.82 82.75-1.5 84.7-1.5L84.7-1.5 87.88-1.5Q90.81-1.5 93.05-2.76 95.29-4.03 96.88-7.08 98.48-10.14 99.32-15.34L99.32-15.34 100.81-15.34Q100.62-13.26 100.62-9.88L100.62-9.88Q100.62-8.38 100.69-5.66 100.75-2.93 101.08 0L101.08 0Q97.76-0.13 93.6-0.16 89.44-0.2 86.19-0.2L86.19-0.2Q83.98-0.2 80.34-0.2 76.7-0.2 72.61-0.16 68.51-0.13 65 0L65 0 65-1.3Q67.08-1.43 68.12-1.82 69.16-2.21 69.52-3.38 69.88-4.55 69.88-6.89L69.88-6.89 69.88-39.13Q69.88-41.54 69.52-42.67 69.16-43.81 68.09-44.23 67.02-44.66 65-44.72L65-44.72 65-46.02Q68.51-45.95 72.61-45.89 76.7-45.83 80.34-45.83 83.98-45.83 86.19-45.83L86.19-45.83Q89.18-45.83 92.98-45.86 96.79-45.89 99.78-46.02ZM78.26-23.79L89.64-23.79Q89.64-23.79 89.64-23.14 89.64-22.49 89.64-22.49L89.64-22.49 78.26-22.49Q78.26-22.49 78.26-23.14 78.26-23.79 78.26-23.79L78.26-23.79ZM90.03-32.37L91.52-32.37Q91.26-28.67 91.29-26.71 91.33-24.77 91.33-23.14L91.33-23.14Q91.33-21.52 91.39-19.57 91.46-17.62 91.72-13.91L91.72-13.91 90.22-13.91Q89.9-16.19 89.02-18.14 88.14-20.09 86.52-21.29 84.89-22.49 82.29-22.49L82.29-22.49 82.29-23.79Q84.89-23.79 86.45-25.22 88.01-26.65 88.86-28.63 89.7-30.62 90.03-32.37L90.03-32.37ZM123.44-46.09L123.44-46.09 123.44-44.72Q120.51-44.72 119.7-44.17 118.89-43.62 119.8-42.25L119.8-42.25 145.53-4.62Q146.84-2.79 147.62-2.15 148.4-1.5 149.69-1.36L149.69-1.36 149.69 0Q148.4-0.07 145.93-0.16 143.45-0.26 140.79-0.26L140.79-0.26Q137.87-0.26 134.84-0.16 131.82-0.07 130.32 0L130.32 0 130.32-1.36Q133.31-1.36 134.19-1.79 135.07-2.21 134.16-3.58L134.16-3.58 108.36-41.47Q107.12-43.36 106.34-44.01 105.56-44.66 104.19-44.72L104.19-44.72 104.19-46.09Q105.56-46.02 108.19-45.92 110.83-45.83 113.49-45.83L113.49-45.83Q116.42-45.83 119.11-45.92 121.81-46.02 123.44-46.09ZM113.75-9.23L124.02-23.14Q124.02-23.14 124.28-22.3 124.54-21.45 124.54-21.45L124.54-21.45 118.04-12.54Q115.44-9.04 115.11-6.6 114.79-4.16 116.25-2.83 117.72-1.5 120.58-1.3L120.58-1.3 120.58 0Q119.34-0.07 117.33-0.1 115.31-0.13 113.36-0.16 111.41-0.2 110.31-0.2L110.31-0.2Q106.41-0.2 104.33 0L104.33 0 104.33-1.3Q106.6-2.08 108.94-4.06 111.28-6.04 113.75-9.23L113.75-9.23ZM146.77-46.02L146.77-46.02 146.77-44.72Q144.63-44.13 142.51-42.25 140.4-40.37 138.58-37.9L138.58-37.9 128.05-23.86Q128.05-23.86 127.82-24.7 127.59-25.55 127.59-25.55L127.59-25.55 134.29-34.58Q138-39.33 137.28-41.93 136.56-44.52 132.6-44.72L132.6-44.72 132.6-46.02Q134.49-45.95 136.82-45.89 139.16-45.83 140.79-45.83L140.79-45.83Q144.69-45.83 146.77-46.02Z" transform="translate(-2.5399999618530273, 46.09000015258789)"></path></g> <!----> <!----> <!----> <!----> <!----> <!----> <!----></g></g> <!----></g></g><defs v-gra="od"></defs></svg>
|