更新仓库地址
This commit is contained in:
8
Makefile
8
Makefile
@@ -3,10 +3,10 @@
|
||||
# 设置变量
|
||||
BUF := buf
|
||||
GEN_DIR := gen
|
||||
GO_MOD := git.0yue.com/shenxianhe/sdk
|
||||
GO_SDK_REPO := https://git.0yue.com/shenxianhe/sdk.git
|
||||
TS_PACKAGE_NAME := @shenxianhe/sdk
|
||||
TS_SDK_REPO := https://git.0yue.com/shenxianhe/sdk-ts.git
|
||||
GO_MOD := git.shenxianhe.cn/shenxianhe/sdk
|
||||
GO_SDK_REPO := https://git.shenxianhe.cn/shenxianhe/sdk.git
|
||||
TS_PACKAGE_NAME := @connect/sdk
|
||||
TS_SDK_REPO := https://git.shenxianhe.cn/shenxianhe/sdk-ts.git
|
||||
|
||||
# 默认目标 - 显示帮助信息
|
||||
.DEFAULT_GOAL := help
|
||||
|
||||
10
README.md
10
README.md
@@ -6,10 +6,10 @@
|
||||
|
||||
## SDK 地址
|
||||
|
||||
| SDK类型 | 地址 |
|
||||
|--------|------|
|
||||
| Go SDK | `https://git.0yue.com/shenxianhe/sdk` |
|
||||
| TypeScript SDK | `https://git.0yue.com/shenxianhe/-/packages/npm/@shenxianhe%2Fsdk` |
|
||||
| SDK 类型 | 地址 |
|
||||
| -------------- | -------------------------------------------------------------------- |
|
||||
| Go SDK | `https://git.shenxianhe.cn/shenxianhe/sdk` |
|
||||
| TypeScript SDK | `https://git.shenxianhe.cn/shenxianhe/-/packages/npm/@connect%2Fsdk` |
|
||||
|
||||
## 目录结构
|
||||
|
||||
@@ -45,7 +45,6 @@ npm install -g @bufbuild/protoc-gen-es
|
||||
|
||||
> 提示:如果安装后找不到命令,需要确保工具的 bin 目录已添加到系统 PATH 环境变量中。如果是使用 brew 安装的软件,可以执行 `brew unlink name && brew link name` 来解决。 如:`brew unlink node && brew link node`
|
||||
|
||||
|
||||
### 修改 proto 文件后的工作流程
|
||||
|
||||
当你需要修改或添加 proto 文件时,请遵循以下工作流程:
|
||||
@@ -79,6 +78,7 @@ npm install -g @bufbuild/protoc-gen-es
|
||||
## Makefile 命令提示
|
||||
|
||||
执行 `make help` 可查看所有可用命令和详细说明。主要命令包括:
|
||||
|
||||
- `make generate`: 生成 SDK 代码
|
||||
- `make publish`: 发布 SDK 到各个仓库
|
||||
|
||||
|
||||
@@ -27,16 +27,16 @@ cd "$WORK_DIR"
|
||||
|
||||
# 设置npm注册表
|
||||
echo "设置npm注册表..."
|
||||
npm config set @shenxianhe:registry=https://git.0yue.com/api/packages/shenxianhe/npm/
|
||||
npm config set @shenxianhe:registry=https://git.shenxianhe.cn/api/packages/shenxianhe/npm/
|
||||
|
||||
|
||||
|
||||
# 配置npm认证(如果提供了环境变量)
|
||||
configure_npm_auth() {
|
||||
# 如果设置了 SHENXIANHE_AUTH_TOKEN 变量,则配置npm
|
||||
if [ -n "$SHENXIANHE_AUTH_TOKEN" ]; then
|
||||
echo "检测到 SHENXIANHE_AUTH_TOKEN 环境变量,配置npm认证..."
|
||||
npm config set -- '//git.0yue.com/api/packages/shenxianhe/npm/:_authToken' "$SHENXIANHE_AUTH_TOKEN"
|
||||
# 如果设置了 CONNECT_AUTH_TOKEN 变量,则配置npm
|
||||
if [ -n "$CONNECT_AUTH_TOKEN" ]; then
|
||||
echo "检测到 CONNECT_AUTH_TOKEN 环境变量,配置npm认证..."
|
||||
npm config set -- '//git.shenxianhe.cn/api/packages/shenxianhe/npm/:_authToken' "$CONNECT_AUTH_TOKEN"
|
||||
fi
|
||||
|
||||
# 无论是否设置了环境变量,都继续执行(因为可能之前已经配置过npm)
|
||||
@@ -45,7 +45,7 @@ configure_npm_auth() {
|
||||
|
||||
# 显示认证错误提示信息
|
||||
display_auth_error() {
|
||||
echo "提示:如果是认证失败,请尝试设置环境变量:export SHENXIANHE_AUTH_TOKEN=your_access_token"
|
||||
echo "提示:如果是认证失败,请尝试设置环境变量:export CONNECT_AUTH_TOKEN=your_access_token"
|
||||
}
|
||||
|
||||
# 调用函数配置npm认证(如果有环境变量)
|
||||
@@ -55,7 +55,7 @@ configure_npm_auth
|
||||
check_package_exists() {
|
||||
echo "检查包 $PACKAGE_NAME@$VERSION 是否已存在..."
|
||||
# 使用npm view命令检查包是否存在
|
||||
if npm view "$PACKAGE_NAME@$VERSION" --registry=https://git.0yue.com/api/packages/shenxianhe/npm/ > /dev/null 2>&1; then
|
||||
if npm view "$PACKAGE_NAME@$VERSION" --registry=https://git.shenxianhe.cn/api/packages/shenxianhe/npm/ > /dev/null 2>&1; then
|
||||
return 0 # 包已存在
|
||||
else
|
||||
return 1 # 包不存在
|
||||
@@ -69,7 +69,7 @@ if check_package_exists; then
|
||||
read -r answer
|
||||
if [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
|
||||
echo "删除现有包 $PACKAGE_NAME@$VERSION..."
|
||||
npm unpublish --force "$PACKAGE_NAME@$VERSION" --registry=https://git.0yue.com/api/packages/shenxianhe/npm/
|
||||
npm unpublish --force "$PACKAGE_NAME@$VERSION" --registry=https://git.shenxianhe.cn/api/packages/shenxianhe/npm/
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "错误:删除包失败"
|
||||
display_auth_error
|
||||
@@ -83,7 +83,7 @@ fi
|
||||
|
||||
# 发布包
|
||||
echo "发布包 $PACKAGE_NAME@$VERSION..."
|
||||
npm publish --registry=https://git.0yue.com/api/packages/shenxianhe/npm/
|
||||
npm publish --registry=https://git.shenxianhe.cn/api/packages/shenxianhe/npm/
|
||||
|
||||
# 检查发布是否成功
|
||||
if [ $? -eq 0 ]; then
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
syntax = "proto3";
|
||||
package account.v1;
|
||||
option go_package = "git.0yue.com/shenxianhe/sdk/account/v1;accountv1";
|
||||
option go_package = "git.shenxianhe.cn/shenxianhe/sdk/account/v1;accountv1";
|
||||
|
||||
// 认证类型枚举
|
||||
enum AuthenticationType {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
syntax = "proto3";
|
||||
package notification.v1;
|
||||
option go_package = "git.0yue.com/shenxianhe/sdk/notification/v1;notificationv1";
|
||||
option go_package = "git.shenxianhe.cn/shenxianhe/sdk/notification/v1;notificationv1";
|
||||
|
||||
message SendSMSRequest {
|
||||
string phone = 1;
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
```go
|
||||
import (
|
||||
"context"
|
||||
"git.0yue.com/shenxianhe/sdk/account/v1"
|
||||
"git.0yue.com/shenxianhe/sdk/notification/v1"
|
||||
"git.shenxianhe.cn/shenxianhe/sdk/account/v1"
|
||||
"git.shenxianhe.cn/shenxianhe/sdk/notification/v1"
|
||||
"connectrpc.com/connect"
|
||||
)
|
||||
```
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.2.0
|
||||
1.4.0
|
||||
|
||||
Reference in New Issue
Block a user