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

2966: Migrating to Modern Yarn #2968

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

bahaaTuffaha
Copy link
Contributor

Short description

Upgraded to [email protected]

Proposed changes

Note: not tested on iOS and focused mainly on integrate native and integrate web app.

Side effects

Not sure

Testing

  • I used this time: Node 22.9.0 you can install by nvm

  • before yarn install make sure to run corepack enable once to activate Corepack.

  • I suggest to delete all node modules files from the repo then do yarn install.

Resolved issues

Fixes: #2966


@LeandraH
Copy link
Contributor

Thank you, I probably won't manage to have time today to take a look at it but maybe also check out this old PR that was never merged to see what went wrong there and if this PR fixes the issues: #2588

@bahaaTuffaha
Copy link
Contributor Author

Thank you, I probably won't manage to have time today to take a look at it but maybe also check out this old PR that was never merged to see what went wrong there and if this PR fixes the issues: #2588

I found out it needs to be bit more in the oven.. sorry.. yarn test is not working I'm investigating...I will convert this PR to Draft for now

@bahaaTuffaha bahaaTuffaha marked this pull request as draft October 22, 2024 11:25
Copy link
Contributor

@LeandraH LeandraH left a comment

Choose a reason for hiding this comment

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

Just a few small comments, as discussed on Mattermost, next thing to do is get the commands in the package.json files to work in their respective folders.

native/package.json Outdated Show resolved Hide resolved
@@ -39,7 +39,7 @@ def determineBuildConfigName() {
}

def createYarnProcess(buildConfigName, platform, command) {
return execCommand("yarn workspace --silent build-configs --silent manage $command $buildConfigName $platform")
return execCommand("yarn workspace build-configs manage $command $buildConfigName $platform")
Copy link
Contributor

Choose a reason for hiding this comment

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

❓ Why did you remove the silent flags?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yarn complains about them and I didn't find any mention of it in the docs.
And I tried this also:
yarnpkg/yarn#788 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting, looks like it has been completely removed, thanks for looking into it!
yarnpkg/berry#3542

native/package.json Outdated Show resolved Hide resolved
native/package.json Outdated Show resolved Hide resolved
native/package.json Outdated Show resolved Hide resolved
package.json Outdated
Comment on lines 17 to 18
"lint": "yarn g:lint",
"g:lint": "eslint --cache --cache-location .eslintcache . && yarn workspace web stylelint && yarn workspace native stylelint",
Copy link
Contributor

Choose a reason for hiding this comment

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

❓ Why did you decide on those two different commands that do the same thing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😅 one for the current dir and the other for other workspaces...

Copy link
Contributor

Choose a reason for hiding this comment

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

Two things:

  1. This is at root, so there isn't really any code in this directory to be linted.
  2. If I now execute yarn lint in the root directory, yarn checks in package.json what to do for the command lint and sees that it should execute yarn g:lint. Which is the command in line 18. So both commands do the same thing with line 17 just being a reference to line 18. I don't think that's necessary.

shared/package.json Outdated Show resolved Hide resolved
@@ -36,6 +35,7 @@
"build-configs": "0.0.1",
"dompurify": "^3.1.6",
"focus-trap-react": "^10.2.3",
"htmlparser2": "^9.1.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

❓ Why did you add this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There was an error that has to do with htmlparser2 so I added this dependency

@@ -87,6 +87,7 @@
"raf": "^3.4.1",
"react-refresh": "^0.14.2",
"react-refresh-typescript": "^2.0.9",
"rrule": "2.8.1",
Copy link
Contributor

Choose a reason for hiding this comment

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

❓ And this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok I didn't find a way to let the dev dependences use the ones at the root folder thats way you will see that I added jest, stylelint,typescript and prettier

  • I know its duplicated but what else to do? and its a dev-dependency after all.

@@ -3,16 +3,28 @@
const { execSync } = require('child_process')
const { program } = require('commander')

function parseBashVariables(str) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I know this sounds bad but this what chat suggested to solve a problem that has to do with a long command in cmd (Error: spawnSync C:\WINDOWS\system32\cmd.exe ENAMETOOLONG
) when I run "start:malte" or "android:malte"

Copy link
Member

@steffenkleinle steffenkleinle left a comment

Choose a reason for hiding this comment

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

Thanks for your PR. The reason why we were not able yet to upgrade yarn to modern were memory problems in the CI (see yarnpkg/berry#3996 and #2026). Did you check that this issue is solved? Otherwise this will cost us lots of CI credits if we have to upgrade to bigger images. Therefore, please make sure that it still works in the CI. I sadly doubt that this issue is fixed as yarnpkg/berry#3996 is still open.

Furthermore, please revert all changes that are not necessary, e.g.

  • changes to autogenerated fastlane readmes
  • adding shared dependencies to web
  • removing tools yarn.lock
  • updating gradle (should only be done in react-native upgrades)
  • and others

Not sure if it is worth to invest the time though as long as the memory problem exists :/

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.

Migrating yarn from classic to modern
3 participants