インストール
pw コマンドは、スキャフォールド、コード生成、マイグレーション、開発サーバーを
まとめて扱います。まず pw をインストールしてください。pw init で作る
プロジェクトは Go のツールチェーンを固定するため、プロジェクト作成前に別途 Go を
インストールする必要はありません。
pw を入れる
Section titled “pw を入れる”Homebrew
Section titled “Homebrew”brew install shibukawa/tap/pwタグ付きリリースのビルド済みバイナリを入れます。対象は macOS(Apple Silicon と Intel)と
Linux です。更新は brew upgrade で行えます。
nix run github:shibukawa/popcornweb#pw -- versionこれは何もインストールせずに pw を実行します。PATH に置きたい場合は、flake の
packages.<system>.pw をプロファイルや環境に追加するか、公開されている
overlays.default を自分の flake から使ってください。
derivation は buildGoModule でソースからビルドするので、x86_64-linux、
aarch64-linux、aarch64-darwin を対象にします。Intel の macOS は Homebrew の formula と
リリースアーカイブが担当します。nixpkgs がそのプラットフォームを外したためです。
flake は Go、gopls、TinyGo を含む devShells.default も公開しています。Devbox を
使わずにホスト側のツールチェインが欲しいときに使えます。
リリースアーカイブ
Section titled “リリースアーカイブ”タグごとに、ターゲット別のアーカイブと checksums.txt が
リリースページに公開されます。
展開するとディレクトリの階層無しで pw が出てくるので、チェックサムを検証してバイナリを
PATH に置けば終わりです。Windows をカバーするのは、このチャネルだけです。
Go ツールチェイン
Section titled “Go ツールチェイン”go install github.com/shibukawa/popcornweb/cmd/pw@latestこれも動きますし、サポートも続きます。最後に挙げているのは、モジュールが要求する Go ツールチェインが先に必要になるからです。それこそ、他の 3 つのチャネルが取り除いている 前提条件です。
pw versionpw 0.1.0 (abc1234, darwin/arm64, go1.26.0)pw help はコマンドの一覧を出します。
Usage: pw <command> [arguments]
Commands: init create a project in a new directory add enable a capability in a project that declined it new scaffold a handler or a page beside the ones you have generate write everything a compiler needs, stopping before the compiler check report generated files that are stale or missing fmt format template sources into their canonical form i18n reconcile message catalogs against the templates that use them migrate inspect and apply database migrations seed load seed datasets into the database build run generate and then compile the project dev watch, regenerate, rebuild, and restart doctor report what a named environment will actually run version print the version, revision, and toolchain help print this messageそれぞれのコマンドが何をするか、どこで説明されているかは pw コマンドにまとめてあります。
Popcorn Web は Go 1.26 以降が必要です。
新しいプロジェクトでは、pw init がフレームワークを require 済みの
go.mod を書き出すため、手動の go get は不要です。既存モジュールには 1 つだけ手順を
追加します。
go get github.com/shibukawa/popcornwebアプリケーションコードは、安定したアプリケーション向け API である
pw パッケージをインポートします。
import "github.com/shibukawa/popcornweb/pw"Devbox(任意)
Section titled “Devbox(任意)”生成されるプロジェクトには、Go と Valkey サービスをピン留めした devbox.json が
付属します。pw init --tailwind を使った場合は、スタンドアロンの Tailwind CSS
バイナリもピン留めされます。Devbox はツールの再現性を保ちますが必須ではありません。
Go が PATH にあれば、devbox shell を飛ばして pw dev を直接実行できます。
Devbox は jetify.com/devbox から導入できます。
次のステップ
Section titled “次のステップ”- 1. はじめる — 最初のプロジェクトを作って動かす。
