BOLG依存パッケージアップデート業 2022/06/12
APIだけちゃちゃっとやるます。
Dependency Current Latest Status credo 1.6.4 1.6.4 Up-to-date ecto_sql 3.7.2 3.8.3 Update possible ex_aws 2.3.1 2.3.2 Update possible ex_aws_s3 2.3.2 2.3.2 Up-to-date gettext 0.19.1 0.19.1 Up-to-date hackney 1.18.1 1.18.1 Up-to-date id_token 0.2.0 0.2.0 Up-to-date jason 1.3.0 1.3.0 Up-to-date joken 2.4.1 2.4.1 Up-to-date logger_json 5.0.0 5.0.0 Up-to-date mock 0.3.7 0.3.7 Up-to-date new_relic_agent 1.27.7 1.27.7 Up-to-date oban 2.12.0 2.12.1 Update possible phoenix 1.6.7 1.6.10 Update possible phoenix_ecto 4.4.0 4.4.0 Up-to-date phoenix_pubsub 2.1.1 2.1.1 Up-to-date plug 1.13.6 1.13.6 Up-to-date plug_cowboy 2.5.2 2.5.2 Up-to-date postgrex 0.16.2 0.16.3 Update possible scrivener_ecto 2.7.0 2.7.0 Up-to-date scrivener_headers 3.2.2 3.2.2 Up-to-date sitemapper 0.6.0 0.6.0 Up-to-date
ecto_sql
Enhancements
Bug fixes
https://github.com/fuelen/ecto_dev_logger ってものがあり、これの一部が本家にフィードバックされている。
ex_aws
Changelogまだなし。
- IMDSv2が必須扱いになっているのでOptionalに変更
- 軽微なバグ修正
oban
max_attempts
に達したジョブの取得をやめる- サブクエリによってselectされたジョブに予期しない変更がなされる問題を修正
- devログにBEGINとCOMMITが出力されないように変更
- ユニークな結果になるクエリからORDER BYを削除
phoenix
- socket.jsに
ping
関数を追加 phx.gen.release
で生成される.dockerignore
のコメントを修正phx.gen.release
でecto_sql
を正しく検出できない場合がある問題を修正
postgrex
- クエリ結果を表す構造体に
Table.Reader
プロトコル実装- どこか読みやすくなる系
- https://hex.pm/packages/table
すべて上げてよし。
BOLG依存パッケージアップデート業 2022/04/26
API
ex_aws 2.2.10 2.3.1 Update possible oban 2.10.1 2.12.0 Update not possible phoenix 1.6.6 1.6.7 Update possible phoenix_pubsub 2.0.0 2.1.1 Update possible plug 1.13.4 1.13.6 Update possible
ex_aws
https://github.com/ex-aws/ex_aws/blob/c8015be9d89d9da2775b829b86ee4c6496877978/CHANGELOG.md
バグ修正などなど入っているけど、関係ありそうなのは
だけ。まあ上げて大丈夫でしょう。
oban
前にバージョン上げてトラブってから様子見してたけど、試しに上げてみたら動いてくれたので上げる。
phoenix
https://diff.hex.pm/diff/phoenix/1.6.6..1.6.7
- [Endpoint] telemetryイベントにEndpointのinitを追加
- [Endpoint]
- [Logger] Routerのmetadataに
log_module
を追加 - [phx.gen.release] assetsディレクトリがあるときだけassets関連の処理を実行
- [phx.gen.release] ecto_sqlが入っているときだけmigrationファイルを生成
- JSクライアントのESM対応
- JSクライアントのLongPollのバグ修正
上げてよし。
phoenix_pubsub
Phoenix.Tracker
にhandle_info
コールバック追加- v2.1.0でpoolが入ったことによって生まれた非互換な点の修正
- adapterの名前に
_1
とか以前はなかったsuffixが付くようになり互換性が崩れたので、pool sizeが1のときはsuffix無しにしたとのこと
- adapterの名前に
上げてよし。
plug
https://github.com/elixir-plug/plug/blob/274e44f9a149b922099bf60029d8267afe494968/CHANGELOG.md
forward
に:via
オプションが入った- コンパイル時依存性に関する軽微な修正
これも上げてよし。
front
next ^12.1.0 → ^12.1.5 react ^17.0.2 → ^18.0.0 react-dom ^17.0.2 → ^18.0.0 @types/node ^16.11.7 → ^17.0.26 @types/react ^17.0.42 → ^18.0.6 @types/react-dom ^17.0.14 → ^18.0.2 @typescript-eslint/parser ^5.16.0 → ^5.20.0 eslint ^8.11.0 → ^8.14.0 prettier ^2.6.0 → ^2.6.2 sass ^1.49.9 → ^1.50.1 ts-jest ^27.1.3 → ^27.1.4 typescript ^4.6.2 → ^4.6.3
next
https://github.com/vercel/next.js/releases
目を通したほうがいいんだろうけど量が量なので、上げてみて壊れたら考える。
react, react-dom
https://reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html
@types/*
合わせて上げる
@typescript-eslint/parser
https://github.com/typescript-eslint/typescript-eslint/blob/main/CHANGELOG.md#5200-2022-04-18
影響なさそう。上げてよし。
eslint
https://github.com/eslint/eslint/blob/de992b7016e3d91092de7748f0375943ad2c77f0/CHANGELOG.md
これも上げてよし。
prettier
https://github.com/prettier/prettier/blob/586a4b2a871b9026519fbf201cb678eb3b556343/CHANGELOG.md
OK
sass
https://github.com/sass/dart-sass/blob/0c24114badbed3e2c886049d255be83a29030445/CHANGELOG.md
map.deep-merge()
に潜在的な破壊的変更とあるけど、使ってないので上げてよし。
ts-jest
バグ修正のみ。OK
typescript
https://github.com/microsoft/TypeScript/releases/tag/v4.6.3
これも上げてよし。
VuexからPiniaへの乗り換え
BOLGの投稿画面はNuxt 2でできていて、3にするための準備で何度かNuxt Bridgeにするチャレンジをやっている。ただ毎回なにかしらがコケて成功しないので、もういっそのこと直接2から3へ上げてやろうということで、その準備としてのPinia移行。Vuex 4を使うという手もあるんだけど、どうせ移行作業するなら公式におすすめされてる方で。
Nuxt no longer provides a Vuex integration. Instead, the official Vue recommendation is to use pinia, which has built-in Nuxt support via a Nuxt module. Find out more about pinia here .
If you want to keep using Vuex, you can manually migrate to Vuex 4 following these steps .
https://v3.nuxtjs.org/migration/configuration/#vuex
Storeの移行
https://pinia.vuejs.org/core-concepts/ などを眺めながらやれば書き直しはわりと簡単。そこまで量は多くないんだけど後半は疲れたという程度。"arrow function recommended for full type inference"とのことなので、state
はアロー関数使っておきましょう。
https://pinia.vuejs.org/core-concepts/getters.html#with-setup でgetterにもmapState
が使えるよと書いてあるんだけど、一方で mapGetters
もあるという点はおやおやポイントでした。
ちょっと注意が必要な点としては https://pinia.vuejs.org/ssr/nuxt.html#using-the-store-outside-of-setup にあるようにfetch
とasyncData
ではstoreの作り方が他と違うというところ。ここの書き換えを忘れて500エラー出した。
fetch({ $pinia }) { const store = useStore($pinia) }
nuxtServerInit
https://nuxtjs.org/docs/directory-structure/store/#the-nuxtserverinit-action
nuxtServerInit
という名前のactionは特別扱いされていて、Vuexのストアに定義されていればリクエストが来たときにサーバ側で勝手に呼ばれます。Piniaでは呼ばれてくれないので、以下を参考にRouter middlewareで呼んであげます。勝手に呼ばれるときと違ってServer/Clientどちらでも呼ばれてしまうので、process.server
を見てあげましょう。
nuxtServerInit like implementation for Pinia · GitHub
// src/middleware/server-init.js import { useStore } from '@/store' const middleware = ({ $pinia, req }) => { if (process.server) { const store = useStore($pinia) store.nuxtServerInit({ req }) } } export default middleware
// nuxt.config.js router: { middleware: ['server-init'], },
という感じで書き換えて、いまのところ動いています。