mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-04 02:39:30 +08:00
Add devmode config to config.yml.
Remove devmode.config.yaml. Update Watcher command. Update templates.
This commit is contained in:
parent
35a680632e
commit
b4a61e11fa
@ -30,4 +30,4 @@ tasks:
|
||||
dev:
|
||||
summary: Runs the application in development mode
|
||||
cmds:
|
||||
- wails3 dev -config ./build/devmode.config.yaml -port {{.VITE_PORT}}
|
||||
- wails3 dev -config ./build/config.yml -port {{.VITE_PORT}}
|
||||
|
@ -13,6 +13,36 @@ info:
|
||||
comments: "Some Product Comments" # Comments
|
||||
version: "v0.0.1" # The application version
|
||||
|
||||
# Dev mode configuration
|
||||
dev_mode:
|
||||
root_path: .
|
||||
log_level: warn
|
||||
debounce: 1000
|
||||
ignore:
|
||||
dir:
|
||||
- .git
|
||||
- node_modules
|
||||
- frontend
|
||||
- bin
|
||||
file:
|
||||
- .DS_Store
|
||||
- .gitignore
|
||||
- .gitkeep
|
||||
watched_extension:
|
||||
- "*.go"
|
||||
git_ignore: true
|
||||
executes:
|
||||
- cmd: wails3 task common:install:frontend:deps
|
||||
type: once
|
||||
- cmd: wails3 task common:dev:frontend
|
||||
type: background
|
||||
- cmd: go mod tidy
|
||||
type: blocking
|
||||
- cmd: wails3 task build
|
||||
type: blocking
|
||||
- cmd: wails3 task run
|
||||
type: primary
|
||||
|
||||
# File Associations
|
||||
# More information at: https://v3alpha.wails.io/noit/done/yet
|
||||
fileAssociations:
|
||||
|
@ -15,7 +15,7 @@ const wailsVitePort = "WAILS_VITE_PORT"
|
||||
type DevOptions struct {
|
||||
flags.Common
|
||||
|
||||
Config string `description:"The config file including path" default:"./build/devmode.config.yaml"`
|
||||
Config string `description:"The config file including path" default:"./build/config.yml"`
|
||||
VitePort int `name:"port" description:"Specify the vite dev server port"`
|
||||
Secure bool `name:"s" description:"Enable HTTPS"`
|
||||
}
|
||||
|
@ -1,28 +0,0 @@
|
||||
config:
|
||||
root_path: .
|
||||
log_level: warn
|
||||
debounce: 1000
|
||||
ignore:
|
||||
dir:
|
||||
- .git
|
||||
- node_modules
|
||||
- frontend
|
||||
- bin
|
||||
file:
|
||||
- .DS_Store
|
||||
- .gitignore
|
||||
- .gitkeep
|
||||
watched_extension:
|
||||
- "*.go"
|
||||
git_ignore: true
|
||||
executes:
|
||||
- cmd: wails3 task common:install:frontend:deps
|
||||
type: once
|
||||
- cmd: wails3 task common:dev:frontend
|
||||
type: background
|
||||
- cmd: go mod tidy
|
||||
type: blocking
|
||||
- cmd: wails3 task build
|
||||
type: blocking
|
||||
- cmd: wails3 task run
|
||||
type: primary
|
@ -3,6 +3,7 @@ package commands
|
||||
import (
|
||||
"github.com/atterpac/refresh/engine"
|
||||
"github.com/wailsapp/wails/v3/internal/signal"
|
||||
"gopkg.in/yaml.v3"
|
||||
"os"
|
||||
)
|
||||
|
||||
@ -12,7 +13,25 @@ type WatcherOptions struct {
|
||||
|
||||
func Watcher(options *WatcherOptions) error {
|
||||
stopChan := make(chan struct{})
|
||||
watcherEngine, err := engine.NewEngineFromYAML(options.Config)
|
||||
|
||||
// Parse the config file
|
||||
type devConfig struct {
|
||||
Config engine.Config `yaml:"dev_mode"`
|
||||
}
|
||||
|
||||
var devconfig devConfig
|
||||
|
||||
// Parse the config file
|
||||
c, err := os.ReadFile(options.Config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = yaml.Unmarshal(c, &devconfig)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
watcherEngine, err := engine.NewEngineFromConfig(devconfig.Config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -30,4 +30,4 @@ tasks:
|
||||
dev:
|
||||
summary: Runs the application in development mode
|
||||
cmds:
|
||||
- wails3 dev -config ./build/devmode.config.yaml -port {{ "{{.VITE_PORT}}" }}
|
||||
- wails3 dev -config ./build/config.yml -port {{ "{{.VITE_PORT}}" }}
|
||||
|
Loading…
Reference in New Issue
Block a user