mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
Add -clean option for bindings generation.
This commit is contained in:
parent
e0c5de6e10
commit
c6f9ebe22d
6 changed files with 14 additions and 2 deletions
|
|
@ -36,6 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- `wails3 generate template` command by [@leaanthony](https://github.com/leaanthony)
|
||||
- `wails3 releasenotes` command by [@leaanthony](https://github.com/leaanthony)
|
||||
- `wails3 update cli` command by [@leaanthony](https://github.com/leaanthony)
|
||||
- `-clean` option for `wails3 generate bindings` command by [@leaanthony](https://github.com/leaanthony)
|
||||
|
||||
### Fixed
|
||||
|
||||
|
|
|
|||
|
|
@ -144,6 +144,7 @@ wails3 generate bindings [flags] [patterns...]
|
|||
| `-dry` | Dry run | `false` |
|
||||
| `-silent` | Silent mode | `false` |
|
||||
| `-v` | Debug output | `false` |
|
||||
| `-clean` | Clean output directory | `false` |
|
||||
|
||||
### `generate build-assets`
|
||||
Generates build assets for your application.
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ tasks:
|
|||
generates:
|
||||
- "frontend/bindings/**/*"
|
||||
cmds:
|
||||
- wails3 generate bindings -f '{{.BUILD_FLAGS}}'{{if .UseTypescript}} -ts{{end}}
|
||||
- wails3 generate bindings -f '{{.BUILD_FLAGS}}' -clean=true {{if .UseTypescript}} -ts{{end}}
|
||||
|
||||
generate:icons:
|
||||
summary: Generates Windows `.ico` and Mac `.icns` files from an image
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package commands
|
|||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/pterm/pterm"
|
||||
|
|
@ -37,6 +38,13 @@ func GenerateBindings(options *flags.GenerateBindingsOptions, patterns []string)
|
|||
return err
|
||||
}
|
||||
|
||||
// Clean the output directory if clean option is enabled
|
||||
if options.Clean {
|
||||
if err := os.RemoveAll(absPath); err != nil {
|
||||
return fmt.Errorf("failed to clean output directory: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Initialise file creator.
|
||||
var creator config.FileCreator
|
||||
if !options.DryRun {
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@ tasks:
|
|||
generates:
|
||||
- "frontend/bindings/**/*"
|
||||
cmds:
|
||||
- wails3 generate bindings -f {{ "'{{.BUILD_FLAGS}}'" }} {{if .Typescript}} -ts{{end}}
|
||||
- wails3 generate bindings -f {{ "'{{.BUILD_FLAGS}}'" }} -clean=true {{if .Typescript}} -ts{{end}}
|
||||
|
||||
generate:icons:
|
||||
summary: Generates Windows `.ico` and Mac `.icns` files from an image
|
||||
dir: build
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ type GenerateBindingsOptions struct {
|
|||
DryRun bool `name:"dry" description:"Do not write output files"`
|
||||
Silent bool `name:"silent" description:"Silent mode"`
|
||||
Verbose bool `name:"v" description:"Enable debug output"`
|
||||
Clean bool `name:"clean" description:"Clean output directory before generation" default:"true"`
|
||||
}
|
||||
|
||||
var ErrUnmatchedQuote = errors.New("build flags contain an unmatched quote")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue