首先要安裝 Firebase CLI (當然要先安裝 Node.Js 環境 ) 如下:
$ npm install -g firebase-tools (記得用安裝命令來更新到最新版本)
再來是登入 Firebase
$ firebase login ( 會跳出一個登入畫面 )
還會跳出一個登入成功的頁面
初始化 firebase,要先建立專案目錄,移到該目錄下再執行 INIT。
$ firebase init
選擇要建立的設定檔,有 realtime database rule,cloud functions , Hosting
D:\WorkSpace\firebase\recipe-book-4ng>firebase init
######## #### ######## ######## ######## ### ###### ########
## ## ## ## ## ## ## ## ## ## ##
###### ## ######## ###### ######## ######### ###### ######
## ## ## ## ## ## ## ## ## ## ##
## #### ## ## ######## ######## ## ## ###### ########
You're about to initialize a Firebase project in this directory:
D:\WorkSpace\firebase\recipe-book-4ng
? Are you ready to proceed? Yes
? Which Firebase CLI features do you want to setup for this folder? Press Space to select features, then Enter to confirm you
r choices. Database: Deploy Firebase Realtime Database Rules, Functions: Configure and deploy Cloud Functions, Hosting: Confi
gure and deploy Firebase Hosting sites
=== Project Setup ( 目前的目錄是要建給哪個 project 用的 )
First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add,
but for now we'll just set up a default project.
? Select a default Firebase project for this directory: recipe-book-4ng (recipe-book-4ng)
=== Database Setup ( realtime database 的 rule 設定 , 看 firebase console database )
Firebase Realtime Database Rules allow you to define how your data should be
structured and when your data can be read from and written to.
? What file should be used for Database Rules? database.rules.json
+ Database Rules for recipe-book-4ng have been downloaded to database.rules.json.
Future modifications to database.rules.json will update Database Rules when you run
firebase deploy.
=== Functions Setup ( Cloud functions 的功能,執行在 Node.js 環境 )
A functions directory will be created in your project with a Node.js
package pre-configured. Functions can be deployed with firebase deploy.
+ Wrote functions/package.json
+ Wrote functions/index.js
? Do you want to install dependencies with npm now? Yes
npm notice created a lockfile as package-lock.json. You should commit this file.
added 90 packages in 17.299s
=== Hosting Setup (設定 static html page , 使用 Angular 2 建立的 SPA )
Your public directory is the folder (relative to your project directory) that
will contain Hosting assets to be uploaded with firebase deploy. If you
have a build process for your assets, use your build's output directory.
? What do you want to use as your public directory? public
? Configure as a single-page app (rewrite all urls to /index.html)? Yes
+ Wrote public/index.html
i Writing configuration info to firebase.json...
i Writing project information to .firebaserc...
+ Firebase initialization complete!
沒有留言:
張貼留言