Skip to content

Commit 8811095

Browse files
authored
fix: only show building websites message when required (#858)
fix: only show building websites when required
1 parent c4fc83c commit 8811095

File tree

2 files changed

+24
-20
lines changed

2 files changed

+24
-20
lines changed

cmd/run.go

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,18 +152,20 @@ var runCmd = &cobra.Command{
152152
websiteBuildUpdates, err := proj.BuildWebsites(loadEnv)
153153
tui.CheckErr(err)
154154

155-
if isNonInteractive() {
156-
fmt.Println("building project websites")
157-
for update := range websiteBuildUpdates {
158-
for _, line := range strings.Split(strings.TrimSuffix(update.Message, "\n"), "\n") {
159-
fmt.Printf("%s [%s]: %s\n", update.ServiceName, update.Status, line)
155+
if len(proj.GetWebsites()) > 0 {
156+
if isNonInteractive() {
157+
fmt.Println("building project websites")
158+
for update := range websiteBuildUpdates {
159+
for _, line := range strings.Split(strings.TrimSuffix(update.Message, "\n"), "\n") {
160+
fmt.Printf("%s [%s]: %s\n", update.ServiceName, update.Status, line)
161+
}
160162
}
163+
} else {
164+
prog := teax.NewProgram(build.NewModel(websiteBuildUpdates, "Building Websites"))
165+
// blocks but quits once the above updates channel is closed by the build process
166+
_, err = prog.Run()
167+
tui.CheckErr(err)
161168
}
162-
} else {
163-
prog := teax.NewProgram(build.NewModel(websiteBuildUpdates, "Building Websites"))
164-
// blocks but quits once the above updates channel is closed by the build process
165-
_, err = prog.Run()
166-
tui.CheckErr(err)
167169
}
168170

169171
// Run the app code (project services)

cmd/stack.go

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -280,18 +280,20 @@ var stackUpdateCmd = &cobra.Command{
280280
websiteBuildUpdates, err := proj.BuildWebsites(envVariables)
281281
tui.CheckErr(err)
282282

283-
if isNonInteractive() {
284-
fmt.Println("building project websites")
285-
for update := range websiteBuildUpdates {
286-
for _, line := range strings.Split(strings.TrimSuffix(update.Message, "\n"), "\n") {
287-
fmt.Printf("%s [%s]: %s\n", update.ServiceName, update.Status, line)
283+
if len(proj.GetWebsites()) > 0 {
284+
if isNonInteractive() {
285+
fmt.Println("building project websites")
286+
for update := range websiteBuildUpdates {
287+
for _, line := range strings.Split(strings.TrimSuffix(update.Message, "\n"), "\n") {
288+
fmt.Printf("%s [%s]: %s\n", update.ServiceName, update.Status, line)
289+
}
288290
}
291+
} else {
292+
prog := teax.NewProgram(build.NewModel(websiteBuildUpdates, "Building Websites"))
293+
// blocks but quits once the above updates channel is closed by the build process
294+
_, err = prog.Run()
295+
tui.CheckErr(err)
289296
}
290-
} else {
291-
prog := teax.NewProgram(build.NewModel(websiteBuildUpdates, "Building Websites"))
292-
// blocks but quits once the above updates channel is closed by the build process
293-
_, err = prog.Run()
294-
tui.CheckErr(err)
295297
}
296298

297299
providerStdout := make(chan string)

0 commit comments

Comments
 (0)