From a7b681a8f23b3ff64548cc2281bcd58856610cf0 Mon Sep 17 00:00:00 2001 From: andres Date: Mon, 11 Dec 2023 13:18:48 +0100 Subject: [PATCH] add currentDir to pnpm execution --- main.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index ad87f32..46d2c50 100644 --- a/main.go +++ b/main.go @@ -106,8 +106,8 @@ export const Default: Story = { } // Execute formatting and linting commands - runCommand("pnpm", "run", "format:file", dirPath) - runCommand("pnpm", "run", "lint:file", dirPath+"/**") + runCommand(currentDir, "pnpm", "run", "format:file", dirPath) + runCommand(currentDir, "pnpm", "run", "lint:file", dirPath+"/**") return nil } @@ -149,8 +149,9 @@ func updateMainIndex(name, currentDir string) error { return nil } -func runCommand(command string, args ...string) { +func runCommand(currentDir, command string, args ...string) { cmd := exec.Command(command, args...) + cmd.Dir = currentDir // Set the working directory output, err := cmd.CombinedOutput() if err != nil { fmt.Println("Error executing command:", err)