diff --git a/cli/internal/prune/prune.go b/cli/internal/prune/prune.go index 8f2db0646545f..7abb7d93a78af 100644 --- a/cli/internal/prune/prune.go +++ b/cli/internal/prune/prune.go @@ -2,6 +2,7 @@ package prune import ( "bufio" + "bytes" "fmt" "io/ioutil" "log" @@ -234,12 +235,16 @@ func (c *PruneCommand) Run(args []string) int { } } - next, err := yaml.Marshal(lockfile) + var b bytes.Buffer + yamlEncoder := yaml.NewEncoder(&b) + yamlEncoder.SetIndent(2) // this is what you're looking for + yamlEncoder.Encode(lockfile) + if err != nil { c.logError(c.Config.Logger, "", fmt.Errorf("failed to materialize sub-lockfile. This can happen if your lockfile contains merge conflicts or is somehow corrupted. Please report this if it occurs: %w", err)) return 1 } - err = ioutil.WriteFile(filepath.Join(pruneOptions.cwd, "out", "yarn.lock"), next, fs.DirPermissions) + err = ioutil.WriteFile(filepath.Join(pruneOptions.cwd, "out", "yarn.lock"), b.Bytes(), fs.DirPermissions) if err != nil { c.logError(c.Config.Logger, "", fmt.Errorf("failed to write sub-lockfile: %w", err)) return 1 diff --git a/scripts/run-examples.sh b/scripts/run-examples.sh index 6615da14ddcd3..0d8474e4ee1e4 100755 --- a/scripts/run-examples.sh +++ b/scripts/run-examples.sh @@ -13,6 +13,8 @@ if [ -f ".eslintrc.js" ]; then mv .eslintrc.js .eslintrc.js.bak fi +echo "'env:\n\tTURBO_BINARY_PATH: $TURBO_BINARY_PATH'" > examples/.yarnrc; + function cleanup { rm -rf node_modules rm -rf apps/*/node_modules @@ -140,4 +142,6 @@ if [[ ! -z $(git status -s | grep -v package.json) ]];then echo "Detected changes" git status exit 1 -fi \ No newline at end of file +fi + +rm -rf examples/.yarnrc; \ No newline at end of file