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

chore(deps-dev): add yarn binary in the repo #6757

Merged
merged 1 commit into from
Dec 26, 2024
Merged

Conversation

trivikr
Copy link
Member

@trivikr trivikr commented Dec 24, 2024

Issue

Internal JS-5639

Description

Uses vendored yarn version, as downloading yarn sometimes throw network errors failing internal builds

Testing

This check verifies that globally install yarn classic is able to jump to yarn modern.
We'll remove corepack from internal CI in future commit. We'll retain packageManager field for reference.

Pre-requisites

Fresh installation of Node.js (uses npm), and globally install yarn classic

$ rm -rf ~/.nvm

$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash

$ nvm ls
            N/A
...

$ nvm install 20
...
Now using node v20.18.1 (npm v10.8.2)
Creating default alias: default -> 20 (-> v20.18.1)

$ node -v
v20.18.1

$ npm install -g yarn

Download aws-sdk-js-v3 main branch and yarnPath branch with network enabled.

$ git clone https://github.com/trivikr/aws-sdk-js-v3.git --single-branch --depth 1

$ cd aws-sdk-js-v3

$ aws-sdk-js-v3> git fetch origin yarnPath:yarnPath --depth 1

Run the following commands with network disabled

Before

Throws error since network is not available to download yarn

$ aws-sdk-js-v3> yarn --version
1.22.22

In CI, it uses [email protected] as corepack is enabled

After

The globally installed yarn classic jumps to locally provided [email protected]

$ aws-sdk-js-v3> git checkout yarnPath

$ aws-sdk-js-v3> yarn --version
4.5.1

If corepack is enabled, it'll just download [email protected] from registry

$ aws-sdk-js-v3> corepack enable

$ aws-sdk-js-v3> yarn --version  
! Corepack is about to download https://repo.yarnpkg.com/4.5.1/packages/yarnpkg-cli/bin/yarn.js
? Do you want to continue? [Y/n] Y

4.5.1

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@trivikr

This comment was marked as outdated.

@trivikr

This comment was marked as outdated.

@trivikr
Copy link
Member Author

trivikr commented Dec 24, 2024

Created a feature request with corepack at nodejs/corepack#586

@trivikr trivikr marked this pull request as ready for review December 24, 2024 21:28
@trivikr trivikr requested a review from a team as a code owner December 24, 2024 21:28
@trivikr trivikr changed the title chore(deps-dev): use vendored yarn version chore(deps-dev): provide yarn binary in the repo Dec 24, 2024
@trivikr trivikr changed the title chore(deps-dev): provide yarn binary in the repo chore(deps-dev): add yarn binary in the repo Dec 24, 2024
@trivikr
Copy link
Member Author

trivikr commented Dec 24, 2024

Verified that yarn upgrade will happen smoothly

$ yarn set version 4.5.2

$ git status
On branch yarnPath
Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        deleted:    .yarn/releases/yarn-4.5.1.cjs
        modified:   .yarnrc.yml
        modified:   package.json

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        .yarn/releases/yarn-4.5.2.cjs

$ git diff .yarnrc.yml 
diff --git a/.yarnrc.yml b/.yarnrc.yml
index 225c9c14..18919ce0 100644
--- a/.yarnrc.yml
+++ b/.yarnrc.yml
@@ -1,3 +1,3 @@
 nodeLinker: node-modules
 
-yarnPath: .yarn/releases/yarn-4.5.1.cjs
+yarnPath: .yarn/releases/yarn-4.5.2.cjs

$ git diff package.json 
diff --git a/package.json b/package.json
index 43d84e1b..e22b9438 100644
--- a/package.json
+++ b/package.json
@@ -141,5 +141,5 @@
     ],
     "**/*.{ts,js,md,json}": "prettier --write"
   },
-  "packageManager": "[email protected]"
+  "packageManager": "[email protected]"
 }

@trivikr trivikr merged commit 46c59da into aws:main Dec 26, 2024
2 checks passed
@trivikr trivikr deleted the yarnPath branch December 26, 2024 17:03
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