feat(14.3-01): add summer new with a starter route and relative go.work
- build.NewApp writes sm-<name>-app: go.mod with a relative framework
replace, go.work, summer.yaml, config/ and a starter plugin
- make:plugin gains an opt-in starter route (GET /{$}) in the same
routes.go template; plain make:plugin output is unchanged
- plugin:add writes go.work use paths relative to the go.work directory
- bonfire accepts new as a bare tool command name
This commit is contained in:
@@ -34,6 +34,7 @@ func toolCommands() []bonfire.Command {
|
||||
makeJobCommand(),
|
||||
makeAdminControllerCommand(),
|
||||
addPluginCommand(),
|
||||
newCommand(),
|
||||
devCommand(),
|
||||
parityProxyCommand(),
|
||||
parityRecordCommand(),
|
||||
@@ -297,3 +298,35 @@ func addPluginCommand() bonfire.Command {
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func newCommand() bonfire.Command {
|
||||
return bonfire.Command{
|
||||
Name: "new",
|
||||
Description: "Create a SummerCMS application in sm-<name>-app",
|
||||
Args: []bonfire.Arg{{
|
||||
Name: "name",
|
||||
Description: "Application name: lower-case letters and digits, starting with a letter; not a Go keyword, main or internal",
|
||||
Required: true,
|
||||
}},
|
||||
Flags: []bonfire.Flag{
|
||||
{Name: "framework", Description: "Path to the framework checkout"},
|
||||
},
|
||||
Run: func(ctx context.Context, in bonfire.Input, out bonfire.Output) error {
|
||||
name, ok := in.Argument("name")
|
||||
if !ok || name == "" {
|
||||
return fmt.Errorf("new requires an application name")
|
||||
}
|
||||
dir, err := os.Getwd()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
framework, _ := in.Flag("framework")
|
||||
_, err = build.NewApp(ctx, build.NewOptions{
|
||||
Name: name,
|
||||
Parent: dir,
|
||||
Framework: framework,
|
||||
}, out)
|
||||
return err
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user