Skip to content

Commit

Permalink
Support flexible folder structures
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Greenleaf committed Feb 6, 2019
1 parent c7b8c7f commit 5402cdc
Show file tree
Hide file tree
Showing 44 changed files with 1,991 additions and 421 deletions.
345 changes: 166 additions & 179 deletions codegen/module.go

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions codegen/module_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ func NewDefaultModuleSystem(
h *PackageHelper,
hooks ...PostGenHook,
) (*ModuleSystem, error) {
system := NewModuleSystem(hooks...)
system := NewModuleSystem(h.moduleSearchPaths, hooks...)

tmpl, err := NewDefaultTemplate()
if err != nil {
Expand All @@ -267,9 +267,9 @@ func NewDefaultModuleSystem(

// Register client module class and type generators
if err := system.RegisterClass(ModuleClass{
Name: "client",
Directories: []string{"clients"},
ClassType: MultiModule,
Name: "client",
NamePlural: "clients",
ClassType: MultiModule,
}); err != nil {
return nil, errors.Wrapf(err, "Error registering client class")
}
Expand Down Expand Up @@ -305,10 +305,10 @@ func NewDefaultModuleSystem(
}

if err := system.RegisterClass(ModuleClass{
Name: "middleware",
Directories: []string{"middlewares"},
ClassType: MultiModule,
DependsOn: []string{"client"},
Name: "middleware",
NamePlural: "middlewares",
ClassType: MultiModule,
DependsOn: []string{"client"},
}); err != nil {
return nil, errors.Wrapf(
err,
Expand Down Expand Up @@ -338,10 +338,10 @@ func NewDefaultModuleSystem(

// Register endpoint module class and type generators
if err := system.RegisterClass(ModuleClass{
Name: "endpoint",
Directories: []string{"endpoints"},
ClassType: MultiModule,
DependsOn: []string{"client", "middleware"},
Name: "endpoint",
NamePlural: "endpoints",
ClassType: MultiModule,
DependsOn: []string{"client", "middleware"},
}); err != nil {
return nil, errors.Wrapf(err, "Error registering endpoint class")
}
Expand All @@ -367,10 +367,10 @@ func NewDefaultModuleSystem(
}

if err := system.RegisterClass(ModuleClass{
Name: "service",
Directories: []string{"services"},
ClassType: MultiModule,
DependsOn: []string{"endpoint"},
Name: "service",
NamePlural: "services",
ClassType: MultiModule,
DependsOn: []string{"endpoint"},
}); err != nil {
return nil, errors.Wrapf(
err,
Expand Down
Loading

0 comments on commit 5402cdc

Please sign in to comment.