这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions cli/internal/prune/prune.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package prune

import (
"bufio"
"bytes"
"fmt"
"io/ioutil"
"log"
Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion scripts/run-examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -140,4 +142,6 @@ if [[ ! -z $(git status -s | grep -v package.json) ]];then
echo "Detected changes"
git status
exit 1
fi
fi

rm -rf examples/.yarnrc;