Skip to content

refactor: migrate to Yarn Berry (v3.2.1)#8764

Merged
syuilo merged 120 commits into
misskey-dev:developfrom
ThatOneCalculator:yarn-3
Nov 24, 2022
Merged

refactor: migrate to Yarn Berry (v3.2.1)#8764
syuilo merged 120 commits into
misskey-dev:developfrom
ThatOneCalculator:yarn-3

Conversation

@ThatOneCalculator

@ThatOneCalculator ThatOneCalculator commented May 29, 2022

Copy link
Copy Markdown
Contributor

What

Migrate to Yarn Berry (v3.2.1)

Resolve #5858
Supersede #8472

Why

As yarn v3 (yarn berry) has worked with Misskey for a while and provides better performance when compiling while still retaining backwards compatibility with yarn v1, I feel that upgrading to yarn berry would be a smart choice.

Additional info

I've been building Misskey with yarn v3 for two months now both on my server for production and on my development machine with absolutely no problems. This PR was made simply by running yarn with yarn 3.2.1 and following the yarn migration instructions.

Further steps

  • Documentation on Misskey Hub would have to be updated
  • Update workflow (especially mocha and e2e)
  • Update the install script (maybe docker too?)

@github-actions github-actions Bot added packages/backend Server side specific issue/PR packages/frontend Client side specific issue/PR labels May 29, 2022
@ThatOneCalculator ThatOneCalculator marked this pull request as draft May 29, 2022 20:00
@ThatOneCalculator ThatOneCalculator marked this pull request as ready for review May 29, 2022 20:13
@ThatOneCalculator ThatOneCalculator changed the title Add compatibility for Yarn Berry (v3) Switch to Yarn Berry (v3.2.1) May 29, 2022
@ThatOneCalculator

ThatOneCalculator commented May 29, 2022

Copy link
Copy Markdown
Contributor Author

@acid-chicken I'd personally like your feedback on this PR first if you don't mind, as you've been the most involved with Yarn Berry discussion.

@acid-chicken acid-chicken self-requested a review May 29, 2022 23:07

@acid-chicken acid-chicken left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your work.
I believe that by using the node_modules linker, we can upgrade without facing most of the problems, so I think this PR is fine with the current policy for now, regardless of whether we move to PnP mode in the future or not.

Also, since Yarn berry has built-in monorepo management system called workspaces, so it would be great (and probably easy) to also improve the current situation, which is awkwardly realized by scripts/install-packages.js and so on.

@acid-chicken acid-chicken added 🛠️Dev Development of Misskey itself and removed packages/frontend Client side specific issue/PR packages/backend Server side specific issue/PR labels May 29, 2022
@acid-chicken

acid-chicken commented May 29, 2022

Copy link
Copy Markdown
Member

Also, since there are opinions like #5858 (comment), it would be better if Corepack could be used as a boot loader for Yarn berry (instead of placing .yarn/releases/yarn-3.2.1.cjs directly).

@ThatOneCalculator

Copy link
Copy Markdown
Contributor Author

Running corepack enable in the repo folder didn't change anything, is there a proper way to enable corepack?

@acid-chicken

Copy link
Copy Markdown
Member

corepack enable is related to environment settings, so it will not change anything in the repository (excluding docs).
Can you confirm that deleting .yarn/releases/yarn-3.2.1.cjs with "packageManager" specified in package.json after running it still works?

@ThatOneCalculator

ThatOneCalculator commented May 30, 2022

Copy link
Copy Markdown
Contributor Author

Can you confirm that deleting .yarn/releases/yarn-3.2.1.cjs with "packageManager" specified in package.json after running it still works?

@acid-chicken yep!

@github-actions github-actions Bot added packages/backend Server side specific issue/PR packages/frontend Client side specific issue/PR labels May 30, 2022
@ThatOneCalculator

Copy link
Copy Markdown
Contributor Author

Seems like the labeler bot adds back removed labels every commit ^^"

@ThatOneCalculator

Copy link
Copy Markdown
Contributor Author

Also, since Yarn berry has built-in monorepo management system called workspaces, so it would be great (and probably easy) to also improve the current situation, which is awkwardly realized by scripts/install-packages.js and so on.

Done!

@acid-chicken

Copy link
Copy Markdown
Member

