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

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.5",
4
4
  "description": "A collection of build / support tools for Leverege developers",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -88,22 +88,51 @@ 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
+ SHELLS=("bash" "dash" "zsh" "fish")
92
+
93
+ for SHELL in "${SHELLS[@]}"; do
94
+ if command -v "$SHELL" >/dev/null 2>&1; then
95
+ case "$SHELL" in
96
+ bash)
97
+ config_file="${HOME}/.bashrc"
98
+ ;;
99
+ dash)
100
+ config_file="${HOME}/.profile"
101
+ ;;
102
+ zsh)
103
+ config_file="${HOME}/.zshrc"
104
+ ;;
105
+ fish)
106
+ config_file="${HOME}/.config/fish/config.fish"
107
+ ;;
108
+ *)
109
+ echo "Shell $SHELL is not supported."
110
+ continue
111
+ ;;
112
+ esac
113
+
114
+ echo "Updating shell configuration in $config_file"
115
+
116
+ if grep -q "UV_EXTRA_INDEX_URL" "$config_file"; then
117
+ if [ "$SHELL" = "fish" ]; then
118
+ sed -i '' "s|set -x UV_EXTRA_INDEX_URL .*|set -x UV_EXTRA_INDEX_URL $UV_EXTRA_INDEX_URL_E|" "$config_file"
119
+ else
120
+ sed -i '' "s|export UV_EXTRA_INDEX_URL=.*|export UV_EXTRA_INDEX_URL=$UV_EXTRA_INDEX_URL_E|" "$config_file"
121
+ fi
122
+ else
123
+ if [ "$SHELL" = "fish" ]; then
124
+ echo "set -x UV_EXTRA_INDEX_URL $UV_EXTRA_INDEX_URL" >> "$config_file"
125
+ else
126
+ echo "export UV_EXTRA_INDEX_URL=$UV_EXTRA_INDEX_URL" >> "$config_file"
127
+ fi
128
+ fi
129
+ fi
130
+ done
103
131
 
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
132
+ echo ""
133
+ echo "Please source your shell configuration to apply the changes."
134
+ echo "Example (bash): source ~/.bashrc"
135
+ echo "Example (dash): source ~/.profile"
136
+ echo "Example (zsh): source ~/.zshrc"
137
+ echo "Example (fish): source ~/.config/fish/config.fish"
138
+ 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,51 @@ 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
+ SHELLS=("bash" "dash" "zsh" "fish")
38
+
39
+ for SHELL in "${SHELLS[@]}"; do
40
+ if command -v "$SHELL" >/dev/null 2>&1; then
41
+ case "$SHELL" in
42
+ bash)
43
+ config_file="${HOME}/.bashrc"
44
+ ;;
45
+ dash)
46
+ config_file="${HOME}/.profile"
47
+ ;;
48
+ zsh)
49
+ config_file="${HOME}/.zshrc"
50
+ ;;
51
+ fish)
52
+ config_file="${HOME}/.config/fish/config.fish"
53
+ ;;
54
+ *)
55
+ echo "Shell $SHELL is not supported."
56
+ continue
57
+ ;;
58
+ esac
59
+
60
+ echo "Updating shell configuration in $config_file"
61
+
62
+ if grep -q "UV_EXTRA_INDEX_URL" "$config_file"; then
63
+ if [ "$SHELL" = "fish" ]; then
64
+ sed -i '' "s|set -x UV_EXTRA_INDEX_URL .*|set -x UV_EXTRA_INDEX_URL $UV_EXTRA_INDEX_URL_E|" "$config_file"
65
+ else
66
+ sed -i '' "s|export UV_EXTRA_INDEX_URL=.*|export UV_EXTRA_INDEX_URL=$UV_EXTRA_INDEX_URL_E|" "$config_file"
67
+ fi
68
+ else
69
+ if [ "$SHELL" = "fish" ]; then
70
+ echo "set -x UV_EXTRA_INDEX_URL $UV_EXTRA_INDEX_URL" >> "$config_file"
71
+ else
72
+ echo "export UV_EXTRA_INDEX_URL=$UV_EXTRA_INDEX_URL" >> "$config_file"
73
+ fi
74
+ fi
75
+ fi
76
+ done
77
+
78
+ echo ""
79
+ echo "Please source your shell configuration to apply the changes."
80
+ echo "Example (bash): source ~/.bashrc"
81
+ echo "Example (dash): source ~/.profile"
82
+ echo "Example (zsh): source ~/.zshrc"
83
+ echo "Example (fish): source ~/.config/fish/config.fish"
84
+ echo ""