sher-deploy
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesesher — 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 shershOr one-off with npx:
bash
npx shersh link全局安装(推荐给Agent使用):
bash
npm i -g shersh或使用npx一次性运行:
bash
npx shersh linkDeploy
部署
From the project root:
bash
sher linkThat's it. sher auto-detects the framework, runs the build, uploads the output, and returns a URL.
在项目根目录下运行:
bash
sher link就是这么简单。sher会自动检测项目框架,执行构建,上传构建产物,并返回预览URL。
Options
选项
| Flag | Description |
|---|---|
| Upload a specific directory (skips framework detection) |
| Set link expiry in hours (default: 24) |
| Skip the build step (use if already built) |
| Password-protect the preview (Pro only) |
| 标识 | 描述 |
|---|---|
| 上传指定目录(跳过框架检测) |
| 设置链接过期时间(单位:小时,默认24小时) |
| 跳过构建步骤(适用于已完成构建的项目) |
| 为预览链接设置密码保护(仅Pro版支持) |
Examples
示例
bash
undefinedbash
undefinedStandard 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
undefinedsher link --ttl 2
undefinedParsing the output
解析输出内容
The CLI prints the live URL to stdout in this format:
https://a8xk2m1p.sher.sh (copied)
expires 2/19/2026, 11:00 AMThe URL always matches the pattern . Extract it with:
https://[a-z0-9]{8}.sher.shhttps://[a-z0-9]{8}\.sher\.shThe URL is also automatically copied to the clipboard.
CLI会在标准输出中打印在线预览URL,格式如下:
https://a8xk2m1p.sher.sh (已复制到剪贴板)
过期时间:2026年2月19日 上午11:00URL始终符合的格式。你可以通过以下正则表达式提取:
https://[a-z0-9]{8}.sher.shhttps://[a-z0-9]{8}\.sher\.shURL还会自动复制到剪贴板。
After deploying
部署完成后
Present the URL to the user:
Your preview is live at https://a8xk2m1p.sher.sh
If you set a , mention when it expires. If using , share the password too.
--ttl--passSupported 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/, orbuild/out/ - Static HTML — no build needed, use to upload directly
--dir .
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 fails:
sher link- No build script — the project needs a script in
build, or usepackage.jsonto point to pre-built output--dir - Build error — fix the build error first, then retry
- Size limit — the upload is too large (10MB anonymous, 50MB authenticated, 100MB Pro)
- No output directory — ensure the build produces ,
dist/, orbuild/, or specifyout/--dir
如果执行失败:
sher link- 缺少构建脚本 — 项目的中需要包含
package.json脚本,或者使用build参数指定已构建完成的产物目录--dir - 构建失败 — 先修复构建错误,再重新尝试
- 大小超限 — 上传文件过大(匿名用户10MB,已认证用户50MB,Pro版100MB)
- 无输出目录 — 确保构建过程会生成、
dist/或build/目录,或者使用out/参数指定目录--dir