Skip to content

Commit

Permalink
fix: use os home dir
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip Germanov committed Oct 15, 2024
1 parent 970f340 commit 803f18d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/npmExecuteTests.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ func runNpmExecuteTests(config *npmExecuteTestsOptions, c command.ExecRunner) er
c.SetEnv([]string{path})
}

if err := c.RunExecutable("npm", "config", "set", "cache", "~/.npm-cache", "--global"); err != nil {
homeDir, err := os.UserHomeDir()
if err != nil {
return fmt.Errorf("failed to get user home directory: %w", err)
}
npmCacheDir := fmt.Sprintf("%s/.npm-cache", homeDir)
if err := c.RunExecutable("npm", "config", "set", "cache", npmCacheDir, "--global"); err != nil {
return fmt.Errorf("failed to set npm cache directory: %w", err)
}

Expand Down

0 comments on commit 803f18d

Please sign in to comment.