LoginSignup
1
1

More than 3 years have passed since last update.

firebase HostingへReactアプリをビルドしてデプロイするまでを1クリックで

Posted at

経緯

create-react-appから作成したWebアプリをFirebase Hostingにデプロイして公開しています。
ビルドせずにデプロイしてあれおかしいと時間を浪費することが多々あったので表題の件、考えました。

解決策

package.jsonのscriptsに下記を追加するだけ。

package.json
  "scripts": {
    "deploy": "npm run build && firebase deploy",
    ...
  },

VSCodeだと左下にnpmコマンドを1クリックで実行するショートカットが用意されているので、これでデプロイのためにシェルを開くことも必要なくなります。

npmcommand-on-vscode.png

Github Actionsでも利用できるので、package.jsonのscriptsは積極的に有効活用していきたい!

1
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
1
1