Skip to content

Commit 2f5fb12

Browse files
committed
chore: release 0.1.1
1 parent 037f2d3 commit 2f5fb12

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-maui",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "React Native UI Library",
55
"main": "src/index",
66
"scripts": {

publish.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
3+
# 检查是否以root用户运行
4+
if [ "$(id -u)" -eq 0 ]; then
5+
echo "This script should not be run as root"
6+
exit 1
7+
fi
8+
9+
# 切换到npm官方源
10+
echo "Switching npm registry to https://registry.npmjs.org/"
11+
npm config set registry https://registry.npmjs.org/
12+
13+
# 验证是否切换成功
14+
current_registry=$(npm config get registry)
15+
if [ "$current_registry" != "https://registry.npmjs.org/" ]; then
16+
echo "Failed to switch npm registry to https://registry.npmjs.org/"
17+
exit 1
18+
fi
19+
20+
echo "npm registry has been switched to https://registry.npmjs.org/"
21+
22+
# 执行npm publish命令
23+
echo "Executing npm publish..."
24+
npm publish
25+
publish_status=$?
26+
27+
# 检查publish命令是否成功
28+
if [ $publish_status -ne 0 ]; then
29+
echo "npm publish failed"
30+
# 切换回npmmirror源之前先退出脚本,避免进一步操作
31+
exit $publish_status
32+
fi
33+
34+
echo "npm publish succeeded"
35+
36+
# 切换到npmmirror源
37+
echo "Switching npm registry back to https://registry.npmmirror.com/"
38+
npm config set registry https://registry.npmmirror.com/
39+
40+
# 验证是否切换成功
41+
current_registry=$(npm config get registry)
42+
if [ "$current_registry" != "https://registry.npmmirror.com/" ]; then
43+
echo "Failed to switch npm registry to https://registry.npmmirror.com/"
44+
exit 1
45+
fi
46+
47+
echo "npm registry has been switched back to https://registry.npmmirror.com/"
48+
49+
echo "Script execution completed successfully"
50+
exit 0

0 commit comments

Comments
 (0)