adhocteam / pushup

Pushup is for making modern, page-oriented web apps in Go
https://pushup.adhoc.dev
MIT License
844 stars 30 forks source link

The -codegen-only flag does not generate cmd code. #131

Open dvogel opened 7 hours ago

dvogel commented 7 hours ago

When using the pushup build -codegen-only flag the _runtime/cmd/main.go templating is not performed. So you get different results from:

pushup build

versus

pushup build -codegen-only
cd build
go build

An example:

$ pushup new thing1
$ cd thing1
$ pushup build

        //                                                                  
     //  //      //////                        //                           
                //    //  //    //    //////  //////    //    //  //////    
               //////    //    //  ////      //    //  //    //  //    //   
              //        //    //      ////  //    //  //    //  //    //    
             //          //////  //////    //    //    //////  //////       
                                                              //            
                                                             //             
$ tree build
build
├── app.go
├── bin
│   └── myproject
├── cmd
│   └── myproject
│       └── main.go
├── default.layout.up.go
├── index.up.go
├── pushup_support.go
├── src
│   └── pages
│       └── index.up
└── static
    ├── htmx.min.js
    └── style.css
$ rm -rf build
$ pushup build -codegen-only

        //                                                                  
     //  //      //////                        //                           
                //    //  //    //    //////  //////    //    //  //////    
               //////    //    //  ////      //    //  //    //  //    //   
              //        //    //      ////  //    //  //    //  //    //    
             //          //////  //////    //    //    //////  //////       
                                                              //            
                                                             //             
$ (cd build && go build)
$ tree build
build
├── app.go
├── default.layout.up.go
├── index.up.go
├── pushup_support.go
├── src
│   └── pages
│       └── index.up
└── static
    ├── htmx.min.js
    └── style.css
paulsmith commented 6 hours ago

Good catch - the runtime main I consider not codegen per se (as in lowering Pushup markup to Go code) and more a "linking" step but that's confusing. Ultimately I want that stuff to be part of an API library that only requires the thinnest main.go wrapper.