dart-archive / stagehand

Dart project generator - web apps, console apps, servers, and more.
https://pub.dev/packages/stagehand
BSD 3-Clause "New" or "Revised" License
648 stars 118 forks source link

Code Generator Project Scaffold #670

Closed TimWhiting closed 4 years ago

TimWhiting commented 4 years ago

A great project scaffold to have would be a code generator project:

sarahec commented 4 years ago

I have a project that's ready to convert into a template, but want to check in with the core team here (e.g. @devoncarew) if a codegen template fits in the spirit of the project. If so, I'll hand you a PR.

devoncarew commented 4 years ago

Hmm, I'll hand that question off to @kevmoo @kwalrath (and @mit-mit).

kevmoo commented 4 years ago

Codegen is pretty advanced. Not sure it's a good fit for stagehand.

Are you looking for examples here, @TimWhiting ?

See https://github.com/dart-lang/build/tree/master/example and https://github.com/dart-lang/source_gen/tree/master/example

TimWhiting commented 4 years ago

@kevmoo There was a time period where I was trying to use codegen a lot because of a lack of compile time metaprogramming features in Dart.

I'm not really trying to do as much in that space any more, just living with code generators other people have written etc.

I'm not sure who the main audience is for stagehand, but I felt like there was a lot of setup involved for even just a simple code generator, which is why I created this issue back when I was experimenting with code generation. The examples from build and source_gen are nice, but copying an example by cloning a github repo and pulling out an example directory is not my idea of an easy way to get started with code generation.

In general it seems like there is a high barrier to entry for code generation, as well as an unfortunate development time cost of generating the files, which is why I'd love support for metaprogramming in Dart, but that is a language request and not related to this repository.

sarahec commented 4 years ago

I've already committed patches to Jorge Coca's example (https://github.com/jorgecoca/todo_reporter.dart) to bring it up to date. It's a reasonable starting point, so perhaps we should close this issue.

mit-mit commented 4 years ago

Closing