@leverege/build-tools 2.52.0-pedro.3 → 2.52.0-pedro.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leverege/build-tools",
3
- "version": "2.52.0-pedro.3",
3
+ "version": "2.52.0-pedro.4",
4
4
  "description": "A collection of build / support tools for Leverege developers",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -88,22 +88,48 @@ echo "Updated $HOME/.pypirc"
88
88
  UV_EXTRA_INDEX_URL="https://_json_key_base64:$ENCODED_KEY@us-python.pkg.dev/leverege-registry/leverege-python-packages/simple"
89
89
  UV_EXTRA_INDEX_URL_E=$(escape_for_sed "$UV_EXTRA_INDEX_URL")
90
90
 
91
- # If fish shell is installed, update the fish shell configuration
92
- if [[ $(command -v fish) != "" ]]; then
93
- echo "Updating fish shell configuration"
94
- fish -c "set -Ux UV_EXTRA_INDEX_URL $UV_EXTRA_INDEX_URL"
95
- fi
96
-
97
- # If bash shell is installed, update the bash shell configuration
98
- if [[ $(command -v bash) != "" ]]; then
99
- echo "Updating bash shell configuration"
100
- # Use sed to remove any existing UV_EXTRA_INDEX_URL variable
101
- sed -i '' "s|UV_EXTRA_INDEX_URL=.*|UV_EXTRA_INDEX_URL=$UV_EXTRA_INDEX_URL_E|" $HOME/.bashrc
102
- fi
91
+ # List of shell configuration files to update
92
+ SHELLS=("bash" "zsh" "fish")
93
+
94
+ for SHELL in "${SHELLS[@]}"; do
95
+ if command -v "$SHELL" >/dev/null 2>&1; then
96
+ case "$SHELL" in
97
+ bash)
98
+ config_file="${HOME}/.bashrc"
99
+ ;;
100
+ zsh)
101
+ config_file="${HOME}/.zshrc"
102
+ ;;
103
+ fish)
104
+ config_file="${HOME}/.config/fish/config.fish"
105
+ ;;
106
+ *)
107
+ echo "Shell $SHELL is not supported."
108
+ continue
109
+ ;;
110
+ esac
111
+
112
+ echo "Updating shell configuration in $config_file"
113
+
114
+ if grep -q "UV_EXTRA_INDEX_URL" "$config_file"; then
115
+ if [ "$SHELL" = "fish" ]; then
116
+ sed -i '' "s|set -x UV_EXTRA_INDEX_URL .*|set -x UV_EXTRA_INDEX_URL $UV_EXTRA_INDEX_URL_E|" "$config_file"
117
+ else
118
+ sed -i '' "s|export UV_EXTRA_INDEX_URL=.*|export UV_EXTRA_INDEX_URL=$UV_EXTRA_INDEX_URL_E|" "$config_file"
119
+ fi
120
+ else
121
+ if [ "$SHELL" = "fish" ]; then
122
+ echo "set -x UV_EXTRA_INDEX_URL $UV_EXTRA_INDEX_URL" >> "$config_file"
123
+ else
124
+ echo "export UV_EXTRA_INDEX_URL=$UV_EXTRA_INDEX_URL" >> "$config_file"
125
+ fi
126
+ fi
127
+ fi
128
+ done
103
129
 
104
- # If zsh shell is installed, update the zsh shell configuration
105
- if [[ $(command -v zsh) != "" ]]; then
106
- echo "Updating zsh shell configuration"
107
- # Use sed to remove any existing UV_EXTRA_INDEX_URL variable
108
- sed -i '' "s|UV_EXTRA_INDEX_URL=.*|UV_EXTRA_INDEX_URL=$UV_EXTRA_INDEX_URL_E|" $HOME/.zshrc
109
- fi
130
+ echo ""
131
+ echo "Please source your shell configuration to apply the changes."
132
+ echo "Example: source ~/.bashrc"
133
+ echo "Example: source ~/.zshrc"
134
+ echo "Example: source ~/.config/fish/config.fish"
135
+ echo ""
@@ -12,7 +12,7 @@ cat <<EOF > $HOME/.config/pip/pip.conf
12
12
  [global]
13
13
  extra-index-url = https://oauth2accesstoken:$TOKEN@us-python.pkg.dev/leverege-registry/leverege-python-packages/simple/
14
14
  EOF
