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

chore(canary): Avoid workspace:* in published package.json files #10532

Merged
merged 1 commit into from
May 1, 2024
Merged
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
33 changes: 33 additions & 0 deletions .github/scripts/publish_canary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ echo 'n' \
| awk -F. '{ $NF = $NF + 1 } 1' OFS=. \
> canary_version

# Update create-redwood-app templates to use canary packages

sed "s/\"@redwoodjs\/\(.*\)\": \".*\"/\"@redwoodjs\/\1\": \"$(cat canary_version)\"/" \
packages/create-redwood-app/templates/js/package.json > tmpfile \
&& mv tmpfile packages/create-redwood-app/templates/js/package.json
Expand All @@ -60,6 +62,37 @@ sed "s/\"@redwoodjs\/\(.*\)\": \".*\"/\"@redwoodjs\/\1\": \"$(cat canary_version
packages/create-redwood-app/templates/ts/web/package.json > tmpfile \
&& mv tmpfile packages/create-redwood-app/templates/ts/web/package.json

# Update all packages to replace any "workspace:*" with this canary version

framework_dir="$(cd "$(dirname "$0")" && pwd)/../.."
ws="$(yarn workspaces list --json)"

IFS=$'\n'
for line in $ws; do
location=$(
echo "$line" |
jq -r '.location'
)

relative_pkg_json_path="$location/package.json"

if [[ $location == "." ]]; then
printf "Skipping:\t%s\n" "$relative_pkg_json_path"
continue
fi

pkg_json_path="$framework_dir/$relative_pkg_json_path"
if [ ! -f "$pkg_json_path" ]; then
printf "ERROR:\nNo package.json found at%s\n" "$relative_pkg_json_path"
exit 1
fi

printf "Processing:\t%s\n" "$relative_pkg_json_path"
sed "s/workspace:\*/$(cat canary_version)/g" "$pkg_json_path" > tmpfile \
&& mv tmpfile "$pkg_json_path"
done

# Commit the changes
git config user.name "GitHub Actions"
git config user.email "<>"

Expand Down
Loading