Skip to content

Commit

Permalink
feat:initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
J0 committed Apr 6, 2024
1 parent 024d247 commit 952d520
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions internal/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ import (
"golang.org/x/term"
)

type Sample struct {
Name string `json:"name"`
Description string `json:"description"`
URL string `json:"url"`
Start string `json:"start"`
}

type SamplesFile struct {
Samples []Sample `json:"samples"`
}

func Run(ctx context.Context, templateUrl string, fsys afero.Fs, options ...func(*pgx.ConnConfig)) error {
workdir := viper.GetString("WORKDIR")
if !filepath.IsAbs(workdir) {
Expand Down Expand Up @@ -137,6 +148,21 @@ func suggestAppStart(cwd string) string {
if len(workdir) > 0 && workdir != "." {
cmd = append(cmd, "cd "+workdir)
}
fileBytes, err := ioutil.ReadFile("samples.json")

Check failure on line 151 in internal/bootstrap/bootstrap.go

View workflow job for this annotation

GitHub Actions / Lint

undefined: ioutil

Check failure on line 151 in internal/bootstrap/bootstrap.go

View workflow job for this annotation

GitHub Actions / Lint

undefined: ioutil

Check failure on line 151 in internal/bootstrap/bootstrap.go

View workflow job for this annotation

GitHub Actions / Start

undefined: ioutil

Check failure on line 151 in internal/bootstrap/bootstrap.go

View workflow job for this annotation

GitHub Actions / Test

undefined: ioutil

Check failure on line 151 in internal/bootstrap/bootstrap.go

View workflow job for this annotation

GitHub Actions / Test

undefined: ioutil

Check failure on line 151 in internal/bootstrap/bootstrap.go

View workflow job for this annotation

GitHub Actions / Test

undefined: ioutil

Check failure on line 151 in internal/bootstrap/bootstrap.go

View workflow job for this annotation

GitHub Actions / Test

undefined: ioutil
if err != nil {
log.Fatalf("failed to read file: %v", err)

Check failure on line 153 in internal/bootstrap/bootstrap.go

View workflow job for this annotation

GitHub Actions / Lint

undefined: log

Check failure on line 153 in internal/bootstrap/bootstrap.go

View workflow job for this annotation

GitHub Actions / Lint

undefined: log

Check failure on line 153 in internal/bootstrap/bootstrap.go

View workflow job for this annotation

GitHub Actions / Start

undefined: log

Check failure on line 153 in internal/bootstrap/bootstrap.go

View workflow job for this annotation

GitHub Actions / Test

undefined: log

Check failure on line 153 in internal/bootstrap/bootstrap.go

View workflow job for this annotation

GitHub Actions / Test

undefined: log

Check failure on line 153 in internal/bootstrap/bootstrap.go

View workflow job for this annotation

GitHub Actions / Test

undefined: log
}

var samples SamplesFile
err = json.Unmarshal(fileBytes, &samples)
if err != nil {
log.Fatalf("failed to unmarshal JSON: %v", err)

Check failure on line 159 in internal/bootstrap/bootstrap.go

View workflow job for this annotation

GitHub Actions / Lint

undefined: log) (typecheck)

Check failure on line 159 in internal/bootstrap/bootstrap.go

View workflow job for this annotation

GitHub Actions / Lint

undefined: log (typecheck)

Check failure on line 159 in internal/bootstrap/bootstrap.go

View workflow job for this annotation

GitHub Actions / Start

undefined: log

Check failure on line 159 in internal/bootstrap/bootstrap.go

View workflow job for this annotation

GitHub Actions / Test

undefined: log

Check failure on line 159 in internal/bootstrap/bootstrap.go

View workflow job for this annotation

GitHub Actions / Test

undefined: log

Check failure on line 159 in internal/bootstrap/bootstrap.go

View workflow job for this annotation

GitHub Actions / Test

undefined: log
}

for _, sample := range samples.Samples {
fmt.Printf("To start your app run:", sample.Start)
}
// TODO: refactor this part properly
cmd = append(cmd, "npm ci", "npm run dev")
suggestion := "To start your app:"
for _, c := range cmd {
Expand Down

0 comments on commit 952d520

Please sign in to comment.