クイックリファレンス

Divshot 静的ホスティング CLI チートシート

静的 Web ホスティング Divshot のアーカイブ・クイックリファレンス:divshot.json 設定、ルーティングルール、クリーン URL、CLI コマンド、リダイレクトを掲載。

· 公開日

[!NOTE] Divshot は 2015 年に Google Firebase によって買収された初期の静的 Web アプリケーションホスティングプラットフォームです。本ガイドは宣言的ルーティング仕様の歴史的リファレンスです。

CLI ワークフロー

# CLI のインストールと認証
npm install -g divshot-cli
divshot login

# プロジェクトの作成とローカルサーバー起動
divshot init
divshot server

# 特定環境へのデプロイ
divshot push development
divshot push staging
divshot push production

# 環境間でのビルド昇格(プロモート)
divshot promote staging production

設定ファイル (divshot.json)

{
  "name": "my-static-app",
  "root": "./dist",
  "clean_urls": true,
  "error_page": "404.html",
  "routes": {
    "/*.html": "index.html",
    "/app/**": "app.html",
    "**": "index.html"
  },
  "redirects": {
    "/old-docs/:page": "/new-docs/:page",
    "/blog/rss": {
      "status": 301,
      "url": "https://feeds.example.com/rss"
    }
  },
  "headers": {
    "/assets/**": {
      "Cache-Control": "max-age=31536000"
    },
    "/api/**": {
      "Access-Control-Allow-Origin": "*"
    }
  }
}

環境変数とカスタムドメイン

# 環境変数の追加と取得
divshot env:add production API_KEY=xyz
divshot env:pull production

# カスタムドメインの追加
divshot domains:add www.example.com

# ステージング環境へのパスワード保護設定
divshot protect staging "tester:secretpass"

関連テーマ