Skip to content

Commit

Permalink
feat: Use pnpm and nx for build instead of yarn
Browse files Browse the repository at this point in the history
- switch from `yarn`, `build` command to `pnpm` and `nx`
- Stream build logs
  • Loading branch information
vincenthsh committed May 9, 2024
1 parent dddb501 commit cce72b2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
26 changes: 24 additions & 2 deletions internal/action/action.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package action

import (
"bufio"
"errors"
"fmt"
"io"
Expand Down Expand Up @@ -80,10 +81,31 @@ func (a *action) Contains(filename string) bool {
}

func (a *action) buildPackage() error {
cmd := exec.Command("yarn", "build")
cmd := exec.Command("pnpm", "exec", "nx", "run-many", "--target", "build")
cmd.Dir = a.packageInfo.Path

if err := cmd.Run(); err != nil {
// get relative path
workingDir, err := os.Getwd()
if err != nil {
return err
}
relativePath, err := filepath.Rel(workingDir, a.packageInfo.Path)
if err != nil {
return err
}

// stream stderr/stdin
cmd.Stderr = os.Stderr
stdout, _ := cmd.StdoutPipe()
if err := cmd.Start(); err != nil {
return err
}
scanner := bufio.NewScanner(stdout)
for scanner.Scan() {
fmt.Printf("⚡️%s: %s\n", relativePath, scanner.Text())
}

if err := cmd.Wait(); err != nil {
return err
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/schema/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ type Extension struct {
}

type Branding struct {
Color *string `json:"color"`
Icon *string `json:"icon"`
Color *string `yaml:"color"`
Icon *string `yaml:"icon"`
}

type Input struct {
Expand Down

0 comments on commit cce72b2

Please sign in to comment.