Skip to content

Commit

Permalink
fix: improve frontend detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Pehesi97 committed Oct 23, 2023
1 parent 060b600 commit 4077dd8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/services/project/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"io/fs"
"os"
"path"
"strings"
"text/template"

"github.com/nearform/initium-cli/src/services/git"
Expand Down Expand Up @@ -77,7 +78,12 @@ func DetectType(directory string) (ProjectType, error) {
var detectedRuntimes []ProjectType
var projectType ProjectType
if _, err := os.Stat(path.Join(directory, "package.json")); err == nil {
if _, err := os.Stat(path.Join(directory, "dist")); err == nil {
bytes, err := os.ReadFile(path.Join(directory, "package.json"))
if err != nil {
fmt.Print(err)
}
fileStr := string(bytes)
if strings.Contains(fileStr, "react") || strings.Contains(fileStr, "angular") || strings.Contains(fileStr, "vue") {
detectedRuntimes = append(detectedRuntimes, FrontendJsProject)
projectType = FrontendJsProject
} else {
Expand Down

0 comments on commit 4077dd8

Please sign in to comment.