EmDashのバージョンアップ(成功?20260424)

workerは一種のコンテナ。だから使い捨て?

EmDashのアップデート?

0.4.0 → 0.6.0 (失敗)

前回、既存リポジトリを使いまわしnpm-check-update 使って npm install、ブランチを作って、pushしてgithubでマージして。そうすると @emdash-cms/plugin-forms でビルドエラー。

下記はエラーログ。

10:49:38.474	npm error Could not resolve dependency:
10:49:38.474	npm error peer emdash@"0.1.1" from @emdash-cms/plugin-forms@0.1.1
10:49:38.475	npm error node_modules/@emdash-cms/plugin-forms
10:49:38.475	npm error   @emdash-cms/plugin-forms@"^0.1.1" from the root project
10:49:38.475	npm error
10:49:38.475	npm error Conflicting peer dependency: emdash@0.1.1
10:49:38.478	npm error node_modules/emdash
10:49:38.478	npm error   peer emdash@"0.1.1" from @emdash-cms/plugin-forms@0.1.1
10:49:38.479	npm error   node_modules/@emdash-cms/plugin-forms
10:49:38.479	npm error     @emdash-cms/plugin-forms@"^0.1.1" from the root project
10:49:38.479	npm error
10:49:38.479	npm error Fix the upstream dependency conflict, or retry
10:49:38.479	npm error this command with --force or --legacy-peer-deps
10:49:38.479	npm error to accept an incorrect (and potentially broken) dependency resolution.
10:49:38.480	npm error

0.4.0 → 0.7.0 (成功?)

リポジトリを使い回すのは諦めた。EmDashの公式リポジトリの `Deploy to Cloudflare` で もう1回デプロイしなおし。

リポジトリは新しくgithubに作成して、web画面にて0.4.0で使用していたD1 + R2 を指定。たぶん `wrangler.jsonc` でバインドする先を指定しておけばいいんだろうけどDeploy to Cloudflareで対応してしまったためにwrangler.jsoncの更新ができず。

cloudflareのweb画面やgithub上で、下記を手動更新。

  • wrangler.jsoncのworker_loadersをコメントアウト
  • 0.7.0から初回のビルド時に作成されたCloudflare KVを削除しておく

そしてビルド。ビルドが成功してから

  • カスタムドメインの付け替え
    0.4.0で使用していたWorkersからドメインを消して、0.7.0のWorkersに同じドメインを追加

正解は?

Deploy to Cloudflareするたびに、cloudflare KVが新しく作り直している状態なのでセッション情報とかが消える。ログインするときにパスキーを聞かれて「ユーザーが生成されました」と表示されて。

正しいユーザー情報はDB(D1)に格納されているから、KVをリセットしても問題ないんだろうけど、正しい方法がわからないので試行錯誤。

cloudflare workersとかDynamic Workersはコンテナだと考えた場合に1つのコンテナで更新していくよりもBlue-Green Deployment方式で切り替えていくのがcloudflareとしての考え方かもしれない。


追記。

Cloudflare Worksの設定を見返したらgithubの設定を変更できる様子。動作確認できていないので、あくまでも想定。

Deploy to Cloudflare して生成されたリポジトリでブランチを作って、バージョンアップ時にデプロイしたいブランチを指定すればよかったりする……?