Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions cmd/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,27 +107,36 @@ Examples:
errsystem.New(errsystem.ErrInvalidConfiguration, err, errsystem.WithContextMessage("Failed to run project")).ShowErrorAndExit()
}

build := func() {
build := func(initial bool) {
started := time.Now()
var ok bool
tui.ShowSpinner("Building project ...", func() {
if err := bundler.Bundle(bundler.BundleContext{
Context: ctx,
Logger: log,
ProjectDir: dir,
Production: false,
DevMode: !initial,
}); err != nil {
if err == bundler.ErrBuildFailed {
log.Error("build failed ...")
return
}
errsystem.New(errsystem.ErrInvalidConfiguration, err, errsystem.WithContextMessage(fmt.Sprintf("Failed to bundle project: %s", err))).ShowErrorAndExit()
}
ok = true
})
fmt.Println(tui.Text(fmt.Sprintf("✨ Built in %s", time.Since(started).Round(time.Millisecond))))
if ok {
fmt.Println(tui.Text(fmt.Sprintf("✨ Built in %s", time.Since(started).Round(time.Millisecond))))
}
}

// Initial build
build()
build(true)

// Watch for changes
watcher, err := dev.NewWatcher(log, dir, theproject.Project.Development.Watch.Files, func(path string) {
build()
build(false)
isDeliberateRestart = true
log.Debug("killing project server")
dev.KillProjectServer(projectServerCmd)
Expand Down
7 changes: 7 additions & 0 deletions internal/bundler/bundler.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import (

var Version = "dev"

var ErrBuildFailed = fmt.Errorf("build failed")

type AgentConfig struct {
ID string `json:"id"`
Name string `json:"name"`
Expand All @@ -35,6 +37,7 @@ type BundleContext struct {
Production bool
Install bool
CI bool
DevMode bool
}

func bundleJavascript(ctx BundleContext, dir string, outdir string, theproject *project.Project) error {
Expand Down Expand Up @@ -157,6 +160,10 @@ func bundleJavascript(ctx BundleContext, dir string, outdir string, theproject *
fmt.Println(formattedError)
}

if ctx.DevMode {
return ErrBuildFailed
}

os.Exit(2)
return nil // This line will never be reached due to os.Exit
}
Expand Down
Loading