File tree Expand file tree Collapse file tree 2 files changed +57
-1
lines changed Expand file tree Collapse file tree 2 files changed +57
-1
lines changed Original file line number Diff line number Diff line change 2424 id : changesets
2525 uses : changesets/action@v1
2626 with :
27- version : pnpm run version
27+ version : |
28+ pnpm run version
29+ ./scripts/update-template-dependencies.sh
2830 commit : ' chore: version packages'
2931 title : ' chore: version packages'
3032 publish : pnpm publish:npm
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -e
3+
4+ echo " Updating all @rnef/* dependencies to match CLI version..."
5+
6+ # Get the version from packages/cli/package.json
7+ CLI_VERSION=$( jq -r ' .version' packages/cli/package.json)
8+ echo " Using CLI version: $CLI_VERSION "
9+
10+ # Function to update package.json files
11+ update_package_json () {
12+ local file=$1
13+ echo " Processing $file ..."
14+
15+ # Create a temporary file
16+ temp_file=$( mktemp)
17+
18+ # Update all @rnef/* dependencies to match CLI version
19+ jq --arg version " ^$CLI_VERSION " '
20+ # Only update if the field exists
21+ if has("dependencies") then
22+ .dependencies = (
23+ .dependencies |
24+ to_entries |
25+ map(if .key | startswith("@rnef/") then .value = $version else . end) |
26+ from_entries
27+ )
28+ else . end |
29+
30+ if has("devDependencies") then
31+ .devDependencies = (
32+ .devDependencies |
33+ to_entries |
34+ map(if .key | startswith("@rnef/") then .value = $version else . end) |
35+ from_entries
36+ )
37+ else . end
38+ ' " $file " > " $temp_file "
39+
40+ # Replace the original file with the updated one
41+ mv " $temp_file " " $file "
42+ }
43+
44+ # Find all package.json files in templates directory and update them
45+ find ./templates -name " package.json" -not -path " */node_modules/*" | while read -r file; do
46+ update_package_json " $file "
47+ done
48+
49+ # Find all package.json files in packages/*/template directories and update them
50+ find ./packages -path " */template/*" -name " package.json" -not -path " */node_modules/*" | while read -r file; do
51+ update_package_json " $file "
52+ done
53+
54+ echo " Done! All @rnef/* dependencies have been updated to version ^$CLI_VERSION ."
You can’t perform that action at this time.
0 commit comments