15
- echo "Updated $HOME/.config/pip/pip.conf"
15
+ echo "Updated ~/.config/pip/pip.conf"
16
16
 
17
17
  # Write to pypirc
18
18
  cat <<EOF > $HOME/.pypirc
@@ -25,7 +25,7 @@ repository: https://us-python.pkg.dev/leverege-registry/leverege-python-packages
25
25
  username: oauth2accesstoken
26
26
  password: $TOKEN
27
27
  EOF
28
- echo "Updated $HOME/.pypirc"
28
+ echo "Updated ~/.pypirc"
29
29
 
30
30
  escape_for_sed() {
31
31
  printf '%s\n' "$1" | sed -e 's/[\/&]/\\&/g'
@@ -34,22 +34,48 @@ escape_for_sed() {
34
34
  UV_EXTRA_INDEX_URL="https://oauth2accesstoken:$TOKEN@us-python.pkg.dev/leverege-registry/leverege-python-packages/simple"
35
35
  UV_EXTRA_INDEX_URL_E=$(escape_for_sed "$UV_EXTRA_INDEX_URL")
36
36
 
37
- # If fish shell is installed, update the fish shell configuration
38
- if [[ $(command -v fish) != "" ]]; then
39
- echo "Updating fish shell configuration"
40
- fish -c "set -Ux UV_EXTRA_INDEX_URL $UV_EXTRA_INDEX_URL"
41
- fi
42
-
43
- # If bash shell is installed, update the bash shell configuration
44
- if [[ $(command -v bash) != "" ]]; then
45
- echo "Updating bash shell configuration"
46
- # Use sed to remove any existing UV_EXTRA_INDEX_URL variable
47
- sed -i '' "s|UV_EXTRA_INDEX_URL=.*|UV_EXTRA_INDEX_URL=$UV_EXTRA_INDEX_URL_E|" $HOME/.bashrc
48
- fi
49
-
50
- # If zsh shell is installed, update the zsh shell configuration
51
- if [[ $(command -v zsh) != "" ]]; then
52
- echo "Updating zsh shell configuration"
53
- # Use sed to remove any existing UV_EXTRA_INDEX_URL variable
54
- sed -i '' "s|UV_EXTRA_INDEX_URL=.*|UV_EXTRA_INDEX_URL=$UV_EXTRA_INDEX_URL_E|" $HOME/.zshrc
55
- fi
37
+ # List of shell configuration files to update
38
+ SHELLS=("bash" "zsh" "fish")
39
+
40
+ for SHELL in "${SHELLS[@]}"; do
41
+ if command -v "$SHELL" >/dev/null 2>&1; then
42
+ case "$SHELL" in
43
+ bash)
44
+ config_file="${HOME}/.bashrc"
45
+ ;;
46
+ zsh)
47
+ config_file="${HOME}/.zshrc"
48
+ ;;
49
+ fish)
50
+ config_file="${HOME}/.config/fish/config.fish"
51
+ ;;
52
+ *)
53
+ echo "Shell $SHELL is not supported."
54
+ continue
55
+ ;;
56
+ esac
57
+
58
+ echo "Updating shell configuration in $config_file"
59
+
60
+ if grep -q "UV_EXTRA_INDEX_URL" "$config_file"; then
61
+ if [ "$SHELL" = "fish" ]; then
62
+ sed -i '' "s|set -x UV_EXTRA_INDEX_URL .*|set -x UV_EXTRA_INDEX_URL $UV_EXTRA_INDEX_URL_E|" "$config_file"
63
+ else
64
+ sed -i '' "s|export UV_EXTRA_INDEX_URL=.*|export UV_EXTRA_INDEX_URL=$UV_EXTRA_INDEX_URL_E|" "$config_file"
65
+ fi
66
+ else
67
+ if [ "$SHELL" = "fish" ]; then
68
+ echo "set -x UV_EXTRA_INDEX_URL $UV_EXTRA_INDEX_URL" >> "$config_file"
69
+ else
70
+ echo "export UV_EXTRA_INDEX_URL=$UV_EXTRA_INDEX_URL" >> "$config_file"
71
+ fi
72
+ fi
73
+ fi
74
+ done
75
+
76
+ echo ""
77
+ echo "Please source your shell configuration to apply the changes."
78
+ echo "Example: source ~/.bashrc"
79
+ echo "Example: source ~/.zshrc"
80
+ echo "Example: source ~/.config/fish/config.fish"
81
+ echo ""