Marten presently allows to generate new repository structures (projects or applications) easily through the use of the new, but there is no way to easily generate specific abstractions (such as models, handlers, schemas) or in-project structures (such as in-project applications) easily.
To palliate this, let's introduce a new gen management command (aliased g) that will allow to respond to this need. This is also something that people have been asking for since the initial release of Marten, and it should make it easier to work with the framework.
The gen management command
The gen management command should leverage an underlying generator mechanism that projects should be able to extend should they need to define custom generators. The way to call this new management command would be:
marten gen <generator> <arguments>
By default, the following generators should be made available by the Marten framework:
[x] model - allowing to generate a model in a specific application
[x] handler - allowing to generate a handler in a specific application
[x] schema - allowing to generate a schema in a specific application
[x] email - allowing to generate an email in a specific application
[x] app - allowing to add a new in-project application structure
[x] auth - allowing to add a new in-project authentication application structure
[x] secretkey - allowing to generate a safe/strong secret key value
For the applicable generators that can write to project applications: specifying a target application should be optional, and if not specified the target application should default to the main application (src folder).
Documentation
The following changes should be introduced in the documentation:
[x] A generators general guide should be added
[x] A generators reference should be added
[x] The Applications doc should be added to encourage the use of the app generator in order to add new apps within existing projects
[x] The Authentication doc should be updated to mention how to add authentication to existing projects through the use of the auth generator
Description
Marten presently allows to generate new repository structures (projects or applications) easily through the use of the
new
, but there is no way to easily generate specific abstractions (such as models, handlers, schemas) or in-project structures (such as in-project applications) easily.To palliate this, let's introduce a new
gen
management command (aliasedg
) that will allow to respond to this need. This is also something that people have been asking for since the initial release of Marten, and it should make it easier to work with the framework.The
gen
management commandThe
gen
management command should leverage an underlying generator mechanism that projects should be able to extend should they need to define custom generators. The way to call this new management command would be:By default, the following generators should be made available by the Marten framework:
model
- allowing to generate a model in a specific applicationhandler
- allowing to generate a handler in a specific applicationschema
- allowing to generate a schema in a specific applicationemail
- allowing to generate an email in a specific applicationapp
- allowing to add a new in-project application structureauth
- allowing to add a new in-project authentication application structuresecretkey
- allowing to generate a safe/strong secret key valueFor the applicable generators that can write to project applications: specifying a target application should be optional, and if not specified the target application should default to the main application (
src
folder).Documentation
The following changes should be introduced in the documentation:
app
generator in order to add new apps within existing projectsauth
generator