JSPM

  • Created
  • Published
  • Downloads 45
  • Score
    100M100P100Q50221F
  • License MPL-2.0

Upgrade projects based on a Turborepo template using selective git diffs, with support for ignore paths and skipped packages.

Package Exports

  • @r18/upgrade

Readme

turborepo-template-upgrade

test Maintainability codecov Version Downloads npm bundle size Gitpod ready-to-code

Seamlessly keep your repo in sync with turborepo-template.


πŸš€ Purpose

turborepo-template-upgrade is a small utility built for repositories that were bootstrapped using react18-tools/turborepo-template.

Instead of manually copy-pasting template updates (bug fixes, CI improvements, tooling upgrades), this package provides:

  • One command upgrade – pull changes from the template into your repo.
  • Safe patching – applies diffs instead of overwriting.
  • Smart conflict resolution – especially for root package.json file.

πŸ“¦ Installation

You don’t need to add this as a runtime dependency. Use it as a dev tool:

npm install -D turborepo-template-upgrade
# or
yarn add -D turborepo-template-upgrade

⚑ Usage

Inside a repo created with turborepo-template:

npx turborepo-template-upgrade

This will:

  1. Fetch the latest changes from the template repo.
  2. Compute a git diff since your last upgrade.
  3. Apply the patch on top of your repo.
  4. Attempt to auto-resolve package.json conflicts.
  5. Store the last applied commit in .turborepo-template.lst.

If there are remaining conflicts, you’ll see them in .template.patch.


🧩 Conflict Resolution

  • package.json merges are handled automatically:

    • Keeps your dependencies.
    • Brings in template upgrades.
    • Deduplicates versions.
  • For other files, standard git apply --3way conflict markers may appear.


πŸ” Example Workflow

# 1. Upgrade
npx turborepo-template-upgrade

# 2. Review conflicts (if any)
git status
cat .template.patch

# 3. Commit changes
git add .
git commit -m "chore: upgrade template"

πŸ›  How It Works

  • Template repo is added as a Git remote (template).
  • Last applied commit hash is tracked in .turborepo-template.lst.
  • git diff between last applied commit β†’ template/main.
  • Patch applied locally with git apply --3way.

πŸ™ Acknowledgments

Thanks to the react18-tools community for shaping the turborepo ecosystem.

License

This library is licensed under the MPL-2.0 open-source license.

Please enroll in our courses or sponsor our work.


with πŸ’– by Mayank Kumar Chaudhari