如何将我的 divshot 静态网站迁移到 firebase?

How can I migrate my divshot static website to firebase?

每次 Google/Firebase.io 对 Divshot.io 的收购,我都需要在 2015 年 12 月 22 日之前迁移我的生产 "static" HTML 应用程序。我已经安装了最新的 firebase-tools CLI 并更新到最新的 divshot CLI 并准备了我的环境。

我已遵循 divshot 的所有指导,但在尝试 deploy 时收到以下错误:

Jeffs-rMBP:insider-web jeff [develop] $ cp -p divshot.production.json divshot.json
Jeffs-rMBP:insider-web jeff [develop] $ divshot migrate

Migrating Divshot app insider-web to Firebase Hosting

What is your Firebase project's name? (insider-web) insider
Can we anonymously report which features your app used (for Firebase Hosting roadmap planning, etc.)? (y/n) y
Write firebase.json? (y/n) y

⚠ Warning: The following incompatible features were detected.
- clean_urls support is planned for Firebase Hosting, but is not yet available
- Firebase Hosting does not support AJAX proxying

  Don't panic! Some features may be coming soon or there may be workarounds.
  Contact support@firebase.com with any questions.

You need to take the following actions to fully migrate your app:
- Rename error.html to 404.html

Wrote firebase.json configuration file.

If you have the latest version of firebase-tools you should now be able
to run firebase serve in this directory to start a local server and
firebase deploy to deploy to Firebase Hosting.

See http://docs.divshot.com/migrate for additional migration info.

Jeffs-rMBP:insider-web jeff [develop] $ 

我按照指导将 error.html 重命名为 404.html:

Jeffs-rMBP:insider-web jeff [develop] $ cp -p error.html 404.html
Jeffs-rMBP:insider-web jeff [develop] $ 

到目前为止看起来还不错,但在尝试部署之后,我收到了这条消息:

Jeffs-rMBP:insider-web jeff [develop] $ firebase deploy

Error: Authentication required.
Jeffs-rMBP:insider-web jeff [develop] $ 

这是我的原始 divshot.json 文件:

Jeffs-rMBP:insider-web jeff [develop] $ cat divshot.json
{
  "name": "insider-web",
  "root": "./",
  "clean_urls": true,
  "error_page": "error.html",
  "proxy": {
    "api": {
      "origin": "http://oa-mobile.herokuapp.com",
      "headers": {
        "Accept": "application/json"
      },
      "cookies": false,
      "timeout": 30
    }
  }
}
Jeffs-rMBP:insider-web jeff [develop] $ 

这是生成的 firebase.json 文件:

Jeffs-rMBP:insider-web jeff [develop] $ cat firebase.json 
{
  "firebase": "insider",
  "public": "./",
  "ignore": [
    "firebase.json",
    "**/.*",
    "**/node_modules/**"
  ]
}
Jeffs-rMBP:insider-web jeff [develop] $ 

补充说明: 我能够成功 运行 firebase serve 并在 localhost:5000 本地启动我的应用程序 - 我的初始登录页面成功呈现并且行为正确。

您需要通过命令行登录:

firebase login

这将打开一个浏览器 window,供您通过 Google 帐户登录。确保它是拥有 insider Firebase 应用程序的帐户。

根据您所展示的情况,您目前拥有的唯一 Firebase 名为 glowing-heat-3960。更改 firebase.json.

中的 firebase 属性
{
  "firebase": "glowing-heat-3960",
  "public": "./",
  "ignore": [
    "firebase.json",
    "**/.*",
    "**/node_modules/**"
  ]
}

之后您应该能够成功部署。