Skip to content

feature: try to unify all versions to one #661

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.7.0
10 changes: 6 additions & 4 deletions clients/js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "starship-js",
"version": "0.0.1",
"version": "3.7.0",
"author": "Dan Lynch <[email protected]>",
"private": true,
"repository": {
Expand All @@ -21,9 +21,11 @@
"lint": "lerna run lint",
"format": "lerna run format",
"postinstall": "yarn symlink",
"publish": "yarn build; yarn lerna publish --no-private",
"publish:minor": "yarn build; yarn lerna publish minor --no-private",
"publish:major": "yarn build; yarn lerna publish major --no-private"
"version": "bash ../../scripts/sync-version.sh sync",
"prepublishOnly": "yarn build",
"publish": "lerna version --conventional-commits --yes && lerna publish from-package --yes",
"publish:minor": "lerna version minor --conventional-commits --yes && lerna publish from-package --yes",
"publish:major": "lerna version major --conventional-commits --yes && lerna publish from-package --yes"
},
"devDependencies": {
"@types/jest": "^29.5.11",
Expand Down
2 changes: 1 addition & 1 deletion clients/js/packages/starshipjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "starshipjs",
"version": "3.3.0",
"version": "3.7.0",
"author": "Dan Lynch <[email protected]>",
"description": "JS utilities for Starship",
"main": "index.js",
Expand Down
44 changes: 44 additions & 0 deletions scripts/sync-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

# Exit on error
set -e

# Function to read version from VERSION file
read_version() {
cat VERSION | tr -d '[:space:]'
}

# Function to sync version across all files
sync_version() {
local version=$1
echo "Syncing version $version across all files..."

# Update Chart.yaml
echo "Updating Chart.yaml..."
sed -i '' "s/^version: .*/version: $version/" starship/charts/devnet/Chart.yaml

# Update root package.json
echo "Updating root package.json..."
sed -i '' "s/\"version\": \".*\"/\"version\": \"$version\"/" clients/js/package.json

# Update all package.json files in packages
echo "Updating package.json files in packages..."
find clients/js/packages -name "package.json" -exec sed -i '' "s/\"version\": \".*\"/\"version\": \"$version\"/" {} \;
Comment on lines +16 to +26
Copy link
Preview

Copilot AI May 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The in-place sed command using 'sed -i ''' may work on macOS but can cause issues on Linux (GNU sed) which uses a different syntax. Consider adding conditional handling or documentation to ensure cross-platform compatibility.

Suggested change
# Update Chart.yaml
echo "Updating Chart.yaml..."
sed -i '' "s/^version: .*/version: $version/" starship/charts/devnet/Chart.yaml
# Update root package.json
echo "Updating root package.json..."
sed -i '' "s/\"version\": \".*\"/\"version\": \"$version\"/" clients/js/package.json
# Update all package.json files in packages
echo "Updating package.json files in packages..."
find clients/js/packages -name "package.json" -exec sed -i '' "s/\"version\": \".*\"/\"version\": \"$version\"/" {} \;
# Detect OS and set sed command
local sed_command
if [[ "$(uname)" == "Darwin" ]]; then
sed_command="sed -i ''"
else
sed_command="sed -i"
fi
# Update Chart.yaml
echo "Updating Chart.yaml..."
$sed_command "s/^version: .*/version: $version/" starship/charts/devnet/Chart.yaml
# Update root package.json
echo "Updating root package.json..."
$sed_command "s/\"version\": \".*\"/\"version\": \"$version\"/" clients/js/package.json
# Update all package.json files in packages
echo "Updating package.json files in packages..."
find clients/js/packages -name "package.json" -exec $sed_command "s/\"version\": \".*\"/\"version\": \"$version\"/" {} \;

Copilot uses AI. Check for mistakes.


echo "Version sync complete!"
}

# Main script logic
case "$1" in
"read")
read_version
;;
"sync")
version=$(read_version)
sync_version "$version"
;;
*)
echo "Usage: $0 {read|sync}"
exit 1
;;
esac
2 changes: 1 addition & 1 deletion starship/charts/devnet/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.6.0
version: 3.7.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
Loading