Skip to content

Commit

Permalink
feat: add nodejs devtools to Nix (#2099)
Browse files Browse the repository at this point in the history
## Description:
Manage nodeJS devtools with Nix

## Is this change user facing?
NO
  • Loading branch information
lostbean authored Jan 31, 2024
1 parent db2eaac commit 7bbb2bc
Show file tree
Hide file tree
Showing 37 changed files with 1,520 additions and 295 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/golang/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
github.com/kurtosis-tech/kurtosis/cloud/api/golang v0.0.0-20230803130419-099ee7a4e3dc
github.com/kurtosis-tech/kurtosis/contexts-config-store v0.0.0-20230818184218-f4e3e773463b
github.com/kurtosis-tech/kurtosis/grpc-file-transfer/golang v0.0.0-20230803130419-099ee7a4e3dc
github.com/kurtosis-tech/kurtosis/utils v0.0.0-20240104153602-385833de9d76 // this version needs to be fixed for outside people to import api/golang
github.com/kurtosis-tech/kurtosis/utils v0.0.0-20240104153602-385833de9d76 // this version needs to be fixed for outside people to import api/golang
github.com/kurtosis-tech/stacktrace v0.0.0-20211028211901-1c67a77b5409
github.com/labstack/echo/v4 v4.11.3
github.com/oapi-codegen/runtime v1.1.0
Expand Down
24 changes: 22 additions & 2 deletions api/scripts/protobuf-bindings-generator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ GO_MOD_FILE_MODULE_KEYWORD="module" # Keyword in the go.mod file for specifying
# ----------------------------------------- Typescript -----------------------------------------------
NODE_GRPC_TOOLS_PROTOC_BIN_FILENAME="grpc_tools_node_protoc" # For some reason, Node gRPC has its own 'protoc' binary
NODE_GRPC_TOOLS_PROTOC_PLUGIN_BIN_FILENAME="grpc_tools_node_protoc_plugin" # The name of the plugin binary that will be used by 'protoc'
NODE_ES_TOOLS_PROTOC_BIN_FILENAME="protoc-gen-es"
NODE_CONNECT_ES_TOOLS_PROTOC_BIN_FILENAME="protoc-gen-connect-es"
NODE_GRPC_TOOLS_INSTALL_COMMAND="npm install -g grpc-tools"
WEB_GRPC_PROTOC_BIN_FILENAME="protoc-gen-grpc-web"
WEB_GRPC_INSTALL_COMMAND="brew install protoc-gen-grpc-web"
Expand Down Expand Up @@ -222,6 +224,24 @@ generate_typescript_bindings() {
echo "Error: Got an empty filepath when looking for the Node gRPC tools protoc plugin binary '${NODE_GRPC_TOOLS_PROTOC_PLUGIN_BIN_FILENAME}'; have you installed the tools with '${NODE_GRPC_TOOLS_PROTOC_PLUGIN_BIN_FILENAME}'?" >&2
return 1
fi

if ! node_es_protoc_bin_filepath="$(which "${NODE_ES_TOOLS_PROTOC_BIN_FILENAME}")"; then
echo "Error: Couldn't find Node gRPC tools protoc plugin binary '${NODE_ES_TOOLS_PROTOC_BIN_FILENAME}' on the PATH" >&2
return 1
fi
if [ -z "${node_es_protoc_bin_filepath}" ]; then
echo "Error: Got an empty filepath when looking for the Node gRPC tools protoc plugin binary '${NODE_ES_TOOLS_PROTOC_BIN_FILENAME}'" >&2
return 1
fi

if ! node_connect_es_protoc_bin_filepath="$(which "${NODE_CONNECT_ES_TOOLS_PROTOC_BIN_FILENAME}")"; then
echo "Error: Couldn't find Node gRPC tools protoc plugin binary '${NODE_CONNECT_ES_TOOLS_PROTOC_BIN_FILENAME}' on the PATH" >&2
return 1
fi
if [ -z "${node_connect_es_protoc_bin_filepath}" ]; then
echo "Error: Got an empty filepath when looking for the Node gRPC tools protoc plugin binary '${NODE_CONNECT_ES_TOOLS_PROTOC_BIN_FILENAME}'" >&2
return 1
fi

for input_filepath in $(find "${input_abs_dirpath}" -type f -name "*${PROTOBUF_FILE_EXT}"); do
# NOTE: Generating Node bindings
Expand Down Expand Up @@ -249,10 +269,10 @@ generate_typescript_bindings() {

if ! "${node_protoc_bin_filepath}" \
-I="${input_abs_dirpath}" \
"--plugin=protoc-gen-es=${api_dir_path}/typescript/node_modules/.bin/protoc-gen-es" \
"--plugin=protoc-gen-es=${node_es_protoc_bin_filepath}" \
"--es_out=${output_abs_dirpath}/connect" \
"--es_opt=target=js+dts" \
"--plugin=protoc-gen-connect-es=${api_dir_path}/typescript/node_modules/.bin/protoc-gen-connect-es" \
"--plugin=protoc-gen-connect-es=${node_connect_es_protoc_bin_filepath}" \
"--connect-es_out=${output_abs_dirpath}/connect" \
"--connect-es_opt=target=js+dts" \
"${input_filepath}"; then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as grpcWeb from 'grpc-web';

import * as api_container_service_pb from './api_container_service_pb';
import * as google_protobuf_empty_pb from 'google-protobuf/google/protobuf/empty_pb';
import * as api_container_service_pb from './api_container_service_pb'; // proto import: "api_container_service.proto"
import * as google_protobuf_empty_pb from 'google-protobuf/google/protobuf/empty_pb'; // proto import: "google/protobuf/empty.proto"


export class ApiContainerServiceClient {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

// Code generated by protoc-gen-grpc-web. DO NOT EDIT.
// versions:
// protoc-gen-grpc-web v1.4.2
// protoc-gen-grpc-web v1.5.0
// protoc v3.19.1
// source: api_container_service.proto

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as jspb from 'google-protobuf'

import * as google_protobuf_empty_pb from 'google-protobuf/google/protobuf/empty_pb';
import * as google_protobuf_empty_pb from 'google-protobuf/google/protobuf/empty_pb'; // proto import: "google/protobuf/empty.proto"


export class Port extends jspb.Message {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @generated by protoc-gen-connect-es v0.12.0 with parameter "target=js+dts"
// @generated by protoc-gen-connect-es v0.13.2 with parameter "target=js+dts"
// @generated from file api_container_service.proto (package api_container_api, syntax proto3)
/* eslint-disable */
// @ts-nocheck
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @generated by protoc-gen-connect-es v0.12.0 with parameter "target=js+dts"
// @generated by protoc-gen-connect-es v0.13.2 with parameter "target=js+dts"
// @generated from file api_container_service.proto (package api_container_api, syntax proto3)
/* eslint-disable */
// @ts-nocheck
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @generated by protoc-gen-es v1.3.0 with parameter "target=js+dts"
// @generated by protoc-gen-es v1.5.1 with parameter "target=js+dts"
// @generated from file api_container_service.proto (package api_container_api, syntax proto3)
/* eslint-disable */
// @ts-nocheck
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @generated by protoc-gen-es v1.3.0 with parameter "target=js+dts"
// @generated by protoc-gen-es v1.5.1 with parameter "target=js+dts"
// @generated from file api_container_service.proto (package api_container_api, syntax proto3)
/* eslint-disable */
// @ts-nocheck
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @generated by protoc-gen-connect-es v0.12.0 with parameter "target=js+dts"
// @generated by protoc-gen-connect-es v0.13.2 with parameter "target=js+dts"
// @generated from file engine_service.proto (package engine_api, syntax proto3)
/* eslint-disable */
// @ts-nocheck
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @generated by protoc-gen-connect-es v0.12.0 with parameter "target=js+dts"
// @generated by protoc-gen-connect-es v0.13.2 with parameter "target=js+dts"
// @generated from file engine_service.proto (package engine_api, syntax proto3)
/* eslint-disable */
// @ts-nocheck
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @generated by protoc-gen-es v1.3.0 with parameter "target=js+dts"
// @generated by protoc-gen-es v1.5.1 with parameter "target=js+dts"
// @generated from file engine_service.proto (package engine_api, syntax proto3)
/* eslint-disable */
// @ts-nocheck
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @generated by protoc-gen-es v1.3.0 with parameter "target=js+dts"
// @generated by protoc-gen-es v1.5.1 with parameter "target=js+dts"
// @generated from file engine_service.proto (package engine_api, syntax proto3)
/* eslint-disable */
// @ts-nocheck
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as grpcWeb from 'grpc-web';

import * as engine_service_pb from './engine_service_pb';
import * as google_protobuf_empty_pb from 'google-protobuf/google/protobuf/empty_pb';
import * as engine_service_pb from './engine_service_pb'; // proto import: "engine_service.proto"
import * as google_protobuf_empty_pb from 'google-protobuf/google/protobuf/empty_pb'; // proto import: "google/protobuf/empty.proto"


export class EngineServiceClient {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

// Code generated by protoc-gen-grpc-web. DO NOT EDIT.
// versions:
// protoc-gen-grpc-web v1.4.2
// protoc-gen-grpc-web v1.5.0
// protoc v3.19.1
// source: engine_service.proto

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as jspb from 'google-protobuf'

import * as google_protobuf_empty_pb from 'google-protobuf/google/protobuf/empty_pb';
import * as google_protobuf_timestamp_pb from 'google-protobuf/google/protobuf/timestamp_pb';
import * as google_protobuf_empty_pb from 'google-protobuf/google/protobuf/empty_pb'; // proto import: "google/protobuf/empty.proto"
import * as google_protobuf_timestamp_pb from 'google-protobuf/google/protobuf/timestamp_pb'; // proto import: "google/protobuf/timestamp.proto"


export class GetEngineInfoResponse extends jspb.Message {
Expand Down
2 changes: 1 addition & 1 deletion core/server/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ require (
go.starlark.net v0.0.0-20230224151120-c52844e64a10
golang.org/x/exp v0.0.0-20230905200255-921286631fa9
golang.org/x/sync v0.3.0
k8s.io/api v0.27.2
)

require (
Expand Down Expand Up @@ -149,7 +150,6 @@ require (
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/api v0.27.2 // indirect
k8s.io/apimachinery v0.27.2 // indirect
k8s.io/client-go v0.27.2 // indirect
k8s.io/klog/v2 v2.90.1 // indirect
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 23 additions & 2 deletions enclave-manager/api/scripts/regenerate-proto-bindings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,31 @@ api_go_mod_rel_file="golang/go.mod"
# Typescript
api_typescript_rel_dir="typescript"

NODE_ES_TOOLS_PROTOC_BIN_FILENAME="protoc-gen-es"

NODE_CONNECT_ES_TOOLS_PROTOC_BIN_FILENAME="protoc-gen-connect-es"

# ==================================================================================================
# Main Logic
# ==================================================================================================

if ! node_es_protoc_bin_filepath="$(which "${NODE_ES_TOOLS_PROTOC_BIN_FILENAME}")"; then
echo "Error: Couldn't find Node gRPC tools protoc plugin binary '${NODE_ES_TOOLS_PROTOC_BIN_FILENAME}' on the PATH" >&2
return 1
fi
if [ -z "${node_es_protoc_bin_filepath}" ]; then
echo "Error: Got an empty filepath when looking for the Node gRPC tools protoc plugin binary '${NODE_ES_TOOLS_PROTOC_BIN_FILENAME}'" >&2
return 1
fi

if ! node_connect_es_protoc_bin_filepath="$(which "${NODE_CONNECT_ES_TOOLS_PROTOC_BIN_FILENAME}")"; then
echo "Error: Couldn't find Node gRPC tools protoc plugin binary '${NODE_CONNECT_ES_TOOLS_PROTOC_BIN_FILENAME}' on the PATH" >&2
return 1
fi
if [ -z "${node_connect_es_protoc_bin_filepath}" ]; then
echo "Error: Got an empty filepath when looking for the Node gRPC tools protoc plugin binary '${NODE_CONNECT_ES_TOOLS_PROTOC_BIN_FILENAME}'" >&2
return 1
fi
# Dependencies from other modules
api_golang_engine="${repo_root_dirpath}/api/protobuf/engine"
api_golang_core="${repo_root_dirpath}/api/protobuf/core"
Expand All @@ -47,10 +68,10 @@ protoc \
--go-grpc_opt=require_unimplemented_servers=false \
--connect-go_out="${api_golang_proto_generated_abs_dir}" \
--connect-go_opt=module="${api_golang_module}" \
--plugin=protoc-gen-es="${api_typescript_abs_dir}/node_modules/.bin/protoc-gen-es" \
--plugin=protoc-gen-es="${node_es_protoc_bin_filepath}" \
--es_out="${api_typescript_abs_dir}/src/" \
--es_opt=target=ts \
--plugin=protoc-gen-connect-es="${api_typescript_abs_dir}/node_modules/.bin/protoc-gen-connect-es" \
--plugin=protoc-gen-connect-es="${node_connect_es_protoc_bin_filepath}" \
--connect-es_out="${api_typescript_abs_dir}/src/" \
--connect-es_opt=target=ts \
"${api_proto_abs_dir}"/*.proto
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @generated by protoc-gen-es v1.3.3 with parameter "target=ts"
// @generated by protoc-gen-es v1.5.1 with parameter "target=ts"
// @generated from file kurtosis_enclave_manager_api.proto (package kurtosis_enclave_manager, syntax proto3)
/* eslint-disable */
// @ts-nocheck
Expand Down
20 changes: 10 additions & 10 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7bbb2bc

Please sign in to comment.