LoginSignup
0
0

dependency-cruiser-report-actionをmonorepoに使おうとしてハマったメモ

Posted at

概要

dependency-cruiser-report-actionを使って、typescriptの依存性の可視化をプルリクのコミットメッセージに入れた。
思ったより苦労したのでメモ。

プルリク
ソースコード(Github Actions)

結論

packageVersionを指定している場合は、MH4GF/dependency-cruiser-report-action@v2.5.0のようにマイナーバージョンまで指定しないとエラーとなる。

試行錯誤

下記のエラーが発生した。

found 0 vulnerabilities
/usr/local/bin/yarn run -s depcruise --output-type mermaid --config .dependency-cruiser.cjs --focus ^.dependency-cruiser.cjs|^src/domain/fallMagia/hooks/udonTutorialHooks.ts .dependency-cruiser.cjs src/domain/fallMagia/hooks/udonTutorialHooks.ts
error This project's package.json defines "packageManager": "yarn@npm@10.8.1". However the current global version of Yarn is 1.22.22.

Presence of the "packageManager" field indicates that the project is meant to be used with Corepack, a tool included by default with all official Node.js distributions starting from 16.9 and 14.19.
Corepack must currently be enabled by running corepack enable in your terminal. For more information, check out https://yarnpkg.com/corepack.

issueに同様のエラーが上がっているけどCloseされており、首をかしげることになった。

このとき、MH4GF/dependency-cruiser-report-action@v2は最新のバージョンが利用されると思っていた。

無事、レポートの作成ができた。

image.png

参考

ESLintだけでは守れない。Dependency cruiserによるアーキテクチャー保護
dependency-cruiser-report-actionでPRの変更ファイルの依存関係を可視化してコメントする
GitHub Actions の uses でメジャーバージョンを参照するのはリスク

dependency-cruiser-report-action

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