You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: lerna.go
    path of file: ./repos/grafana/pkg/build/lerna
    
    the code of the file until where you have to start completion: package lerna

import (
	"context"
	"encoding/json"
	"fmt"
	"os"
	"os/exec"
	"path/filepath"
	"strings"

	"github.com/grafana/grafana/pkg/build/config"
	"github.com/grafana/grafana/pkg/build/fsutil"
)

// BuildFrontendPackages will bump the version for the package to the latest canary build
// and build the packages so they are ready for being published, used for generating docs etc.
func BuildFrontendPackages(version string, mode config.Edition, grafanaDir string) 
    
func GetLernaVersion(grafanaDir string) (string, error) {
	lernaJSONPath := filepath.Join(grafanaDir, "lerna.json")
	//nolint:gosec
	lernaJSONB, err := os.ReadFile(lernaJSONPath)
	if err != nil {
		return "", fmt.Errorf("failed to read %q: %w", lernaJSONPath, err)
	}
	pkgObj := map[string]any{}
	if err := json.Unmarshal(lernaJSONB, &pkgObj); err != nil {
		return "", fmt.Errorf("failed decoding %q: %w", lernaJSONPath, err)
	}

	version := pkgObj["version"].(string)
	if version == "" {
		return "", fmt.Errorf("failed to read version from %q", lernaJSONPath)
	}
	return strings.TrimSpace(version), nil
}