firebase-hosting-basics
在 Firebase 上部署和托管 Web 应用
Firebase Hosting 通过全球 CDN 和自动 SSL 为静态网站和 SPA 提供快速、安全的部署。本技能指导您完成配置、部署命令和预览渠道管理。
Descargar el ZIP de la skill
Subir en Claude
Ve a Configuración → Capacidades → Skills → Subir skill
Activa y empieza a usar
Pruébalo
Usando "firebase-hosting-basics". 为带有简洁 URL 的 React SPA 配置 Firebase Hosting
Resultado esperado:
- 创建带托管配置的 firebase.json:
- - 将 public 目录设置为 'build'
- - 启用 cleanUrls: true
- - 添加重写规则,为所有路由提供 index.html
- - 运行:npx firebase-tools@latest deploy --only hosting
Usando "firebase-hosting-basics". 为功能测试设置预览渠道
Resultado esperado:
- 部署到预览渠道:
- - 运行:npx firebase-tools@latest hosting:channel:deploy feature-auth
- - 提供用于测试的渠道 URL
- - 7 天后自动过期
- - 审批后克隆到生产环境
Auditoría de seguridad
SeguroAll static findings are false positives. The flagged 'external_commands' are markdown documentation examples showing firebase-tools CLI commands for users to run manually. The 'weak cryptographic algorithm' detections matched on configuration JSON examples, not actual crypto code. The 'network' flag was triggered by a localhost URL in documentation. No executable code or malicious patterns exist in these documentation files.
Factores de riesgo
⚙️ Comandos externos (3)
Puntuación de calidad
Lo que puedes crear
部署 React SPA
配置并部署 React 单页应用,设置适当的客户端路由重写规则。
设置预览渠道
创建临时预览 URL,用于在合并到生产环境之前测试功能分支。
配置自定义 HTTP 头
为您的 Firebase Hosting 部署添加安全头、CORS 策略和缓存控制。
Prueba estos prompts
Help me set up Firebase Hosting for my static website. I need to configure the public directory, set up clean URLs, and deploy to production.
Configure firebase.json to handle client-side routing for my Vue.js SPA. All routes should serve index.html except API calls.
Create a preview channel called 'feature-checkout' for testing, set it to expire in 3 days, and show me how to clone it to production after approval.
Set up custom headers for font files with CORS, configure rewrites for an API proxy to Cloud Functions, and add redirect rules for legacy URLs.
Mejores prácticas
- 在推送到生产环境之前,始终在预览渠道上测试部署
- 使用 ignore 模式排除不必要的文件,如 node_modules 和 source maps
- 为静态资源设置适当的缓存头以提高性能
Evitar
- 不要将 .env 或凭证等敏感文件部署到 Firebase Hosting
- 避免在重写的根路径中使用所有路由而不排除 API 端点
- 不要在生产环境部署前跳过预览测试