Skip to content

Commit

Permalink
Make common taskfile generate TS bindings when using a Typescript tem…
Browse files Browse the repository at this point in the history
…plate.
  • Loading branch information
leaanthony committed Dec 28, 2024
1 parent e794f5d commit 97cc4a4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/src/content/docs/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
-  Support fullscreen for frameless windows by [@leaanthony](https://github.com/leaanthony)
- Fix event handling by [@leaanthony](https://github.com/leaanthony)
- Fixed window shutdown logic by [@leaanthony](https://github.com/leaanthony)
- Common taskfile now defaults to generating Typescript bindings for Typescript templates by [@leaanthony](https://github.com/leaanthony)

### Changed

Expand Down
1 change: 1 addition & 0 deletions v3/internal/commands/build-assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type BuildAssetsOptions struct {
ProductComments string `description:"Comments to add to the generated files" default:"This is a comment"`
ProductIdentifier string `description:"The product identifier, e.g com.mycompany.myproduct"`
Silent bool `description:"Suppress output to console"`
Typescript bool `description:"Use typescript" default:"false"`
}

type BuildConfig struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ tasks:
generates:
- "frontend/bindings/**/*"
cmds:
- wails3 generate bindings -f '{{.BUILD_FLAGS}}'{{if .UseTypescript}} -ts{{end}}

- wails3 generate bindings -f {{ "'{{.BUILD_FLAGS}}'" }} {{if .Typescript}} -ts{{end}}
generate:icons:
summary: Generates Windows `.ico` and Mac `.icns` files from an image
dir: build
Expand All @@ -66,10 +65,10 @@ tasks:
deps:
- task: install:frontend:deps
cmds:
- npm run dev -- --port {{.VITE_PORT}} --strictPort
- npm run dev -- --port {{ "{{.VITE_PORT}}" }} --strictPort

update:build-assets:
summary: Updates the build assets
dir: build
cmds:
- wails3 update build-assets -name "{{.APP_NAME}}" -binaryname "{{.APP_NAME}}" -config config.yml -dir .
- wails3 update build-assets -name {{ "\"{{.APP_NAME}}\"" }} -binaryname {{ "\"{{.APP_NAME}}\"" }} -config config.yml -dir .
7 changes: 7 additions & 0 deletions v3/internal/commands/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ func Init(options *flags.Init) error {
pterm.DisableOutput()
}

// Check if the template is a typescript template
isTypescript := false
if strings.HasSuffix(options.TemplateName, "-ts") {
isTypescript = true
}

if options.ProjectName == "" {
return fmt.Errorf("please use the -n flag to specify a project name")
}
Expand Down Expand Up @@ -143,6 +149,7 @@ func Init(options *flags.Init) error {
ProductIdentifier: options.ProductIdentifier,
ProductCopyright: options.ProductCopyright,
ProductComments: options.ProductComments,
Typescript: isTypescript,
}
err = GenerateBuildAssets(buildAssetsOptions)
if err != nil {
Expand Down

0 comments on commit 97cc4a4

Please sign in to comment.