ai-world-sdk 1.0.0 → 1.0.1
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/README.md +58 -23
- package/package.json +4 -7
package/README.md
CHANGED
|
@@ -921,6 +921,64 @@ try {
|
|
|
921
921
|
npm run build
|
|
922
922
|
```
|
|
923
923
|
|
|
924
|
+
这会执行以下操作:
|
|
925
|
+
- 清理 `dist/` 目录
|
|
926
|
+
- 编译 TypeScript 源代码到 `dist/` 目录
|
|
927
|
+
- **自动生成 `.d.ts` 类型声明文件**
|
|
928
|
+
|
|
929
|
+
#### 生成 TypeScript 声明文件 (.d.ts)
|
|
930
|
+
|
|
931
|
+
项目已配置为自动生成类型声明文件。配置说明:
|
|
932
|
+
|
|
933
|
+
1. **tsconfig.json 配置**:
|
|
934
|
+
```json
|
|
935
|
+
{
|
|
936
|
+
"compilerOptions": {
|
|
937
|
+
"declaration": true, // 启用声明文件生成
|
|
938
|
+
"outDir": "./dist", // 输出目录
|
|
939
|
+
"rootDir": "./src" // 源代码目录
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
```
|
|
943
|
+
|
|
944
|
+
2. **构建命令**:
|
|
945
|
+
```bash
|
|
946
|
+
npm run build
|
|
947
|
+
# 等同于: rm -rf dist && tsc
|
|
948
|
+
```
|
|
949
|
+
|
|
950
|
+
3. **生成的文件**:
|
|
951
|
+
运行构建后,`dist/` 目录会包含:
|
|
952
|
+
- `.js` 文件(编译后的 JavaScript)
|
|
953
|
+
- `.d.ts` 文件(TypeScript 类型声明)
|
|
954
|
+
|
|
955
|
+
例如:
|
|
956
|
+
```
|
|
957
|
+
dist/
|
|
958
|
+
├── index.js # 编译后的代码
|
|
959
|
+
├── index.d.ts # 类型声明文件
|
|
960
|
+
├── base.js
|
|
961
|
+
├── base.d.ts
|
|
962
|
+
└── ...
|
|
963
|
+
```
|
|
964
|
+
|
|
965
|
+
4. **package.json 配置**:
|
|
966
|
+
```json
|
|
967
|
+
{
|
|
968
|
+
"main": "dist/index.js",
|
|
969
|
+
"types": "dist/index.d.ts" // 指定类型声明文件入口
|
|
970
|
+
}
|
|
971
|
+
```
|
|
972
|
+
|
|
973
|
+
5. **验证声明文件**:
|
|
974
|
+
```bash
|
|
975
|
+
# 检查 dist 目录中的 .d.ts 文件
|
|
976
|
+
ls -la dist/*.d.ts
|
|
977
|
+
|
|
978
|
+
# 或者查看特定文件的声明
|
|
979
|
+
cat dist/index.d.ts
|
|
980
|
+
```
|
|
981
|
+
|
|
924
982
|
### 测试
|
|
925
983
|
|
|
926
984
|
```bash
|
|
@@ -962,29 +1020,6 @@ ai-world-sdk/
|
|
|
962
1020
|
npm install ai-world-sdk
|
|
963
1021
|
```
|
|
964
1022
|
|
|
965
|
-
### 发布到 npm
|
|
966
|
-
|
|
967
|
-
详细的发布指南请参考 [PUBLISH.md](./PUBLISH.md)。
|
|
968
|
-
|
|
969
|
-
**快速发布步骤:**
|
|
970
|
-
|
|
971
|
-
```bash
|
|
972
|
-
# 1. 构建项目
|
|
973
|
-
npm run build
|
|
974
|
-
|
|
975
|
-
# 2. 运行测试
|
|
976
|
-
npm test
|
|
977
|
-
|
|
978
|
-
# 3. 更新版本号(如果需要)
|
|
979
|
-
npm version patch # 或 minor, major
|
|
980
|
-
|
|
981
|
-
# 4. 登录 npm
|
|
982
|
-
npm login
|
|
983
|
-
|
|
984
|
-
# 5. 发布(scope 包需要 --access public)
|
|
985
|
-
npm publish --access public
|
|
986
|
-
```
|
|
987
|
-
|
|
988
1023
|
## 许可证
|
|
989
1024
|
|
|
990
1025
|
MIT
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-world-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "TypeScript SDK for AI World Platform - Chat Models, Image Generation, and Video Generation",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build": "tsc",
|
|
8
|
+
"build": "rm -rf dist && tsc",
|
|
9
9
|
"prepublishOnly": "npm run build",
|
|
10
10
|
"test": "jest",
|
|
11
11
|
"test:watch": "jest --watch",
|
|
@@ -35,12 +35,10 @@
|
|
|
35
35
|
"claude",
|
|
36
36
|
"doubao"
|
|
37
37
|
],
|
|
38
|
-
"author": "",
|
|
38
|
+
"author": "ai-world",
|
|
39
39
|
"license": "MIT",
|
|
40
|
-
"dependencies": {
|
|
41
|
-
"dotenv": "^16.0.0"
|
|
42
|
-
},
|
|
43
40
|
"devDependencies": {
|
|
41
|
+
"dotenv": "^16.0.0",
|
|
44
42
|
"@types/node": "^20.0.0",
|
|
45
43
|
"@types/jest": "^29.5.0",
|
|
46
44
|
"@types/dotenv": "^8.2.0",
|
|
@@ -53,4 +51,3 @@
|
|
|
53
51
|
"dist"
|
|
54
52
|
]
|
|
55
53
|
}
|
|
56
|
-
|