LoginSignup
0
1

More than 3 years have passed since last update.

netlify開発を便利にするnetlify-cli

Last updated at Posted at 2019-07-05

インストール

npm install netlify-cli -g

ログイン

ここから先はnpxで動かしていきます。

npx netlify login

ログインポップアップが表示されるので使用したいアカウントでloginしましょう。

## ディレクトとnetlify上のプロジェクトを紐付ける

npx netlify init

↑と打つと

❯ ⇄  Link this directory to an existing site 
  +  Create & configure a new site 

上記のように選択肢が表示されるので既存プロジェクトを紐づけたい場合は Link this directory to an existing siteを選択
新規プロジェクトを作成し紐づけたい場合は Create & configure a new siteを選択してください。

エラーが出た場合

.netlify>state.json を開くと設定ファイルがあるので編集します。

.netlify>state.json
{
  "siteId": "API ID"
}

API IDを書き込めばok

API IDの場所

netlifyのプロジェクト管理画面に記載されています。

スクリーンショット_2019-07-05_9_40_32.png

手動デプロイ

netlifyは基本的にgitと連携してpushすれば自動でデプロイされますが
netlify-cliを使ってデプロイすることも可能です。

npx netlify deploy

公式リファレンス

詳しくは公式リファレンスを読んでください。
https://www.netlify.com/docs/cli/

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1