func FindXpkgInDir(fs afero.Fs, root string) (string, error) {
	f, err := fs.Open(root)
	if err != nil {
		return "", err
	}
	defer func() { _ = f.Close() }()
	files, err := f.Readdir(-1)
	if err != nil {
		return "", err
	}
	path := ""
	for _, file := range files {
		match, _ := filepath.Match(XpkgMatchPattern, file.Name())  
		if !match {
			continue
		}
		if path != "" && match {
			return "", errors.New(errMultiMatch)
		}
		path = file.Name()
	}
	if path == "" {
		return "", errors.New(errNoMatch)
	}
	return path, nil
}
FindXpkgInDir finds compiled Crossplane packages in a directory.
package xpkg
import (
	"path/filepath"
	"github.com/pkg/errors"
	"github.com/spf13/afero"
)
const (
	errNoMatch    = "directory does not contain a compiled crossplane package"
	errMultiMatch = "directory contains multiple compiled crossplane packages"
)