# @cloudbase/framework-plugin-deno

> 云开发 Tencent CloudBase Framework Deno Server Plugin 插件，将项目下的 Deno 应用一键部署云开发环境，提供自动弹性伸缩的高性能 Deno 服务

Latest version **1.9.6** (published 2022-08-23) · Apache-2.0 license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @cloudbase/framework-plugin-deno
pnpm add @cloudbase/framework-plugin-deno
yarn add @cloudbase/framework-plugin-deno
bun add @cloudbase/framework-plugin-deno
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.9.6 |
| Published | 2022-08-23 |
| First published | 2020-08-17 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 31.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1996 |
| Author | Tencent CloudBase Team |
| Maintainers | daniel-dx, woodenstone, ceoyp, xbasesdk, issacliu, liuyanjie, rosefang, bobbyzhao, greengrey, starkwang, yhyang, godbmw, binggg, evecalm, fengkx |

## Links

- npm: https://www.npmjs.com/package/@cloudbase/framework-plugin-deno
- Repository: https://github.com/Tencent/cloudbase-framework
- Homepage: https://github.com/Tencent/cloudbase-framework#readme
- Issues: https://github.com/Tencent/cloudbase-framework/issues
- npm.io page: https://npm.io/package/@cloudbase/framework-plugin-deno

## Dependencies (4)

