Skip to content

Instantly share code, notes, and snippets.

@wojtekmaj
Last active September 21, 2025 08:41
Show Gist options
  • Save wojtekmaj/c38351dd715c1b108ab1ab089fcaf6fc to your computer and use it in GitHub Desktop.
Save wojtekmaj/c38351dd715c1b108ab1ab089fcaf6fc to your computer and use it in GitHub Desktop.

Revisions

  1. wojtekmaj revised this gist Oct 25, 2023. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion .gitignore
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,7 @@
    .pnp.*
    .yarn/*
    !.yarn/releases
    !.yarn/patches
    !.yarn/plugins
    !.yarn/releases
    !.yarn/sdks
    !.yarn/versions
  2. wojtekmaj revised this gist Oct 25, 2023. No changes.
  3. wojtekmaj revised this gist Oct 25, 2023. 1 changed file with 9 additions and 6 deletions.
    15 changes: 9 additions & 6 deletions upgrade-yarn-to-berry.sh
    Original file line number Diff line number Diff line change
    @@ -1,19 +1,22 @@
    #!/bin/sh

    # Upgrade Yarn to Berry (latest Yarn 2 version known to Yarn 1)
    # Upgrade to latest Yarn Modern (v4 at the moment)
    # WARNING: If you're running Node.js < 18:
    # 1. Who hurt you?
    # 2. Use `yarn set version 3.6.4` instead.
    yarn set version berry

    # Upgrade Yarn Berry to latest version now that Yarn knows where to download it from
    yarn set version latest

    # (optional) Set nodeLinker to node-modules - this 100% guarantees backwards compatibility
    # NOTE: Not needed in latest Yarn versions, this should be automatic
    yarn config set nodeLinker node-modules

    # (optional) Adds `yarn upgrade-interactive` command back
    # NOTE: Not needed in Yarn v4, plugins are now included
    yarn plugin import interactive-tools

    # Reinstalls project using Yarn 2. This will also update your yarn.lock file, but will NOT sneakily upgrade the dependencies
    # Reinstalls project using Yarn Modern. This will also update your yarn.lock file, but will
    # NOT sneakily upgrade the dependencies
    yarn

    # Commits the changes
    git add . && git commit -m "Upgrade Yarn to Yarn Berry (v2)"
    git add . && git commit -m "Upgrade Yarn to Yarn Berry"
  4. wojtekmaj revised this gist Sep 16, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion upgrade-yarn-to-berry.sh
    Original file line number Diff line number Diff line change
    @@ -16,4 +16,4 @@ yarn plugin import interactive-tools
    yarn

    # Commits the changes
    git commit . -m "Upgrade Yarn to Yarn Berry (v2)"
    git add . && git commit -m "Upgrade Yarn to Yarn Berry (v2)"
  5. wojtekmaj revised this gist Jul 31, 2020. 1 changed file with 12 additions and 4 deletions.
    16 changes: 12 additions & 4 deletions upgrade-yarn-to-berry.sh
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,19 @@
    #!/bin/sh
    # Upgrade Yarn to Berry

    # Upgrade Yarn to Berry (latest Yarn 2 version known to Yarn 1)
    yarn set version berry
    # Upgrade Yarn Berry to latest version now that we know where to download it from (Yarn 1 has no clue)

    # Upgrade Yarn Berry to latest version now that Yarn knows where to download it from
    yarn set version latest
    # Set nodeLinker to node-modules - this is optional but 100% guarantees backwards compatibility

    # (optional) Set nodeLinker to node-modules - this 100% guarantees backwards compatibility
    yarn config set nodeLinker node-modules
    # Adds `yarn upgrade-interactive` command back

    # (optional) Adds `yarn upgrade-interactive` command back
    yarn plugin import interactive-tools

    # Reinstalls project using Yarn 2. This will also update your yarn.lock file, but will NOT sneakily upgrade the dependencies
    yarn

    # Commits the changes
    git commit . -m "Upgrade Yarn to Yarn Berry (v2)"
  6. wojtekmaj revised this gist Jul 31, 2020. No changes.
  7. wojtekmaj revised this gist Jul 31, 2020. 1 changed file with 3 additions and 6 deletions.
    9 changes: 3 additions & 6 deletions upgrade-yarn-to-berry.sh
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,11 @@
    #!/bin/sh
    # Upgrade Yarn to Berry
    yarn set version berry
    # Upgrade Yarn Berry to latest version now that we know where to download it from
    # (Yarn 1 has no clue)
    # Upgrade Yarn Berry to latest version now that we know where to download it from (Yarn 1 has no clue)
    yarn set version latest
    # Set nodeLinker to node-modules - this is optional but 100% guarantees backwards
    # compatibility
    # Set nodeLinker to node-modules - this is optional but 100% guarantees backwards compatibility
    yarn config set nodeLinker node-modules
    # Adds `yarn upgrade-interactive` command back
    yarn plugin import interactive-tools
    # Reinstalls project using Yarn 2. This will also update your yarn.lock file, but will
    # NOT sneakily upgrade the dependencies
    # Reinstalls project using Yarn 2. This will also update your yarn.lock file, but will NOT sneakily upgrade the dependencies
    yarn
  8. wojtekmaj created this gist Jul 31, 2020.
    3 changes: 3 additions & 0 deletions .gitignore
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    .yarn/*
    !.yarn/releases
    !.yarn/plugins
    14 changes: 14 additions & 0 deletions upgrade-yarn-to-berry.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    #!/bin/sh
    # Upgrade Yarn to Berry
    yarn set version berry
    # Upgrade Yarn Berry to latest version now that we know where to download it from
    # (Yarn 1 has no clue)
    yarn set version latest
    # Set nodeLinker to node-modules - this is optional but 100% guarantees backwards
    # compatibility
    yarn config set nodeLinker node-modules
    # Adds `yarn upgrade-interactive` command back
    yarn plugin import interactive-tools
    # Reinstalls project using Yarn 2. This will also update your yarn.lock file, but will
    # NOT sneakily upgrade the dependencies
    yarn