npm 要常更新
$npm i -g npm
初始化 node project , 建立 package.json
$ npm init
初始化 node project , 有沒有 y 的差別在於,沒有 y 時,npm 會以互動方式詢問要建在 package.json 的項目內容,諸如 package name, description 等等。有 y 時 npm 就會使用預設值,一次建立完成。
$ npm init -y [ --yes ]
範例如下:
D:\tmp\testnpm2>npm init -y
Wrote to D:\tmp\testnpm2\package.json:
{
"name": "testnpm2",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
安裝目前目錄下 package.json 下 dependencies 列的套件
$npm install
全域安裝套件
$ npm install <package name> -g
移除全域套件
$ npm install <package name> -g
安裝最新版本的 Package
$ npm install <package name>@latest
列出全域套件
$ npm ls -g
更新全域套件
$ npm update -g
安裝套件,套件僅列在 devDependencies ,同 --save-dev
$ npm install <package name> -D
2017年7月7日 星期五
2017年7月5日 星期三
Firebase CLI 使用
Firebase CLI 主要是用來管理 及部署 firebase 專案,目前常用到的就是初始化專案及佈署 Cloud functions, Hosting SPA ......
首先要安裝 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!
首先要安裝 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!
2017年7月3日 星期一
Extend Disk of VirtualBox
訂閱:
意見 (Atom)
一些常用的 npm 指令
npm 要常更新 $npm i -g npm 初始化 node project , 建立 package.json $ npm init 初始化 node project , 有沒有 y 的差別在於,沒有 y 時,npm 會以互動方式詢問要建在 package.js...
-
Firebase CLI 主要是用來管理 及部署 firebase 專案,目前常用到的就是初始化專案及佈署 Cloud functions, Hosting SPA ...... 首先要安裝 Firebase CLI (當然要先安裝 Node.Js 環境 ) 如下: $ ...
-
Oracle VM Virtual 是個不錯的工具,用來建立測試環境剛剛好, OS 建立起來後,要開始安裝測試必須的軟體,這時需要一個可以將資料傳遞進去的方法,那就是共享目錄,在 QUEST 和 HOST 端建一個共享目錄,再將需要的檔案複製過去: 環境: HOST : W...
-
npm 要常更新 $npm i -g npm 初始化 node project , 建立 package.json $ npm init 初始化 node project , 有沒有 y 的差別在於,沒有 y 時,npm 會以互動方式詢問要建在 package.js...




