@crossplane-js/libs
v0.0.39
Published
Shared libraries for Crossplane XFuncJS
Readme
Skyhook Libs
This package contains shared libraries for Crossplane Skyhook.
Recent Changes
YAML Parsing in pkg/node/process.go
The code now properly parses the .yarnrc.yml file using the sigs.k8s.io/yaml library instead of string manipulation.
Direct Yarn Execution
We've improved the yarn installation process by directly executing the yarn binary from the path specified in the .yarnrc.yml file. This approach:
- Extracts the
yarnPathfrom the.yarnrc.ymlfile - Constructs the absolute path to the yarn executable
- Executes it directly with Node.js
Implementation Details
The Go code now:
- Parses the
.yarnrc.ymlfile to extract theyarnPathvalue - Falls back to a default path if not found
- Executes the yarn binary directly:
// Extract the yarnPath from the .yarnrc.yml file
var yarnPath string
if yarnConfig != nil {
if path, ok := yarnConfig["yarnPath"].(string); ok {
yarnPath = path
}
}
// If yarnPath is not found, use the default yarn executable
if yarnPath == "" {
yarnPath = ".yarn/releases/yarn-4.7.0.cjs"
}
// Construct the absolute path to the yarn executable
yarnExecPath := filepath.Join("/app", yarnPath)
// Run yarn install using the extracted yarn executable
yarnCmd := exec.Command("node", yarnExecPath, "install")
yarnCmd.Dir = uniqueDirPath // Set the working directoryThis approach ensures that the yarn installation process runs in a separate process and doesn't block the main Node.js process, while also being more robust by using the exact yarn executable specified in the project configuration.
