Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
RaulCatalinas committed Nov 27, 2024
2 parents 84cdbf5 + b3c98d6 commit 3bf4f5f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
12 changes: 7 additions & 5 deletions internal/constants/package_managers.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package constants

var PACKAGE_MANAGERS = []string{
"npm",
"yarn",
"pnpm",
"bun",
import "github.com/RaulCatalinas/HuskyBC/internal/enums"

var PACKAGE_MANAGERS = []enums.PackageManager{
enums.PackageManagerNpm,
enums.PackageManagerYarn,
enums.PackageManagerPnpm,
enums.PackageManagerBun,
}
3 changes: 1 addition & 2 deletions internal/user-input/package-managers.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"fmt"
"os"

"github.com/RaulCatalinas/HuskyBC/internal/constants"
"github.com/RaulCatalinas/HuskyBC/internal/enums"
"github.com/RaulCatalinas/HuskyBC/internal/utils"

Expand All @@ -16,7 +15,7 @@ func GetPackageManager() enums.PackageManager {
{
Name: "packageManger",
Prompt: &survey.Select{
Options: constants.PACKAGE_MANAGERS,
Options: utils.GetPackageManagersAsStrings(),
Message: "Which package manager do you wanna use?",
Default: "npm", // <- If we use the enum here the library gives an error.
},
Expand Down
13 changes: 13 additions & 0 deletions internal/utils/packege_managers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package utils

import "github.com/RaulCatalinas/HuskyBC/internal/constants"

func GetPackageManagersAsStrings() []string {
packageManagesAsStrings := make([]string, len(constants.PACKAGE_MANAGERS))

for i, manager := range constants.PACKAGE_MANAGERS {
packageManagesAsStrings[i] = string(manager)
}

return packageManagesAsStrings
}

0 comments on commit 3bf4f5f

Please sign in to comment.