mirror of
https://github.com/hanzoai/turborepo.git
synced 2026-10-30 19:44:51 +00:00
## Summary - Fixes the post-release `update-examples` workflow that [failed on the 2.8.17 release](https://github.com/vercel/turborepo/actions/runs/23065684956/job/67005690141) - Updates all examples to `[email protected]` ## Problem Yarn Classic refuses to run `upgrade` when the lockfile is out of sync with `package.json`, exiting with `error Outdated lockfile. Please run 'yarn install' and try again.` This broke the `with-react-native-web` example during the automated post-release bump. ## Fix Added a `yarn install` step before the upgrade command in both `scripts/update-examples-dep.sh` and `examples/update-turbo.ts` so the lockfile is synced before the upgrade runs.
49 lines
1.5 KiB
Bash
Executable File
49 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# This script updates the turbo dependency in all examples that are using any package manager.
|
|
|
|
# Usage: ./scripts/update-examples-dep.sh
|
|
# Example: ./scripts/update-examples-dep.sh
|
|
|
|
set -e
|
|
|
|
# Change directory to the script's directory
|
|
cd "$(dirname "$0")"
|
|
|
|
package="turbo"
|
|
|
|
# Fetch the latest version of the package from npm
|
|
latest_version=$(npm show $package version)
|
|
|
|
echo "Upgrading $package to version $latest_version in all examples..."
|
|
|
|
# Get the list of example directories
|
|
examples="../examples"
|
|
|
|
for dir in "$examples"/*; do
|
|
if [ -d "$dir" ]; then
|
|
cd "$dir"
|
|
example=$(basename "$(pwd)")
|
|
echo $example
|
|
if [ -e "pnpm-lock.yaml" ]; then
|
|
echo "• Updating to $package@$latest_version using pnpm"
|
|
pnpm up $package@$latest_version 2>&1 >/dev/null
|
|
elif [ -e ".yarn" ]; then
|
|
echo "• Updating to $package@$latest_version using yarn"
|
|
yarn install 2>&1 >/dev/null
|
|
yarn add $package@$latest_version 2>&1 >/dev/null
|
|
elif [ -e "yarn.lock" ]; then
|
|
echo "• Updating to $package@$latest_version using yarn"
|
|
yarn install 2>&1 >/dev/null
|
|
yarn upgrade $package@$latest_version --ignore-workspace-root-check 2>&1 >/dev/null
|
|
elif [ -e "package-lock.json" ]; then
|
|
echo "• Updating to $package@$latest_version using npm"
|
|
npm install $package@$latest_version 2>&1 >/dev/null
|
|
else
|
|
echo "• No recognized package manager - skipping."
|
|
fi
|
|
cd - >/dev/null
|
|
echo ""
|
|
fi
|
|
done
|