diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d5ac763 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.aider* +.env diff --git a/NextChange.md b/NextChange.md new file mode 100644 index 0000000..6fe9689 --- /dev/null +++ b/NextChange.md @@ -0,0 +1 @@ +Fix --run with --watch - it does not watch correctly, and instead just exits. \ No newline at end of file diff --git a/data/mcp-thought-server.sqlite b/data/mcp-thought-server.sqlite new file mode 100644 index 0000000..bd7d975 Binary files /dev/null and b/data/mcp-thought-server.sqlite differ diff --git a/esr b/esr new file mode 100755 index 0000000..9d207a4 Binary files /dev/null and b/esr differ diff --git a/internal/esr/builder.go b/internal/esr/builder.go index 7be343d..c8570e3 100644 --- a/internal/esr/builder.go +++ b/internal/esr/builder.go @@ -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) }