github.com/tilt-dev/tilt@v0.36.0/scripts/codegen-webview.sh (about)

     1  #!/bin/bash
     2  
     3  set -euo pipefail
     4  
     5  cd $(dirname "$0")/..
     6  
     7  # Create a temporary directory for outputs
     8  TEMP_DIR=$(mktemp -d)
     9  
    10  trap "rm -rf $TEMP_DIR" EXIT
    11  
    12  rm -f \
    13     web/src/view.d.ts \
    14     pkg/webview/log.pb.go \
    15     pkg/webview/view.pb.go \
    16     pkg/webview/view_grpc.pb.go \
    17     pkg/webview/view.swagger.json
    18  
    19  # Build the webview-proto stage and extract outputs
    20  
    21  docker buildx build -f ./scripts/codegen-webview.Dockerfile --target=webview-proto-output --output=type=local,dest=$TEMP_DIR .
    22  
    23  # Copy the generated files back to their original locations
    24  
    25  cp $TEMP_DIR/go/src/github.com/tilt-dev/tilt/pkg/webview/log.pb.go pkg/webview/
    26  
    27  cp $TEMP_DIR/go/src/github.com/tilt-dev/tilt/pkg/webview/view.pb.go pkg/webview/
    28  
    29  cp $TEMP_DIR/go/src/github.com/tilt-dev/tilt/pkg/webview/view_grpc.pb.go pkg/webview/
    30  
    31  cp $TEMP_DIR/go/src/github.com/tilt-dev/tilt/pkg/webview/view.swagger.json pkg/webview/
    32  
    33  # Build the proto-ts stage and extract outputs
    34  
    35  docker buildx build -f ./scripts/codegen-webview.Dockerfile --target=proto-ts-output --output=type=local,dest=$TEMP_DIR .
    36  
    37  # Copy the generated TypeScript definitions back
    38  
    39  cp $TEMP_DIR/go/src/github.com/tilt-dev/tilt/web/src/view.d.ts web/src/