-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
package-lock.json問題に終止符を打つためにyarnを採用する #70
Conversation
- uses: actions/cache@master | ||
with: | ||
path: ~/.npm | ||
key: ${{ env.cache-version }}-node-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ env.cache-version }}-node- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
packge-lock.json
を監視するキャッシュではなくなるのでrm
またこういった記述をしなくても setup-node
で npm や yarn のパッケージのキャッシュを行える機構があるのでそれに乗っかる
restore-keys: | | ||
${{ env.cache-version }}-${{ runner.os }}--electron-builder-cache- | ||
- run: npm ci | ||
- run: yarn install --frozen-lockfile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
npm ci
と等価ではないけれども、もしも package.json で使っているパッケージが yarn.lock にかかれていない場合差分が出ていると検知し、エラーで停止するようになります
https://classic.yarnpkg.com/en/docs/cli/install/#toc-yarn-install-frozen-lockfile
プルリクエストありがとうございます。 |
他の方の開発環境に影響があるので、なんとなくですがまたアップデート直前に検証&方針決定したいと思います。 |
yarnを使わない今までの手法で、初学者の方も環境構築ができなくはないかもしれません。 なのでいまのところnpmで十分であるという判断をしたいと思います。 しかし、初学者の方がnpm installした際にpackage-lock.jsonが問題になるかもしれません。 その場合、プルリクエストはcloseしていただいても、openのままであってもどちらでも大丈夫です。 |
ご検討ありがとうございました。
みたいな当初解決したかった 継続的に使用パッケージの脆弱性対策や、その他機能導入のためのバージョンアップなどを行う際に lock 周りで問題が起こり始めたときにまた考え始めるでいいのかもしれません。 現時点このPRは不要に思えるので Close いたします 🙇 |
ありがとうございます。 |
ref: https://github.com/Hiroshiba/voicevox/issues/37
package-lock.jsonが頻繁に変わってしまうことの原因として、
npmのversionの差異が生じている状態で環境構築時にnpm installを実行してしまうことが挙げられる。
対策として
npm ci
を使うことを強制させるという手も考えられるが、npm install
をしてしまうことも大いに有り得る。バージョンの差異はengineフィールドで吸収することも可能だが
https://github.com/Hiroshiba/voicevox/pull/50
グローバルインストールしたnpmなどを利用していて、それをupgradeした場合にバージョンを落とすことが困難である。
そのため、それらのコントロールしづらい状況に対応すべくパッケージ管理に yarn を導入する。
package-lock.json からの migrate は以下のコマンドで実行した
yarnに変更するに辺り残タスクとして