From 56285f8637e5a4c95d4b20e534029892b0163477 Mon Sep 17 00:00:00 2001 From: "Lea\\Anthony" Date: Tue, 21 Dec 2021 08:53:36 +1100 Subject: [PATCH] [v2] Update docs --- v2/cmd/wails/internal/commands/build/README.md | 14 ++++++-------- .../wails/internal/commands/generate/generate.go | 4 ++-- .../commands/generate/template/base/README.md | 15 +++++++-------- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/v2/cmd/wails/internal/commands/build/README.md b/v2/cmd/wails/internal/commands/build/README.md index 32144507..b4bcc21d 100644 --- a/v2/cmd/wails/internal/commands/build/README.md +++ b/v2/cmd/wails/internal/commands/build/README.md @@ -15,8 +15,6 @@ The build command processes the Wails project and generates an application binar | -ldflags "custom ld flags" | Use given ldflags | | | -o path/to/binary | Compile to given path/filename | | | -k | Keep generated assets | | -| -package | Create a platform specific package | | -| -production | Compile in production mode: -ldflags="-w -s" + "-h windows" on Windows | | | -tags | Build tags to pass to Go compiler (quoted and space separated) | | | -upx | Compress final binary with UPX (if installed) | | | -upxflags "custom flags" | Flags to pass to upx | | @@ -36,13 +34,13 @@ The build process is as follows: - The frontend is then built. This command is read from the project file `wails.json` under the key `frontend:install` and executed in the `frontend` directory. If this is not defined, it is ignored. - The project directory is checked to see if the `build` directory exists. If not, it is created and default project assets are copied to it. - An asset bundle is then created by reading the `html` key from `wails.json` and loading the referenced file. This is then parsed, looking for local Javascript and CSS references. Those files are in turn loaded into memory, converted to C data and saved into the asset bundle located at `build/assets.h`, which also includes the original HTML. - - The application icon is then processed: if there is no `build/appicon.png`, a default icon is copied. On Windows, an `app.ico` file is generated from this png. On Mac, `icons.icns` is generated. - - If there are icons in the `build/tray` directory, these are processed, converted to C data and saved as `build/trayicons.h`, ready for the compilation step. - - If there are icons in the `build/dialog` directory, these are processed, converted to C data and saved as `build/userdialogicons.h`, ready for the compilation step. - - If the `-package` flag is given for a Windows target, the Windows assets in the `build/windows` directory are processed: manifest + icons compiled to a `.syso` file (deleted after compilation). - - If we are building a universal binary for Mac, the application is compiled for both `arm64` and `amd64`. The `lipo` tool is then executed to create the universal binary. + - The application icon is then processed: if there is no `build/appicon.png`, a default icon is copied. On Windows, + an `app.ico` file is generated from this png. On Mac, `icons.icns` is generated. + - The platform assets in the `build/` directory are processed: manifest + icons compiled to a `.syso` file ( + deleted after compilation), `info.plist` copied to `.app` on Mac. + - If we are building a universal binary for Mac, the application is compiled for both `arm64` and `amd64`. The `lipo` + tool is then executed to create the universal binary. - If we are not building a universal binary for Mac, the application is built using `go build`, using build tags to indicate type of application and build mode (debug/production). - If the `-upx` flag was provided, `upx` is invoked to compress the binary. Custom flags may be provided using the `-upxflags` flag. - - If the `package` flag is given for a non Windows target, the application is bundled for the platform. On Mac, this creates a `.app` with the processed icons, the `Info.plist` in `build/darwin` and the compiled binary. diff --git a/v2/cmd/wails/internal/commands/generate/generate.go b/v2/cmd/wails/internal/commands/generate/generate.go index 58f623bf..c1b45e11 100644 --- a/v2/cmd/wails/internal/commands/generate/generate.go +++ b/v2/cmd/wails/internal/commands/generate/generate.go @@ -1,9 +1,8 @@ package generate import ( - "io" - "github.com/wailsapp/wails/v2/cmd/wails/internal/commands/generate/template" + "io" "github.com/leaanthony/clir" ) @@ -17,6 +16,7 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error { if err != nil { return err } + template.AddSubCommand(app, command, w) return nil diff --git a/v2/cmd/wails/internal/commands/generate/template/base/README.md b/v2/cmd/wails/internal/commands/generate/template/base/README.md index fd993210..ed259fcf 100644 --- a/v2/cmd/wails/internal/commands/generate/template/base/README.md +++ b/v2/cmd/wails/internal/commands/generate/template/base/README.md @@ -4,13 +4,12 @@ About your template -## Building - -To build this project in debug mode, use `wails build`. For production, use `wails build -production`. -To generate a platform native package, add the `-package` flag. - ## Live Development -To run in live development mode, run `wails dev` in the project directory. In another terminal, go into the `frontend` -directory and run `npm run dev`. The frontend dev server will run on http://localhost:34115. Connect to this -in your browser and connect to your application. +To run in live development mode, run `wails dev` in the project directory. In another terminal, go into the `frontend` +directory and run `npm run dev`. The frontend dev server will run on http://localhost:34115. Connect to this in your +browser and connect to your application. + +## Building + +To build a redistributable, production mode package, use `wails build`.