link command accepts several flags to customize the build and deployment process.
Quick Reference
Build Options
--no-build
Skip the build step and upload an existing output directory.
Use case: When you’ve already built your project or want to share pre-built files.
--dir <path>
Specify a custom output directory to upload.
Default behavior: Sher auto-detects the output directory based on your framework:
- Vite →
dist/ - Next.js →
out/ - Astro →
dist/ - Create React App →
build/
Link Options
--ttl <hours>
Set the time-to-live (expiry time) for the preview link in hours.
Default: 24 hours
Limits by tier:
| Tier | Max TTL |
|---|---|
| Free (anonymous) | 6 hours |
| Starter (GitHub login) | 24 hours |
| Pro ($8/mo) | 168 hours (7 days) |
The TTL value is automatically clamped to the maximum allowed for your tier. If you specify a value higher than your tier’s limit, it will be reduced to the maximum.
--pass [password]
Password-protect the preview link.
Behavior:
- Without a value: Generates a random 8-character password
- With a value: Uses the specified password
Random Password Generation
When you use--pass without a value, Sher generates a cryptographically secure 8-character hexadecimal password (e.g., f7a3c9e1).
Implementation from src/index.ts:186-190:
General Options
--help or -h
Display help information.
--version or -v
Show the installed version of Sher.
Combining Options
You can combine multiple flags to customize your deployment:Best Practices
Use --ttl wisely
Use --ttl wisely
Set shorter TTLs for temporary shares:
Password-protect sensitive work
Password-protect sensitive work
Always use
--pass for private client work or internal previews:Use --dir for monorepos
Use --dir for monorepos
In monorepos, specify the exact output directory:
Skip builds in CI/CD
Skip builds in CI/CD
When deploying from CI, build first and use
--no-build:Error Handling
Rate Limits
If you exceed your tier’s daily limit, Sher will show an error before building:- Free tier: Run
sher loginto upgrade to Starter (25/day) - Starter tier: Run
sher upgradefor Pro (200/day)
Upload Size Limits
If your build output exceeds the maximum upload size:- Remove unused assets from your build
- Optimize images and other media files
- Use
--dirto upload only necessary files - Upgrade to Pro for 100MB limit