I assume packages/*/yarn.lock will no longer be used after yarn install should consolidate the lock files in /yarn.lock.

@tamaina

tamaina commented Oct 29, 2022

Copy link
Copy Markdown
Contributor

developに追従した

@tamaina

tamaina commented Nov 7, 2022

Copy link
Copy Markdown
Contributor

マージしちゃう?

@tamaina

This comment was marked as abuse.

@tamaina

This comment was marked as abuse.

@tamaina

tamaina commented Nov 13, 2022

Copy link
Copy Markdown
Contributor

yarn install --immutableであれば1GiBで足りるかも

@rinsuki

rinsuki commented Nov 13, 2022

Copy link
Copy Markdown
Contributor

そもそもproductionのビルドって yarn v1 版でも1GBで足りるんだっけ?vite入ったから行ける?

@tamaina

tamaina commented Nov 13, 2022

Copy link
Copy Markdown
Contributor

無理だった
でも1536MiBならいけた

Comment thread packages/backend/package.json
Comment thread packages/client/package.json
Comment thread packages/backend/package.json Outdated
"ioredis": "4.28.5",
"ip-cidr": "3.0.10",
"is-svg": "4.3.2",
"jest-mock": "^29.0.3",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

要る?
要るとしてもdevDependenciesじゃないかしら

"node-fetch": "3.3.0",
"nodemailer": "6.8.0",
"nsfwjs": "2.4.2",
"oauth": "^0.10.0",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

要る?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DiscordServerServiceとGithubServerServiceでは使われているけど

@tamaina tamaina requested a review from syuilo November 22, 2022 05:34
@tamaina

tamaina commented Nov 22, 2022

Copy link
Copy Markdown
Contributor

Fastifyと統合するのちょっと骨折れそう

@syuilo syuilo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YOSASOU

@syuilo syuilo merged commit bdbc448 into misskey-dev:develop Nov 24, 2022
@syuilo

syuilo commented Nov 24, 2022

Copy link
Copy Markdown
Member

🙏🏻🙏🏻🙏🏻

@ThatOneCalculator

Copy link
Copy Markdown
Contributor Author

🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉

@syuilo

syuilo commented Dec 22, 2022

Copy link
Copy Markdown
Member

nodeLinker: pnpmだと型の不具合が起きるっぽい
https://mstdn.rinsuki.net/@rinsuki/109556531278084299

@rinsuki

rinsuki commented Dec 22, 2022

Copy link
Copy Markdown
Contributor

いやこれ peerDependencies に追加すれば解決する

tolehata pushed a commit to tolehata/hataskey that referenced this pull request Jun 2, 2026
* Yarn berry

* Add `.yarn` to dockerignore

* Mention in CHANGELOG

* Update Dockerfile

* Proper upgrade to yarn

* use `"packageManager"`

* Replace `install-packages.js` with workspaces

* Replace `install-packages.js` with workspaces

* Typo

* `corepack enable` for linting

* Remove `packages/*/yarn.lock`

* Improve lint workflow

* Update .github/workflows/lint.yml

Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com>

* Update .github/workflows/lint.yml

Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com>

* Add `eslint`

* Regenerate yarn.lock

* 🙏‍

* Update lint.yml

:thinking:

* Fix workflow!

* yarn lint my beloved

* corepack enable for mocha/e2e

* Update CHANGELOG.md

* fix the code that depends on node_modules

* tbh

* tbh

* More yarn workspaces stuff

* 🍀

* Change `browser-image-resizer`

* :finnadie:

* :goberserk:

* :godmode:

* Remove yarnrc for workspaces

* 🙏

* Add proper packages for eslint

* Skip extra install

* New steps for test.yml too

* uhh

* Update .dockerignore

* Update lint.yml

* Update test.yml

* Make client/backend lints seperate workflows

* package.json names

* pnpm = dont change paths

* Fix changelog

* :bowtie:

* I don't know why github workflows hates me...

* test

* ?????

* continue-on-error: true

* Fix yarn.lock

Co-authored-by: ishowta <ishowta@gmail.com>

* add @rollup/pluginutils

* add packageExtensions for chartjs_date-fns

Co-authored-by: acid-chicken <root@acid-chicken.com>

* npm run => yarn

* wip

* yarn node => node

依存関係の記載不足の解消がかなり多いため、yarn nodeは使わない

* fix

* fix http-signature

* fix

* fix

* add packageExtensions

* ✌️

* remove `yarn set version berry`

* yarn install --immutable

Co-authored-by: ishowta <ishowta@gmail.com>

* misskey-dev/misskey#8764 (comment)

* enable actions/setup-node's global cache

* Update .gitignore

Co-authored-by: iwata <ishowta@gmail.com>

* revival gulp build
https://github.com/misskey-dev/misskey/pull/8764/files/66ab7591bff9b35255219057e33399a06260aa31#r885899944

* fix lockfile

* Update packages/backend/package.json

Co-authored-by: iwata <ishowta@gmail.com>

* remove packagemanager

* `yarn run gulp` in `build` instead of just `gulp`

* Update CHANGELOG.md

* update lockfile

* Add .yarn/cache to gitignore for packages

* ?

* move resolutions

* ✌️

* update lockfie

* update-lockfile

* update yarn.lock

* fix build

* fix

* fix

* fix: add @tensorflow/tfjs

* ダメ

* modify lockfile

* use yarnrc

* update yarnlock

* add jest-mock

* update-lockfile

* update lockfile

* update lockfile

* move jest-mock, update lockfile

Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
Co-authored-by: tamaina <tamaina@hotmail.co.jp>
Co-authored-by: ishowta <ishowta@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🛠️Dev Development of Misskey itself packages/backend Server side specific issue/PR packages/frontend Client side specific issue/PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Discussion: Yarn v2

8 participants