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

Fix "typesVersions" support in plugin-compat typescript patch #2215

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions packages/plugin-compat/extra/typescript/gen-typescript-patch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ JSPATCH="$THIS_DIR"/../../sources/patches/typescript.patch.ts

FIRST_PR_COMMIT="5d50de3"

# Added as `local` remote
LOCAL_REMOTE=https://github.com/cspotcode/TypeScript
# LOCAL_REMOTE=/d/Personal-dev/@yarnpkg/berry/TypeScript
ADDITIONAL_CHERRYPICK=6dbdd2f2c3177cde0d2cc3afd26fee07e0060a0f..local/ab/fix-typesVersions

# Defines which commits need to be cherry-picked onto which other commit to
# generate a patch suitable for the specified range.
HASHES=(
Expand All @@ -22,10 +27,23 @@ HASHES=(
)

mkdir -p "$TEMP_DIR"
# This local mirror makes subsequent clone faster when I want to `rm -rf /tmp/ts-repo/clone` because things are failing for mysterious reasons
# Could also be accomplished with git worktrees or `git clean -xdf`, but this is the hammer I knew how to use
if ! [[ -d "$TEMP_DIR"/mirror ]]; then (
git clone https://github.com/arcanis/typescript "$TEMP_DIR"/mirror
cd "$TEMP_DIR"/mirror
git remote add upstream https://github.com/microsoft/typescript
); fi
cd "$TEMP_DIR"/mirror
git fetch origin
git fetch upstream
if ! [[ -d "$TEMP_DIR"/clone ]]; then (
git clone https://github.com/arcanis/typescript "$TEMP_DIR"/clone
git clone --reference "$TEMP_DIR"/mirror https://github.com/arcanis/typescript "$TEMP_DIR"/clone
cd "$TEMP_DIR"/clone
git remote add upstream https://github.com/microsoft/typescript
if [ ! -z "$LOCAL_REMOTE"]; then
git remote add local "$LOCAL_REMOTE"
fi
); fi

rm -rf "$TEMP_DIR"/builds
Expand All @@ -38,12 +56,17 @@ git config user.name "Your Name"

git fetch origin
git fetch upstream
if [ ! -z "$LOCAL_REMOTE" ]; then
git fetch local
fi

reset-git() {
git reset --hard "$1"
git clean -df
git clean -xdf

npm install --before "$(git show -s --format=%ci)"
# npm 7 normalizes "bin" entries, which causes merge conflicts later
git checkout -- package.json
}

build-dir-for() {
Expand Down Expand Up @@ -76,6 +99,9 @@ make-build-for() {
else
git cherry-pick "$CHERRYPICK_FROM"^.."$CHERRYPICK_TO"
fi
if [ ! -z "$ADDITIONAL_CHERRYPICK" ]; then
git cherry-pick "$ADDITIONAL_CHERRYPICK"
fi
fi

for n in {5..1}; do
Expand Down
Loading