Skip to content
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

Yarn2🐾 #240

Merged
merged 5 commits into from
Jul 28, 2021
Merged

Yarn2🐾 #240

merged 5 commits into from
Jul 28, 2021

Conversation

yonta
Copy link
Collaborator

@yonta yonta commented Jul 28, 2021

Yarnをコードネームberryにアップグレードした。

やったこと

  • Yarn migrationガイドに従いバージョンアップ
    • ただし、webpackerが対応するYarnバージョンから、yarn set version 2とYarn v2系を指定した。

やれなかったこと

  • Yarn最新版のコードネームberry(現在はv3)を使わずv2を使っている
    • webpackerがyarn >=1 <3を要求しているため
  • GitHub ActionsでTestをproduction環境で動かさずにdev環境で動かしている
    • Yarnのworkspaceプラグイン(v2以降でprod環境を設定するプラグイン)がなぜかv2で動かない
    • どうして
  • YarnのPlug'n'Paly機能の有効化していない
    • まだrails/webpackerが対応しきれていない
    • 試しにオンにして起動を試みたが、webpackerのコンパイルが失敗してしまった。
    • ttps://github.com/rails/webpacker/issues/ 2112

@yonta yonta requested a review from momocus July 28, 2021 09:54
@yonta yonta force-pushed the yarn2 branch 2 times, most recently from 3eda55c to c2c0d80 Compare July 28, 2021 10:15
webpackerの対応はYarn >=1 <3である。
一方で、コードネームberryはすでに3系になっている。
よって、`yarn set version 2`でv2系を指定している。

Yarn v2以降では、デフォルトでPlug'n'Playがオンになっている。
PnPはパッケージ内容をレポジトリに含めてキャッシュし、node_modulesディレクトリを使わなくなる。
そのため高速かつ再現性よく動作するようになっている。

しかし、rails/webpackerがまだYarnのPnPに対応していないようである。
  ttps://github.com/rails/webpacker/issues/ の 2112
そのため、PnPをまだ使わず、node_modulesディレクトリを使い続ける設定にした。
yonta added 2 commits July 28, 2021 19:26
生成された新たなキャッシュをgitignoreした
yonta added 2 commits July 28, 2021 19:44
Yarn v2系からyarn install --productionが削除されている。
新たなYarnではworkspaceプラグインで対応できる。
  https://yarnpkg.com/getting-started/migration/#renamed
しかし、このプラグインはコードネームberry(v3系)では動くが、v2系では動かない。
一方でwebpackerがYarn v2系を要求するため、コンフリクトしている。

とりあえず、GitHub ActionsのTestはdev環境で動かすことにする。
自動取得したファイルが改行されてないなんて。
@yonta yonta changed the title Yarn3🐾 Yarn2🐾 Jul 28, 2021
@momocus momocus merged commit 795b74b into master Jul 28, 2021
@momocus
Copy link
Owner

momocus commented Jul 28, 2021

動いてるからヨシ!

@momocus momocus deleted the yarn2 branch July 28, 2021 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants