deepspider 0.2.9 → 0.2.10

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.
@@ -193,24 +193,48 @@ console.log('[DeepSpider:' + type + ']' + loc, data);
193
193
 
194
194
  ## Release Process
195
195
 
196
+ ### 原生模块依赖处理
197
+
198
+ 项目依赖 `isolated-vm` 等原生 C++ 模块,需要编译环境。
199
+
200
+ **postinstall 自动处理**:
201
+ ```json
202
+ {
203
+ "scripts": {
204
+ "postinstall": "patchright install chromium && npm rebuild isolated-vm 2>/dev/null || true"
205
+ }
206
+ }
207
+ ```
208
+
209
+ **编译环境要求**:
210
+ - macOS: `xcode-select --install`
211
+ - Ubuntu: `sudo apt install build-essential`
212
+ - Windows: Visual Studio Build Tools
213
+
214
+ > **注意**: `2>/dev/null || true` 确保编译失败不会阻塞安装,但沙箱功能可能不可用。
215
+
216
+ ---
217
+
196
218
  ### 版本发布流程
197
219
 
198
- 升级版本时必须同步创建 git tag
220
+ 升级版本并推送 tag,GitHub Actions 会自动发布到 npm
199
221
 
200
222
  ```bash
201
223
  # 1. 升级 package.json 版本
202
- npm version patch --no-git-tag-version
224
+ # 编辑 package.json 中的 version 字段
203
225
 
204
226
  # 2. 提交版本变更
205
227
  git add package.json
206
228
  git commit -m "chore: bump version to x.x.x"
207
229
 
208
230
  # 3. 创建并推送 git tag
209
- git tag vx.x.x
231
+ git tag -a vx.x.x -m "vx.x.x"
210
232
  git push && git push origin vx.x.x
211
233
  ```
212
234
 
213
- **原因**: npm 版本和 git tag 需要保持同步,便于版本追踪和回溯。
235
+ > **注意**: 推送 tag 后 GitHub Actions 会自动触发 npm 发布,无需手动 `npm publish`。
236
+
237
+ **原因**: 自动化发布避免手动操作失误,确保版本一致性。
214
238
 
215
239
  ---
216
240
 
package/README.md CHANGED
@@ -22,22 +22,23 @@
22
22
  ### 安装
23
23
 
24
24
  ```bash
25
- # 方式一:npm 全局安装
25
+ # 方式一:npm 全局安装(推荐)
26
26
  npm install -g deepspider
27
27
 
28
- # 方式二:克隆仓库
28
+ # 方式二:pnpm 全局安装
29
+ pnpm approve-builds -g deepspider isolated-vm # 首次需要批准构建脚本
30
+ pnpm install -g deepspider
31
+
32
+ # 方式三:克隆仓库
29
33
  git clone https://github.com/ma-pony/deepspider.git
30
34
  cd deepspider
31
35
  pnpm install
32
-
33
- # 安装 Python 加密库(用于运行生成的 Python 代码)
34
- pnpm run setup:crypto
35
-
36
- # 配置环境变量
37
- cp .env.example .env
38
- # 编辑 .env 填入配置(见下方环境变量说明)
36
+ cp .env.example .env # 配置环境变量
37
+ pnpm run setup:crypto # 安装 Python 加密库(可选)
39
38
  ```
40
39
 
40
+ 安装完成后,首次运行会提示配置环境变量(LLM API)。
41
+
41
42
  > **注意**: 项目依赖 `isolated-vm` 原生模块,需要 C++ 编译环境:
42
43
  > - macOS: `xcode-select --install`
43
44
  > - Ubuntu: `sudo apt install build-essential`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepspider",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "description": "智能爬虫工程平台 - 基于 DeepAgents + Patchright 的 AI 爬虫 Agent",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -35,17 +35,13 @@ export function ensureConfig() {
35
35
 
36
36
  配置方式(任选其一):
37
37
 
38
- 1. 环境变量:
38
+ 1. 环境变量(推荐):
39
39
  export DEEPSPIDER_API_KEY=sk-xxx
40
40
  export DEEPSPIDER_BASE_URL=https://api.openai.com/v1
41
41
  export DEEPSPIDER_MODEL=gpt-4o
42
42
 
43
- 2. .env 文件(推荐):
44
- cp .env.example .env
45
- # 编辑 .env 填入配置
46
-
47
- 3. 一行命令:
48
- DEEPSPIDER_API_KEY=sk-xxx DEEPSPIDER_BASE_URL=https://api.openai.com/v1 DEEPSPIDER_MODEL=gpt-4o npx deepspider <url>
43
+ 2. 一行命令:
44
+ DEEPSPIDER_API_KEY=sk-xxx DEEPSPIDER_BASE_URL=https://api.openai.com/v1 DEEPSPIDER_MODEL=gpt-4o deepspider <url>
49
45
 
50
46
  常用供应商配置:
51
47
  OpenAI: BASE_URL=https://api.openai.com/v1 MODEL=gpt-4o