Skip to content

Commit fc8b5dc

Browse files
committed
Update release version bump script
1 parent 386293c commit fc8b5dc

1 file changed

Lines changed: 32 additions & 4 deletions

File tree

scripts/update-version.sh

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,42 @@ fi
1616

1717
echo "Updating packages to version $VERSION..."
1818

19-
# Update all package.json files in packages/*
19+
# Update all package.json files in packages/* (excluding templates and private packages)
2020
for package_dir in packages/*/; do
2121
if [ -f "${package_dir}package.json" ]; then
2222
package_name=$(basename "$package_dir")
23+
24+
# Skip template directories
25+
if [[ "$package_name" == *"-template"* ]] || [[ "$package_name" == "template-"* ]]; then
26+
echo " ⊘ Skipping template: $package_name"
27+
continue
28+
fi
29+
30+
# Check if package is private (skip private packages)
31+
is_private=$(node -e "
32+
try {
33+
const pkg = require('./${package_dir}package.json');
34+
console.log(pkg.private === true ? 'true' : 'false');
35+
} catch (e) {
36+
console.log('false');
37+
}
38+
")
39+
40+
if [ "$is_private" = "true" ]; then
41+
echo " ⊘ Skipping private package: $package_name"
42+
continue
43+
fi
44+
2345
echo " - Updating $package_name"
24-
cd "$package_dir"
25-
npm version "$VERSION" --no-git-tag-version --allow-same-version
26-
cd - > /dev/null
46+
47+
# Use Node.js to update the version in package.json
48+
node -e "
49+
const fs = require('fs');
50+
const path = '${package_dir}package.json';
51+
const pkg = JSON.parse(fs.readFileSync(path, 'utf8'));
52+
pkg.version = '${VERSION}';
53+
fs.writeFileSync(path, JSON.stringify(pkg, null, 2) + '\n');
54+
"
2755
fi
2856
done
2957

0 commit comments

Comments
 (0)