firecrawl-upgrade-migration

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

FireCrawl Upgrade & Migration

FireCrawl SDK升级与迁移

Overview

概述

Guide for upgrading FireCrawl SDK versions and handling breaking changes.
本指南介绍FireCrawl SDK版本升级及破坏性变更的处理方法。

Prerequisites

前置条件

  • Current FireCrawl SDK installed
  • Git for version control
  • Test suite available
  • Staging environment
  • 已安装当前版本的FireCrawl SDK
  • 用于版本控制的Git
  • 可用的测试套件
  • 预发布(Staging)环境

Instructions

操作步骤

Step 1: Check Current Version

步骤1:检查当前版本

bash
npm list @firecrawl/sdk
npm view @firecrawl/sdk version
bash
npm list @firecrawl/sdk
npm view @firecrawl/sdk version

Step 2: Review Changelog

步骤2:查看更新日志

bash
open https://github.com/firecrawl/sdk/releases
bash
open https://github.com/firecrawl/sdk/releases

Step 3: Create Upgrade Branch

步骤3:创建升级分支

bash
git checkout -b upgrade/firecrawl-sdk-vX.Y.Z
npm install @firecrawl/sdk@latest
npm test
bash
git checkout -b upgrade/firecrawl-sdk-vX.Y.Z
npm install @firecrawl/sdk@latest
npm test

Step 4: Handle Breaking Changes

步骤4:处理破坏性变更

Update import statements, configuration, and method signatures as needed.
根据需要更新导入语句、配置及方法签名。

Output

输出结果

  • Updated SDK version
  • Fixed breaking changes
  • Passing test suite
  • Documented rollback procedure
  • 更新后的SDK版本
  • 已修复的破坏性变更
  • 测试套件全部通过
  • 已记录的回滚流程

Error Handling

错误处理

SDK VersionAPI VersionNode.jsBreaking Changes
3.x2024-0118+Major refactor
2.x2023-0616+Auth changes
1.x2022-0114+Initial release
SDK版本API版本Node.js版本破坏性变更内容
3.x2024-0118+重大重构
2.x2023-0616+认证方式变更
1.x2022-0114+初始版本

Examples

示例

Import Changes

导入语句变更

typescript
// Before (v1.x)
import { Client } from '@firecrawl/sdk';

// After (v2.x)
import { FireCrawlClient } from '@firecrawl/sdk';
typescript
// 旧版本(v1.x)
import { Client } from '@firecrawl/sdk';

// 新版本(v2.x)
import { FireCrawlClient } from '@firecrawl/sdk';

Configuration Changes

配置变更

typescript
// Before (v1.x)
const client = new Client({ key: 'xxx' });

// After (v2.x)
const client = new FireCrawlClient({
  apiKey: 'xxx',
});
typescript
// 旧版本(v1.x)
const client = new Client({ key: 'xxx' });

// 新版本(v2.x)
const client = new FireCrawlClient({
  apiKey: 'xxx',
});

Rollback Procedure

回滚流程

bash
npm install @firecrawl/sdk@1.x.x --save-exact
bash
npm install @firecrawl/sdk@1.x.x --save-exact

Deprecation Handling

废弃特性处理

typescript
// Monitor for deprecation warnings in development
if (process.env.NODE_ENV === 'development') {
  process.on('warning', (warning) => {
    if (warning.name === 'DeprecationWarning') {
      console.warn('[FireCrawl]', warning.message);
      // Log to tracking system for proactive updates
    }
  });
}

// Common deprecation patterns to watch for:
// - Renamed methods: client.oldMethod() -> client.newMethod()
// - Changed parameters: { key: 'x' } -> { apiKey: 'x' }
// - Removed features: Check release notes before upgrading
typescript
// 在开发环境中监控废弃警告
if (process.env.NODE_ENV === 'development') {
  process.on('warning', (warning) => {
    if (warning.name === 'DeprecationWarning') {
      console.warn('[FireCrawl]', warning.message);
      // 记录到追踪系统以便主动更新
    }
  });
}

// 需要关注的常见废弃模式:
// - 方法重命名:client.oldMethod() -> client.newMethod()
// - 参数变更:{ key: 'x' } -> { apiKey: 'x' }
// - 特性移除:升级前请查看发布说明

Resources

参考资源

Next Steps

后续步骤

For CI integration during upgrades, see
firecrawl-ci-integration
.
如需在升级过程中集成CI,请查看
firecrawl-ci-integration