sher-deploy

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

sher — deploy to a live preview URL

sher — 部署至在线预览URL

sher is a CLI that builds your frontend project, uploads it, and returns a live preview URL. One command. No accounts. No config.
Use it after you've built or scaffolded a frontend project and the user wants to see it live.
sher是一款CLI工具,它可以构建你的前端项目、上传项目文件,并返回一个在线预览URL。只需一条命令,无需注册账号,无需配置。
当你完成前端项目的构建或搭建后,若用户需要查看项目的在线效果,就可以使用它。

Install

安装

Global (recommended for agents):
bash
npm i -g shersh
Or one-off with npx:
bash
npx shersh link
全局安装(推荐给Agent使用):
bash
npm i -g shersh
或使用npx一次性运行:
bash
npx shersh link

Deploy

部署

From the project root:
bash
sher link
That's it. sher auto-detects the framework, runs the build, uploads the output, and returns a URL.
在项目根目录下运行:
bash
sher link
就是这么简单。sher会自动检测项目框架,执行构建,上传构建产物,并返回预览URL。

Options

选项

FlagDescription
--dir <path>
Upload a specific directory (skips framework detection)
--ttl <hours>
Set link expiry in hours (default: 24)
--no-build
Skip the build step (use if already built)
--pass [password]
Password-protect the preview (Pro only)
标识描述
--dir <path>
上传指定目录(跳过框架检测)
--ttl <hours>
设置链接过期时间(单位:小时,默认24小时)
--no-build
跳过构建步骤(适用于已完成构建的项目)
--pass [password]
为预览链接设置密码保护(仅Pro版支持)

Examples

示例

bash
undefined
bash
undefined

Standard deploy

标准部署

sher link
sher link

Deploy a pre-built project

部署已构建完成的项目

sher link --no-build
sher link --no-build

Deploy a specific output directory

部署指定的输出目录

sher link --dir ./dist
sher link --dir ./dist

Short-lived link (2 hours)

创建短期有效链接(2小时)

sher link --ttl 2
undefined
sher link --ttl 2
undefined

Parsing the output

解析输出内容

The CLI prints the live URL to stdout in this format:
  https://a8xk2m1p.sher.sh  (copied)
  expires 2/19/2026, 11:00 AM
The URL always matches the pattern
https://[a-z0-9]{8}.sher.sh
. Extract it with:
https://[a-z0-9]{8}\.sher\.sh
The URL is also automatically copied to the clipboard.
CLI会在标准输出中打印在线预览URL,格式如下:
  https://a8xk2m1p.sher.sh  (已复制到剪贴板)
  过期时间:2026年2月19日 上午11:00
URL始终符合
https://[a-z0-9]{8}.sher.sh
的格式。你可以通过以下正则表达式提取:
https://[a-z0-9]{8}\.sher\.sh
URL还会自动复制到剪贴板。

After deploying

部署完成后

Present the URL to the user:
Your preview is live at https://a8xk2m1p.sher.sh
If you set a
--ttl
, mention when it expires. If using
--pass
, share the password too.
将预览URL告知用户:
你的项目预览已上线:https://a8xk2m1p.sher.sh
如果你设置了
--ttl
参数,请告知用户链接的过期时间。如果使用了
--pass
参数,记得一并分享密码。

Supported frameworks

支持的框架

sher auto-detects and builds:
  • Vite — outputs to
    dist/
  • Next.js — auto-configures static export, outputs to
    out/
  • Astro — outputs to
    dist/
  • Create React App — outputs to
    build/
  • Any project with a build script that produces
    dist/
    ,
    build/
    , or
    out/
  • Static HTML — no build needed, use
    --dir .
    to upload directly
sher可以自动检测并构建以下框架的项目:
  • Vite — 构建产物输出至
    dist/
    目录
  • Next.js — 自动配置静态导出,产物输出至
    out/
    目录
  • Astro — 构建产物输出至
    dist/
    目录
  • Create React App — 构建产物输出至
    build/
    目录
  • 任意项目 — 只要项目的构建脚本会生成
    dist/
    build/
    out/
    目录
  • 静态HTML项目 — 无需构建,使用
    --dir .
    直接上传当前目录即可

Agent-friendly by default

天生适配Agent使用

  • No browser opens after deploy
  • No interactive prompts
  • No account required for basic usage (1 deploy, 10MB max, 6h TTL)
  • Authenticated users get 25 deploys, 50MB, 24h TTL
  • Exit code 0 on success, non-zero on failure
  • 部署完成后不会打开浏览器
  • 无交互式提示
  • 基础使用无需账号(支持1次部署,最大10MB,6小时有效期)
  • 已认证用户支持25次部署,最大50MB,24小时有效期
  • 部署成功时退出码为0,失败时为非0值

Troubleshooting

故障排查

If
sher link
fails:
  1. No build script — the project needs a
    build
    script in
    package.json
    , or use
    --dir
    to point to pre-built output
  2. Build error — fix the build error first, then retry
  3. Size limit — the upload is too large (10MB anonymous, 50MB authenticated, 100MB Pro)
  4. No output directory — ensure the build produces
    dist/
    ,
    build/
    , or
    out/
    , or specify
    --dir
如果
sher link
执行失败:
  1. 缺少构建脚本 — 项目的
    package.json
    中需要包含
    build
    脚本,或者使用
    --dir
    参数指定已构建完成的产物目录
  2. 构建失败 — 先修复构建错误,再重新尝试
  3. 大小超限 — 上传文件过大(匿名用户10MB,已认证用户50MB,Pro版100MB)
  4. 无输出目录 — 确保构建过程会生成
    dist/
    build/
    out/
    目录,或者使用
    --dir
    参数指定目录