@google-cloud/functions-emulator

中文文档
1.0.0-beta.6发布于 2019/04/19Apache-2.0CommonJS近 30 天下载 1.5万

Google 云函数模拟器

此软件包已被标记为弃用

Deprecating in favor of the Functions Framework and firebase-tools. See https://github.com/googlearchive/cloud-functions-emulator/issues/327

中文使用文档
文档目录6 节
  1. 什么是谷歌云函数模拟器??
  2. 说明
  3. 我怎么开始?
  4. 证件在哪里?
  5. 捐款
  6. 许可证
Google Inc. logo

Google 云函数模拟器

NPM Tests Coverage

免责声明:这不是Google官方产品.

目录

什么是谷歌云函数模拟器??

这个 Google 云函数模拟器 是一个执行 Google Cloud 函数 API 的 Node.js 应用程序,包括一个CLI,您可以用它来管理应用程序.

模拟器允许您使用 部署, (中文(简体) ), 运行,以及 调试 您的 Cloud 函数在您的本地机器上, 在应用到 Google Cloud 函数服务之前 .

说明

模拟器只支持节点 v6.x.x它确实 没有 支持节点 v8.x.x 或作彼贤.

我怎么开始?

  1. 写入函数 :

     mkdir helloWorld
     cd helloWorld
     touch index.js
     echo 'exports.helloWorld = (req, res) => res.send("Hello, World!");' > index.js
    
  2. 安装模拟器 :

    国家预防机制:

     npm install -g @google-cloud/functions-emulator
    

    亚伦:

     yarn global add @google-cloud/functions-emulator
    

    或者在细节中读更多 安装指令。 。 。 .

  3. 启动模拟器 :

     functions start
    
  4. 部署您的功能 :

     functions deploy helloWorld --trigger-http
    

    获取函数配置帮助 functions deploy --help。 。 。 .

  5. 调用您的功能 :

     functions call helloWorld
    
  6. 查看日志 :

     functions logs read
    

证件在哪里?

简而言之,模拟 CLI 是自我文档。 运行以下来获取 CLI 的帮助 :

functions --help

对于其他的一切,都可以看到 如何向导。 。 。 .

捐款

反馈、 报告错误或请求特性, 请 打开一个问题。 。 。 .

为了促成改变, 检查贡献指南。 。 。 .

许可证

版权 2017, Google, Inc.

根据Apache 许可证颁发的许可证,2.0版本

见 正式许可证。 。 。 .

版本与发布记录

@google-cloud/functions-emulator 共发布 42 个版本,首次发布于 2016/10/25;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.0-beta.6latest2019/04/197 年前
1.0.0-beta.6.02019/04/177 年前
1.0.0-beta.5beta2018/08/028 年前
1.0.0-beta.42018/03/078 年前
1.0.0-beta.32018/02/248 年前
1.0.0-beta.22018/02/218 年前

其他发布通道:alpha → 1.0.0-alpha.29,beta → 1.0.0-beta.5。

关于 @google-cloud/functions-emulator 的常见问题

@google-cloud/functions-emulator 是什么?

Google 云函数模拟器注意:该包已被作者标记为弃用——Deprecating in favor of the Functions Framework and firebase-tools. See https://github.com/googlearchive/cloud-functions-emulator/issues/327

如何安装 @google-cloud/functions-emulator?

在项目目录运行 npm install @google-cloud/functions-emulator,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 functions、functions-emulator,可以用 npx functions 直接运行。

@google-cloud/functions-emulator 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/google-cloud__functions-emulator 是否存在。

@google-cloud/functions-emulator 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@google-cloud/functions-emulator 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js ~6。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@google-cloud/functions-emulator 可以商用吗?

@google-cloud/functions-emulator 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@google-cloud/functions-emulator 的下载量有多少?

根据 npm 官方下载统计,@google-cloud/functions-emulator 在 2026/10/17 – 2026/11/15 这 30 天内被下载 14,563 次,日均约 485 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@google-cloud/functions-emulator 还在维护吗?

最新版本 1.0.0-beta.6 发布于 2019/04/19(7 年前);至今共发布 42 个版本,其中过去 12 个月发布了 0 个;首次发布于 2016/10/25。作者已将其标记为弃用,新项目建议寻找替代方案。