- [fs-extra](https://npm.io/package/fs-extra.md) ^8.1.0
- [@types/fs-extra](https://npm.io/package/@types/fs-extra.md) ^8.1.0
- [@cloudbase/framework-core](https://npm.io/package/@cloudbase/framework-core.md) ^1.9.6
- [@cloudbase/framework-plugin-container](https://npm.io/package/@cloudbase/framework-plugin-container.md) ^1.9.6

## Recent versions

- 1.9.6 (latest) — 2022-08-23
- 1.8.18-beta.1 (beta) — 2021-12-28
- 1.2.0-alpha.0 (bata) — 2020-09-17
- 1.9.5 — 2022-08-22
- 1.9.4 — 2022-06-06
- 1.9.0 — 2021-12-28
- 1.8.16 — 2021-09-10
- 1.8.15 — 2021-09-08
- 1.8.13 — 2021-08-16
- 1.8.12 — 2021-08-16
- 1.8.3 — 2021-07-01
- 1.8.2 — 2021-06-23
- 1.8.1 — 2021-06-18
- 1.8.0 — 2021-06-15
- 1.7.4 — 2021-05-12
- … 88 more at https://npm.io/package/@cloudbase/framework-plugin-deno/versions

## README

<a href="https://github.com/Tencent/cloudbase-framework/tree/master/packages/framework-plugin-deno">![Tencent CloudBase Framework Deno Plugin](https://main.qcloudimg.com/raw/70429911e53a56366c39e11f5596e790.jpg)</a>

# Tencent CloudBase Framework Deno Plugin

[![Github License](https://img.shields.io/badge/license-Apache--2.0-blue)](LICENSE)
[![Npm version](https://img.shields.io/npm/v/@cloudbase/framework-plugin-function)](https://www.npmjs.com/package/@cloudbase/framework-plugin-function)
[![issue](https://img.shields.io/github/issues/Tencent/cloudbase-framework)](https://github.com/Tencent/cloudbase-framework/issues)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/Tencent/cloudbase-framework/pulls)
[![star](https://img.shields.io/github/stars/Tencent/cloudbase-framework?style=social)](https://github.com/Tencent/cloudbase-framework)

**云开发 CloudBase Framework 框架「Deno」插件**： 通过云开发 **[CloudBase Framework](https://github.com/Tencent/cloudbase-framework)** 框架将 Deno 应用一键部署到云开发环境，提供生产环境可用的自动弹性伸缩的高性能 Deno 应用服务。

## 功能特性

- 无须关心底层架构: 只需要开发业务服务，不用适配底层架构
- 节约成本: 资源伸缩，弹性扩缩容，灵活计费，极大节约资源成本
- 框架支持: 无缝支持 Deno 应用

## 使用方法

### 步骤一. 准备工作

具体步骤请参照 [准备云开发环境和 CloudBase CLI 命令工具](../../CLI_GUIDE.md)

### 步骤二. 进入项目目录进行初始化

执行以下命令来初始化一个全新的 deno 项目

```bash
cloudbase init --template deno
```

### 步骤三. 一键部署

```bash
cloudbase framework deploy
```

## 配置

默认情况下不需要任何配置即可使用，以下配置参数针对有特殊需求的场景

### 配置示例

`cloudbase init` 之后会创建云开发的配置文件 `cloudbaserc.json`，可在配置文件的 plugins 里修改和写入插件配置

```json
{
  "envId": "{{envId}}",
  "framework": {
    "plugins": {
      "client": {
        "use": "@cloudbase/framework-plugin-deno",
        "inputs": {
          "serviceName": "deno-app",
          "projectPath": "/deno-app"
        }
      }
    }
  }
}
```

### 配置参数说明

### `serviceName`

必填，服务名，字符串格式，如 `'deno-app'`

### `servicePath`

必填，服务路径配置，字符串格式，如 `'/deno-app'`

### `projectPath`

选填，本地代码文件夹相对于项目根目录的路径，字符串格式，默认值 `'./'`

### `dockerImage`

选填，Dockerfile 源镜像，字符串格式，默认值 `'debian:buster-slim'`

### `runtime`

选填，Deno 运行时版本，字符串格式，如 `'v1.3.0'`，默认值 `'latest'`

### `denonVersion`

选填，Denon 版本，字符串格式，如 `'@2.4.0'`，默认值 `''`

### `entry`

选填，入口文件，字符串格式，默认值 `''`

配置入口文件为 `entry.ts` 后，docker 编译时，会执行 `deno install entry.ts`。

但不推荐如此管理项目，推荐使用 denon 配置文件，并在部署前进行本地编译。

### `autoBuild`

选填，是否云端自动构建，布尔值格式，默认值 `true`

## 关于 denon

docker 使用 [denon](https://github.com/denosaurs/denon) 来管理 deno 进程，以便于管理 deno 启动参数。

denon 配置示例:

```yml
# denon.yml
scripts:
  build:
    cmd:
      - mkdir dist
      - deno bundle src/entry.ts dist/entry.js
    watch: false
  start:
    cmd: deno run dist/entry.js
    allow:
      - net
      - env
      - read
  dev:
    cmd: deno run src/entry.ts
    env:
      PORT: '3000'
    allow:
      - net
      - env
      - read
```

直接在 docker 编译 deno 应用，由于部分依赖文件所处网络环境原因容易导致镜像编译失败。推荐在本地安装 denon ，通过 `denon.yml` 提供的 `denon build` 命令进行本地编译，然后再发布应用到云端。

`cloudbase init` 之后会自动提供一个默认的 denon.yml，请根据应用需求来修改。

默认 docker 镜像会执行 `denon start` 命令来启动应用。

## 更多插件

请访问 [CloudBase Framework 插件列表](https://github.com/Tencent/cloudbase-framework#%E7%9B%AE%E5%89%8D%E6%94%AF%E6%8C%81%E7%9A%84%E6%8F%92%E4%BB%B6%E5%88%97%E8%A1%A8) 搭配使用其他插件

## 文档资料

- 云开发官网地址： [https://cloudbase.net/](https://cloudbase.net/)
- 云开发静态网站开通指南：[https://docs.cloudbase.net/hosting/](https://docs.cloudbase.net/hosting/)
- 云开发控制台地址： [https://console.cloud.tencent.com/tcb](https://console.cloud.tencent.com/tcb?tdl_anchor=github&tdl_site=0)

---
_Source: https://npm.io/package/@cloudbase/framework-plugin-deno · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
