跳到主要内容

代码管理

更新函数代码

使用 tcb fn code update 命令可以快速更新云函数的代码。

基本用法

# 更新指定函数的代码
tcb fn code update <functionName>

示例:

# 更新 app 函数的代码
tcb fn code update app

下载函数代码

使用 tcb fn code download 命令可以下载云端函数的代码:

tcb fn code download <functionName> [destPath]

参数说明:

  • functionName: 函数名称(必填)
  • destPath: 下载目标路径(可选)

默认行为:

  • 代码会下载到 functionRoot 目录下
  • 以函数名称作为文件夹名称

示例:

# 下载到默认目录
tcb fn code download app

# 下载到指定目录
tcb fn code download app ./my-functions/app

code update 与 deploy 的区别

命令更新内容适用场景
tcb fn code update仅更新函数代码和执行入口快速更新代码,不改变配置
tcb fn deploy更新代码、配置、触发器完整部署或更新所有配置

使用建议:

  • 当只需要更新业务逻辑代码时,使用 tcb fn code update
  • 当需要修改函数配置(如超时时间、环境变量等)或触发器时,使用 tcb fn deploy