mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-03 22:50:59 +08:00
Fix Promise<void>
return type. Tidy up.
This commit is contained in:
parent
5e96bb5a32
commit
5fc89c4cad
@ -24,10 +24,6 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
|
|||||||
|
|
||||||
command := app.NewSubCommand("build", "Builds the application")
|
command := app.NewSubCommand("build", "Builds the application")
|
||||||
|
|
||||||
// Setup target type flag
|
|
||||||
//description := "Type of application to build. Valid types: " + validTargetTypes.Join(",")
|
|
||||||
//command.StringFlag("t", description, &outputType)
|
|
||||||
|
|
||||||
// Setup production flag
|
// Setup production flag
|
||||||
production := false
|
production := false
|
||||||
command.BoolFlag("production", "Build in production mode", &production)
|
command.BoolFlag("production", "Build in production mode", &production)
|
||||||
@ -58,10 +54,6 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
|
|||||||
tags := ""
|
tags := ""
|
||||||
command.StringFlag("tags", "tags to pass to Go compiler (quoted and space separated)", &tags)
|
command.StringFlag("tags", "tags to pass to Go compiler (quoted and space separated)", &tags)
|
||||||
|
|
||||||
// Log to file
|
|
||||||
//logFile := ""
|
|
||||||
//command.StringFlag("l", "Log to file", &logFile)
|
|
||||||
|
|
||||||
// Retain assets
|
// Retain assets
|
||||||
keepAssets := false
|
keepAssets := false
|
||||||
command.BoolFlag("k", "Keep generated assets", &keepAssets)
|
command.BoolFlag("k", "Keep generated assets", &keepAssets)
|
||||||
@ -74,11 +66,6 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
|
|||||||
cleanBuildDirectory := false
|
cleanBuildDirectory := false
|
||||||
command.BoolFlag("clean", "Clean the build directory before building", &cleanBuildDirectory)
|
command.BoolFlag("clean", "Clean the build directory before building", &cleanBuildDirectory)
|
||||||
|
|
||||||
appleIdentity := ""
|
|
||||||
if runtime.GOOS == "darwin" {
|
|
||||||
command.StringFlag("sign", "Signs your app with the given identity.", &appleIdentity)
|
|
||||||
}
|
|
||||||
|
|
||||||
command.Action(func() error {
|
command.Action(func() error {
|
||||||
|
|
||||||
quiet := verbosity == 0
|
quiet := verbosity == 0
|
||||||
@ -96,11 +83,6 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
|
|||||||
app.PrintBanner()
|
app.PrintBanner()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure package is used with apple identity
|
|
||||||
if appleIdentity != "" && pack == false {
|
|
||||||
return fmt.Errorf("must use `-package` flag when using `-sign`")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Setup mode
|
// Setup mode
|
||||||
mode := build.Debug
|
mode := build.Debug
|
||||||
if production {
|
if production {
|
||||||
@ -146,7 +128,6 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
|
|||||||
LDFlags: ldflags,
|
LDFlags: ldflags,
|
||||||
Compiler: compilerCommand,
|
Compiler: compilerCommand,
|
||||||
KeepAssets: keepAssets,
|
KeepAssets: keepAssets,
|
||||||
AppleIdentity: appleIdentity,
|
|
||||||
Verbosity: verbosity,
|
Verbosity: verbosity,
|
||||||
Compress: compress,
|
Compress: compress,
|
||||||
UserTags: userTags,
|
UserTags: userTags,
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
"github.com/wailsapp/wails/v2/pkg/parser"
|
"github.com/wailsapp/wails/v2/pkg/parser"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AddSubcommand adds the `dev` command for the Wails application
|
// AddSubcommand adds the `generate` command for the Wails application
|
||||||
func AddSubcommand(app *clir.Cli, w io.Writer) error {
|
func AddSubcommand(app *clir.Cli, w io.Writer) error {
|
||||||
|
|
||||||
command := app.NewSubCommand("generate", "Code Generation Tools")
|
command := app.NewSubCommand("generate", "Code Generation Tools")
|
||||||
@ -19,7 +19,7 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
|
|||||||
|
|
||||||
// Quiet Init
|
// Quiet Init
|
||||||
quiet := false
|
quiet := false
|
||||||
backendAPI.BoolFlag("q", "Supress output to console", &quiet)
|
backendAPI.BoolFlag("q", "Suppress output to console", &quiet)
|
||||||
|
|
||||||
backendAPI.Action(func() error {
|
backendAPI.Action(func() error {
|
||||||
|
|
||||||
@ -85,7 +85,4 @@ func logPackage(pkg *parser.Package, logger *clilogger.CLILogger) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.Println("")
|
logger.Println("")
|
||||||
|
|
||||||
// logger.Println(" Original Go Package Path:", pkg.Gopackage.PkgPath)
|
|
||||||
// logger.Println(" Original Go Package Path:", pkg.Gopackage.PkgPath)
|
|
||||||
}
|
}
|
||||||
|
@ -14,30 +14,6 @@ import (
|
|||||||
"github.com/leaanthony/slicer"
|
"github.com/leaanthony/slicer"
|
||||||
)
|
)
|
||||||
|
|
||||||
const _comment = `
|
|
||||||
|
|
||||||
const backend = {
|
|
||||||
main: {
|
|
||||||
"xbarApp": {
|
|
||||||
"GetCategories": () => {
|
|
||||||
window.backend.main.xbarApp.GetCategories.call(arguments);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} arg1
|
|
||||||
*/
|
|
||||||
"InstallPlugin": (arg1) => {
|
|
||||||
window.backend.main.xbarApp.InstallPlugin.call(arguments);
|
|
||||||
},
|
|
||||||
"GetPlugins": () => {
|
|
||||||
window.backend.main.xbarApp.GetPlugins.call(arguments);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default backend;`
|
|
||||||
|
|
||||||
//go:embed assets/package.json
|
//go:embed assets/package.json
|
||||||
var packageJSON []byte
|
var packageJSON []byte
|
||||||
|
|
||||||
@ -100,6 +76,8 @@ const backend = {`)
|
|||||||
}
|
}
|
||||||
returnType += ">"
|
returnType += ">"
|
||||||
returnTypeDetails = " - Go Type: " + methodDetails.Outputs[0].TypeName
|
returnTypeDetails = " - Go Type: " + methodDetails.Outputs[0].TypeName
|
||||||
|
} else {
|
||||||
|
returnType = "Promise<void>"
|
||||||
}
|
}
|
||||||
output.WriteString(" * @returns {" + returnType + "} " + returnTypeDetails + "\n")
|
output.WriteString(" * @returns {" + returnType + "} " + returnTypeDetails + "\n")
|
||||||
output.WriteString(" */\n")
|
output.WriteString(" */\n")
|
||||||
@ -125,13 +103,14 @@ const backend = {`)
|
|||||||
export default backend;`)
|
export default backend;`)
|
||||||
output.WriteString("\n")
|
output.WriteString("\n")
|
||||||
|
|
||||||
|
// TODO: Make this configurable in wails.json
|
||||||
dirname, err := fs.RelativeToCwd("frontend/src/backend")
|
dirname, err := fs.RelativeToCwd("frontend/src/backend")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !fs.DirExists(dirname) {
|
if !fs.DirExists(dirname) {
|
||||||
err := fs.Mkdir(dirname)
|
err := fs.MkDirs(dirname)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ type Basic struct {
|
|||||||
runtime *wails.Runtime
|
runtime *wails.Runtime
|
||||||
}
|
}
|
||||||
|
|
||||||
// newBasic creates a new Basic application struct
|
// NewBasic creates a new Basic application struct
|
||||||
func NewBasic() *Basic {
|
func NewBasic() *Basic {
|
||||||
return &Basic{}
|
return &Basic{}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user