pre-copilot

This commit is contained in:
nvms 2025-04-08 19:19:36 -04:00
parent d35e137872
commit 4041957a01
5 changed files with 14 additions and 4 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.aider*
.env

1
NextChange.md Normal file
View File

@ -0,0 +1 @@
Fix --run with --watch - it does not watch correctly, and instead just exits.

Binary file not shown.

BIN
esr Executable file

Binary file not shown.

View File

@ -40,23 +40,30 @@ func (b *Builder) Build(buildOptions *api.BuildOptions) error {
return fmt.Errorf("esr :: failed to create directory: %v", err)
}
}
if err := os.WriteFile(file.Path, file.Contents, os.ModePerm); err != nil {
return fmt.Errorf("esr :: failed to write file: %v", err)
}
// fmt.Printf("esr :: wrote: %s\n", filepath.Join(b.Config.Outdir, filepath.Base(file.Path)))
fmt.Printf("esr :: wrote: %s\n", filepath.Join(filepath.Dir(file.Path), filepath.Base(file.Path)))
// fmt.Printf("esr :: wrote: %s\n", file.Path)
if filepath.Ext(file.Path) == ".js" {
b.BuiltJS = append(b.BuiltJS, file.Path)
}
if filepath.Ext(file.Path) == ".css" {
b.BuiltCSS = append(b.BuiltCSS, file.Path)
}
} else {
dir := filepath.Dir(file.Path)
if _, err := os.Stat(dir); os.IsNotExist(err) {
if err := os.MkdirAll(dir, os.ModePerm); err != nil {
return fmt.Errorf("esr :: failed to create directory: %v", err)
}
}
if err := os.WriteFile(file.Path, file.Contents, os.ModePerm); err != nil {
return fmt.Errorf("esr :: failed to write file: %v", err)
}