From 53285ab91b41f65dc2ed1a8de00f49dacf06e133 Mon Sep 17 00:00:00 2001 From: sky Date: Sat, 30 Aug 2025 00:30:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=93=E5=BA=93=E5=9C=B0?= =?UTF-8?q?=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 8 ++++---- README.md | 10 +++++----- script/publish-npm.sh | 18 +++++++++--------- src/account/v1/account.proto | 2 +- src/notification/v1/notification.proto | 2 +- templates/go-sdk-readme.md | 4 ++-- version.txt | 2 +- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Makefile b/Makefile index 0e5a488..70cb95c 100644 --- a/Makefile +++ b/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 diff --git a/README.md b/README.md index 2d30361..628c6ae 100644 --- a/README.md +++ b/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 到各个仓库 diff --git a/script/publish-npm.sh b/script/publish-npm.sh index 7a29e1f..23ec9fa 100755 --- a/script/publish-npm.sh +++ b/script/publish-npm.sh @@ -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 diff --git a/src/account/v1/account.proto b/src/account/v1/account.proto index c9e9d1e..bc42199 100644 --- a/src/account/v1/account.proto +++ b/src/account/v1/account.proto @@ -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 { diff --git a/src/notification/v1/notification.proto b/src/notification/v1/notification.proto index f37c20b..38f59c4 100644 --- a/src/notification/v1/notification.proto +++ b/src/notification/v1/notification.proto @@ -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; diff --git a/templates/go-sdk-readme.md b/templates/go-sdk-readme.md index 381decc..1e8de6c 100644 --- a/templates/go-sdk-readme.md +++ b/templates/go-sdk-readme.md @@ -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" ) ``` diff --git a/version.txt b/version.txt index 26aaba0..88c5fb8 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.2.0 +1.4.0