mcpField
B
blink-deploy

blink-deploy

github.com/blink-new云与 DevOps441 次安装2 周前更新
代码仓库

关于 blink-deploy

blink-deploy 是将外部构建的前端项目部署到 Blink 托管服务的技能,说明 CLI 部署、预览与生产 URL 的区别,以及如何避免与 Blink 沙盒激活流程混用。

主要功能

  1. 01用 blink deploy 发布前端构建产物
  2. 02区分预览与生产部署目标
  3. 03避免沙盒激活覆盖 CLI 部署
  4. 04识别常见构建输出目录
  5. 05排查空部署或过期部署

适用场景

  1. 01将构建好的前端发布到 Blink
  2. 02选择更新预览站点还是生产站点
  3. 03诊断站点未显示或内容过期

MCP 相关

该技能说明 blink_versions_restore 及托管状态、激活等 MCP 工具。前端部署需使用 blink CLI,而非 MCP 部署工具。

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/blink-new/blink-plugin --skill blink-deploy

安装后在 Claude Code 中输入/blink-deploy确认已加载。

详细介绍

MCP 工具

blink_versions_restore — 将项目恢复到之前保存的版本快照(使用 blink_versions_list 查找版本 ID)。

前端通过 CLI 部署——blink deploy ./dist --prod。MCP 没有部署工具,因为 Agent 会在构建后使用 CLI 部署。

入门指南

# Build your app
npm run build

# Deploy to production — always pass project ID explicitly to avoid "No project context" errors
blink deploy <project_id> ./dist --prod

# OR: link the project first, then deploy without ID
blink link <project_id>
blink deploy ./dist --prod

# That's it — no activation step. Do NOT run `blink hosting activate` or call the
# blink_hosting_activate MCP tool after this (see "Two hosting systems" below) — both
# spellings hit the same endpoint, which rebuilds from the Blink sandbox and overwrites
# what you just deployed.

# Preview deploy — publishes to the project's own blinkusercontent.com URL (no activation
# needed, but this IS the project's default live site, not a throwaway — see below)
blink deploy <project_id> ./dist

# List saved version snapshots
blink versions list

# Restore a version snapshot (version rollback)
blink versions restore <version_id>

两种托管系统——切勿混用

Blink 有两种独立的托管路径。运行 blink deploy 后,切勿运行 blink hosting activate 或调用 blink_hosting_activate MCP 工具——这两种写法会调用同一个端点。

路径 A — CLI 部署(适用于在外部构建的应用)
blink deploy <project_id> ./dist --prod
# → live immediately at https://{project_slug}.blinkpowered.com
# → NO further steps needed. Do NOT run `blink hosting activate` or call blink_hosting_activate.

部署后,CLI 会显示 URL。对于通过 CLI 部署的项目,blink_hosting_status 会一直显示 inactive, 这是永久状态。部署路由不会写入该字段,因此这不是等待一段时间就会消失的临时延迟。真正的原因是项目的计费生命周期,而不是部署状态;无论如何,网站都已上线。不要通过运行托管激活来“修复”inactive 状态——请参见 上文。

路径 B — Blink 沙盒激活(适用于在 Blink AI 编辑器中构建的项目)
blink_hosting_activate  # only for sandbox-based projects
# → triggers a fresh build from the Blink sandbox and deploys

为何不能混用:
blink_hosting_activate 会从 Blink 沙盒重新构建,并覆盖blink deploy 上传到 S3 的文件。在 CLI 部署后调用 activate,会用 Blink AI 模板替换你的应用。

摘要
场景命令URL
在外部构建的应用(Vite/Next/React)blink deploy <id> ./dist --prod{slug}.blinkpowered.com
在 Blink AI 编辑器中构建的应用blink_hosting_activate{slug}.blinkpowered.com
预览 / 默认 URLblink deploy <id> ./dist(不带 --prod){projectId}.blinkusercontent.com

部署流程

1. npm run build          → generates ./dist (or .next, out/, build/)
2. blink deploy ./dist    → uploads to Blink hosting
3. URL printed            → {projectId}.blinkusercontent.com (preview), or {slug}.blinkpowered.com with --prod (or custom domain)

预览与生产环境

**这两个标志都不是安全/隔离的沙盒——它们都会覆盖真实的线上 URL。**预览部署会发布到 Blink AI 编辑器自身发布流程写入的同一个 blinkusercontent.com URL(该 URL 在界面中显示为项目的默认域名)——运行不带 --prod 的 blink deploy ./dist 会替换该 URL 当前上线的内容。

标志行为URL
(无)发布到项目的默认 URL——无需激活,但也不是一次性环境{projectId}.blinkusercontent.com
--prod仅发布到生产/自定义域名 URL——不会同时更新上方的默认 URL,该 URL 会保持上次部署的内容{slug}.blinkpowered.com + 自定义域名
# Publishes to the project's blinkusercontent.com URL — this replaces what's live there now
blink deploy ./dist
# → https://{projectId}.blinkusercontent.com

# Production — replaces live site
blink deploy ./dist --prod
# → https://{slug}.blinkpowered.com

框架构建输出

框架构建命令输出目录
React (Vite)vite build./dist
Next.js (output: 'export')next build./out
Vuevite build./dist
Sveltevite build./build
Astroastro build./dist
纯 HTML/CSS/JS—./

对于 Next.js 静态导出,请确保 next.config.ts 中设置了 output: 'export'。

后端部署

后端(运行于 CF Workers 上的 Hono)有自己的部署命令——请参见 blink-backend 技能。

blink backend deploy

完整生产环境检查清单

# 1. Ensure env vars are set
# 2. Build
npm run build

# 3. Deploy frontend
blink deploy ./dist --prod

# 4. Deploy backend (if applicable)
blink backend deploy

# 5. Set up custom domain (optional)
blink domains add myapp.com

常见问题

问题解决方法
部署内容为空检查构建输出目录是否存在且包含文件
部署后出现 404确认输出目录正确(dist/、out/、build/)
缺少环境变量在构建前于项目设置中配置密钥
部署内容过时确保生产环境更新时使用 --prod 标志。如果过时的具体是默认的 blinkusercontent.com URL,且发生在使用 --prod 部署后,这是预期行为——--prod 不会修改该 URL(请参见“预览与生产环境”);运行普通的 blink deploy(不带标志)也会更新它

评论

支持 Markdown