15
15
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
16
# See the License for the specific language governing permissions and
17
17
# limitations under the License.
18
+ #
19
+ # SPDX-License-Identifier: Apache-2.0
18
20
19
21
if (( EUID == 0 )) && [[ -z ${DANGEROUSLY_RUN_AS_ROOT+x} ]]; then
20
22
echo " Please do not run as root unless DANGEROUSLY_RUN_AS_ROOT is set."
@@ -63,11 +65,6 @@ function genkit::update_path() {
63
65
# Remove trailing slash if present.
64
66
new_path=" ${new_path%/ } "
65
67
66
- if [ ! -d " $new_path " ]; then
67
- echo " Error: Directory $new_path does not exist"
68
- return 1
69
- fi
70
-
71
68
# Check if path is already in PATH
72
69
if [[ " :$PATH :" != * " :$new_path :" * ]]; then
73
70
if [ -n " ${ZSH_VERSION:- } " ]; then
@@ -100,26 +97,32 @@ function genkit::install_prerequisites() {
100
97
# Darwin-based systems.
101
98
brew install \
102
99
curl \
100
+ fd \
103
101
gh \
104
102
go \
105
103
node \
106
- python3
104
+ python3 \
105
+ ripgrep
107
106
elif [[ -x " $( command -v apt) " ]]; then
108
107
# Debian-based systems.
109
108
sudo apt install -y \
110
109
curl \
110
+ fd-find \
111
111
gh \
112
112
golang \
113
113
nodejs \
114
- python3
114
+ python3 \
115
+ ripgrep
115
116
elif [[ -x " $( command -v dnf) " ]]; then
116
117
# Fedora-based systems.
117
118
sudo dnf install -y \
118
119
curl \
120
+ fd-find \
119
121
gh \
120
122
go \
121
123
node \
122
- python3
124
+ python3 \
125
+ ripgrep
123
126
else
124
127
echo " Unsupported OS. Please install protoc manually."
125
128
fi
@@ -154,30 +157,39 @@ function genkit::install_google_cloud_sdk() {
154
157
}
155
158
156
159
# Install all the required tools that have been written in Go.
157
- function genkit::install_go_cli_tools() {
160
+ function genkit::install_go_cli_tools_ci() {
161
+ go install github.com/google/go-licenses@latest
162
+ go install golang.org/x/vuln/cmd/govulncheck@latest
163
+ go install oss.terrastruct.com/d2@latest
164
+ }
165
+
166
+ # Install all the required tools that have been written in Go.
167
+ function genkit::install_go_cli_tools_eng() {
158
168
go install github.com/Gelio/go-global-update@latest
159
169
go install github.com/captainhook-go/captainhook/cmd/captainhook@latest
160
170
go install github.com/google/addlicense@latest
161
171
go install github.com/google/go-licenses@latest
162
172
go install github.com/jesseduffield/lazygit@latest
163
173
go install golang.org/x/vuln/cmd/govulncheck@latest
174
+ go install oss.terrastruct.com/d2@latest
164
175
}
165
176
166
177
# Install all the required tools that have been written in Rust. We're assuming
167
178
# that the user has already installed rust and cargo.
168
- function genkit::install_cargo_cli_tools () {
179
+ function genkit::install_cargo_cli_tools_eng () {
169
180
cargo install --locked \
170
181
convco \
171
- fd-find \
172
- ripgrep \
173
182
rust-parallel \
174
183
taplo-cli
175
184
}
176
185
177
186
# Install NPM packages.
178
187
function genkit::install_pnpm_cli_tools() {
179
- # Install the Genkit CLI. See: https://firebase.google.com/docs/genkit/devtools
180
- pnpm add -g genkit-cli
188
+ # Genkit CLI: https://firebase.google.com/docs/genkit/devtools
189
+ # Biome: https://biomejs.dev/
190
+ pnpm add -g \
191
+ @biomejs/biome \
192
+ genkit-cli
181
193
}
182
194
183
195
# Install all the Python-related formatter and static analysis tools.
@@ -189,6 +201,9 @@ function genkit::install_python_cli_tools() {
189
201
190
202
# Install documentation site generator.
191
203
function genkit::install_docs_cli_tools() {
204
+ # Install d2.
205
+ curl -fsSL https://d2lang.com/install.sh | sh -s --
206
+
192
207
# Engineering documentation site generator.
193
208
# See: https://squidfunk.github.io/mkdocs-material/
194
209
uv tool install \
@@ -218,21 +233,23 @@ function genkit::setup_genkit() {
218
233
# Install all the common packages.
219
234
function genkit::install_common_packages() {
220
235
genkit::install_prerequisites
221
- genkit::install_go_cli_tools
222
- genkit::install_cargo_cli_tools
223
236
genkit::install_python_cli_tools
224
237
genkit::install_docs_cli_tools
225
238
genkit::install_pnpm_cli_tools
226
239
}
227
240
228
241
# Install all the required tools for CI.
229
242
function genkit::install_ci_packages() {
243
+ export PNPM_HOME=" $HOME /.local/share/pnpm"
230
244
genkit::install_common_packages
245
+ genkit::install_go_cli_tools_ci
231
246
}
232
247
233
248
# Install all the required tools for engineering.
234
249
function genkit::install_eng_packages() {
235
250
genkit::install_common_packages
251
+ genkit::install_go_cli_tools_eng
252
+ genkit::install_cargo_cli_tools_eng
236
253
genkit::install_google_cloud_sdk
237
254
genkit::install_pre_commit_hooks
238
255
genkit::setup_genkit
0 commit comments