-
Notifications
You must be signed in to change notification settings - Fork 1
/
prettier.go
42 lines (27 loc) · 762 Bytes
/
prettier.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package commands
import (
"errors"
"fmt"
"internal/types"
"internal/utils"
"os"
)
func handlePrettyAll() error {
return nil
}
func HandlePrettierCommand(allFlag bool) error {
if allFlag {
return handlePrettyAll()
}
if _, err := os.Stat(types.PRETTY_QUICK_PATH); errors.Is(err, os.ErrNotExist) {
if _, err := os.Stat(types.PRETTY_BACKUP_QUICK_PATH); errors.Is(err, os.ErrNotExist) {
return fmt.Errorf("cannot use prettier without installing tsdev as a dependency")
}
cwd, err := os.Getwd()
utils.CheckErr(err)
return utils.ExecWithOutput(cwd, "node", types.PRETTY_BACKUP_QUICK_PATH, "--staged")
}
cwd, err := os.Getwd()
utils.CheckErr(err)
return utils.ExecWithOutput(cwd, "node", types.PRETTY_QUICK_PATH, "--staged")
}