-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fetch-yarn-deps: add yarn-berry support
A new argument has been added to fetch-yarn-deps: `yarnVersion` which will default to `1` which uses the original `yarn`. For newer `yarn-berry` `yarn.lock`, one can set the `yarnVersion` to either `3` or `4` which will use yarn-berry3 or yarn-berry4 respectively. The difference is the `yarn.lock` file, which follows a different format, depending on the version. This also adds the corresponding tests. The added support for yarn.lock files > version 1 has been inspired by @szlend from #254369 (comment) fixes #254369 Signed-off-by: Florian Brandes <[email protected]> Co-authored-by: Doron Behar <[email protected]>
- Loading branch information
1 parent
6b69441
commit 379aa01
Showing
8 changed files
with
191 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
pkgs/build-support/node/fetch-yarn-deps/tests/berry_3/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "yarn-testing", | ||
"packageManager": "[email protected]", | ||
"dependencies": { | ||
"lit-html": "^3.2.1" | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
pkgs/build-support/node/fetch-yarn-deps/tests/berry_3/yarn.lock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# This file is generated by running "yarn install" inside your project. | ||
# Manual changes might be lost - proceed with caution! | ||
|
||
__metadata: | ||
version: 6 | ||
cacheKey: 10c0 | ||
|
||
"@types/trusted-types@npm:^2.0.2": | ||
version: 2.0.7 | ||
resolution: "@types/trusted-types@npm:2.0.7" | ||
checksum: 4c4855f10de7c6c135e0d32ce462419d8abbbc33713b31d294596c0cc34ae1fa6112a2f9da729c8f7a20707782b0d69da3b1f8df6645b0366d08825ca1522e0c | ||
languageName: node | ||
linkType: hard | ||
|
||
"lit-html@npm:^3.2.1": | ||
version: 3.2.1 | ||
resolution: "lit-html@npm:3.2.1" | ||
dependencies: | ||
"@types/trusted-types": "npm:^2.0.2" | ||
checksum: 31c02df2148bf9a73545570cbe57aae01c4de1d9b44060b6ff13641837d38e39e6b1abcf92e13882cc84f5fee37605ed79602b91ad479728549014462808118e | ||
languageName: node | ||
linkType: hard | ||
|
||
"yarn-testing@workspace:.": | ||
version: 0.0.0-use.local | ||
resolution: "yarn-testing@workspace:." | ||
dependencies: | ||
lit-html: ^3.2.1 | ||
languageName: unknown | ||
linkType: soft |
7 changes: 7 additions & 0 deletions
7
pkgs/build-support/node/fetch-yarn-deps/tests/berry_4/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "yarn-testing", | ||
"packageManager": "[email protected]", | ||
"dependencies": { | ||
"lit-html": "^3.2.1" | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
pkgs/build-support/node/fetch-yarn-deps/tests/berry_4/yarn.lock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# This file is generated by running "yarn install" inside your project. | ||
# Manual changes might be lost - proceed with caution! | ||
|
||
__metadata: | ||
version: 8 | ||
cacheKey: 10c0 | ||
|
||
"@types/trusted-types@npm:^2.0.2": | ||
version: 2.0.7 | ||
resolution: "@types/trusted-types@npm:2.0.7" | ||
checksum: 10c0/4c4855f10de7c6c135e0d32ce462419d8abbbc33713b31d294596c0cc34ae1fa6112a2f9da729c8f7a20707782b0d69da3b1f8df6645b0366d08825ca1522e0c | ||
languageName: node | ||
linkType: hard | ||
|
||
"lit-html@npm:^3.2.1": | ||
version: 3.2.1 | ||
resolution: "lit-html@npm:3.2.1" | ||
dependencies: | ||
"@types/trusted-types": "npm:^2.0.2" | ||
checksum: 10c0/31c02df2148bf9a73545570cbe57aae01c4de1d9b44060b6ff13641837d38e39e6b1abcf92e13882cc84f5fee37605ed79602b91ad479728549014462808118e | ||
languageName: node | ||
linkType: hard | ||
|
||
"yarn-testing@workspace:.": | ||
version: 0.0.0-use.local | ||
resolution: "yarn-testing@workspace:." | ||
dependencies: | ||
lit-html: "npm:^3.2.1" | ||
languageName: unknown | ||
linkType: soft |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
pkgs/build-support/node/fetch-yarn-deps/yarn-berry-config-hook.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
yarnBerryConfigHook(){ | ||
echo "Executing yarnBerryConfigHook" | ||
|
||
# Use a constant HOME directory | ||
mkdir -p /tmp/home | ||
export HOME=/tmp/home | ||
if [[ -n "$yarnOfflineCache" ]]; then | ||
offlineCache="$yarnOfflineCache" | ||
fi | ||
if [[ -z "$offlineCache" ]]; then | ||
echo yarnConfigHook: No yarnOfflineCache or offlineCache were defined\! >&2 | ||
exit 2 | ||
fi | ||
|
||
export YARN_ENABLE_TELEMETRY=0 | ||
yarn config set enableGlobalCache false | ||
yarn config set enableScripts false | ||
yarn config set cacheFolder "$offlineCache" | ||
|
||
yarn install --immutable --immutable-cache | ||
|
||
# TODO: Check if this is really needed | ||
patchShebangs node_modules | ||
|
||
echo "finished yarnConfigHook" | ||
} | ||
|
||
if [[ -z "${dontYarnInstallDeps-}" ]]; then | ||
postConfigureHooks+=(yarnBerryConfigHook) | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters